UNPKG

@contentstack/live-preview-utils

Version:

Contentstack provides the Live Preview SDK to establish a communication channel between the various Contentstack SDKs and your website, transmitting live changes to the preview pane.

1 lines 1.42 kB
{"version":3,"sources":["../../../../src/visualBuilder/utils/getPsuedoEditableStylesElement.ts"],"sourcesContent":["import getCamelCaseStyles from \"./getCamelCaseStyles\";\nimport { getPsuedoEditableEssentialStyles } from \"./getPsuedoEditableEssentialStyles\";\nimport getStyleOfAnElement from \"./getStyleOfAnElement\";\n\nexport function getPsuedoEditableElementStyles(\n psuedoEditableElement: HTMLElement,\n camelCase?: boolean\n): { [key: string]: string } {\n let styles = getStyleOfAnElement(psuedoEditableElement);\n // Get the offsetTop and offsetLeft of the editable element and set the position of the pseudo editable element\n // The pseudo editable element is positioned absolutely at the same location as the editable element\n const rect = psuedoEditableElement.getBoundingClientRect();\n\n if (camelCase) {\n styles = getCamelCaseStyles(styles);\n }\n const overrides = getPsuedoEditableEssentialStyles({ rect, camelCase });\n return { ...styles, ...overrides };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAA+B;AAC/B,8CAAiD;AACjD,iCAAgC;AAEzB,SAAS,+BACZ,uBACA,WACyB;AACzB,MAAI,aAAS,2BAAAA,SAAoB,qBAAqB;AAGtD,QAAM,OAAO,sBAAsB,sBAAsB;AAEzD,MAAI,WAAW;AACX,iBAAS,0BAAAC,SAAmB,MAAM;AAAA,EACtC;AACA,QAAM,gBAAY,0EAAiC,EAAE,MAAM,UAAU,CAAC;AACtE,SAAO,EAAE,GAAG,QAAQ,GAAG,UAAU;AACrC;","names":["getStyleOfAnElement","getCamelCaseStyles"]}