Skip to content

Commit

Permalink
Handle carriage returns in value
Browse files Browse the repository at this point in the history
  • Loading branch information
FIameCaster committed Dec 27, 2023
1 parent ad82bd0 commit 32dd207
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions package/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const createEditor = (
if (isNewGrammar || value != textarea.value) {
focusRelatedTarget()
textarea.value = value
value = textarea.value
textarea.selectionEnd = 0
update()
}
Expand Down
4 changes: 2 additions & 2 deletions package/src/testsite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ const editor2 = webComponent.editor

webComponent.addEventListener("ready", () => {
editor2.setOptions({
value: guides.trimEnd().replace(/\r/g, ""),
value: guides.trimEnd(),
})
editor2.addExtensions(
highlightCurrentWord(
Expand All @@ -207,7 +207,7 @@ const readonlyEditor = document.querySelector<PrismEditorElement>("readonly-edit

readonlyEditor.addEventListener("ready", () => {
readonlyEditor.editor.setOptions({
value: readme.replace(/\r/g, ""),
value: readme,
})
})

Expand Down

0 comments on commit 32dd207

Please sign in to comment.