-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #296 from contentstack/VC-115/live-editor-support
feat: v3.0.1
- Loading branch information
Showing
14 changed files
with
244 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ Alternatively, if you want to include the package directly in your website HTML | |
|
||
```html | ||
<script type='module' integrity='sha384-9M4o9H23Ax5ZTzsMRLgdlFBYk2hy+ub6XDiZhHWJjfebQ+MZ9iZw+GNep9ac0uFV' crossorigin="anonymous"> | ||
import ContentstackLivePreview from 'https://esm.sh/@contentstack/[email protected].0'; | ||
import ContentstackLivePreview from 'https://esm.sh/@contentstack/[email protected].1'; | ||
ContentstackLivePreview.init({ | ||
stackDetails: { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import getCamelCaseStyles from "./getCamelCaseStyles"; | ||
import getStyleOfAnElement from "./getStyleOfAnElement"; | ||
|
||
export function getPsuedoEditableElementStyles( | ||
psuedoEditableElement: HTMLElement, | ||
camelCase?: boolean | ||
): { [key: string]: string } { | ||
let styles = getStyleOfAnElement(psuedoEditableElement); | ||
if (camelCase) { | ||
styles = getCamelCaseStyles(styles); | ||
} | ||
// Get the offsetTop and offsetLeft of the editable element and set the position of the pseudo editable element | ||
// The pseudo editable element is positioned absolutely at the same location as the editable element | ||
const rect = psuedoEditableElement.getBoundingClientRect(); | ||
|
||
styles.position = "absolute"; | ||
styles.top = `${rect.top + window.scrollY}px`; | ||
styles.left = `${rect.left + window.scrollX}px`; | ||
// setting height to auto so that the element can grow based on the content | ||
// and the resize observer can detect the change in height | ||
styles.height = "auto"; | ||
styles.whiteSpace = "pre-line"; | ||
styles.textTransform = "none"; | ||
|
||
return styles; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.