Skip to content

Commit

Permalink
Bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
FIameCaster committed Nov 16, 2023
1 parent 3887da8 commit 852d493
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prism-code-editor",
"version": "2.2.1",
"version": "2.2.2",
"type": "module",
"description": "Lightweight, extensible code editor component for the web using Prism",
"main": "./dist/index.js",
Expand Down
14 changes: 4 additions & 10 deletions package/src/extensions/folding/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,7 @@ const readOnlyCodeFolding = (...providers: FoldingRangeProvider[]): ReadOnlyCode
}
editor.scrollContainer.style.setProperty(
"--padding-left",
options.lineNumbers == false
? "calc(var(--padding-inline,.75em) + var(--number-spacing,.75em))"
: "",
options.lineNumbers == false ? "calc(var(--_pse) + var(--_ns))" : "",
)
editor.addListener("update", createFolds)
setTimeout(editor.removeListener, 0, "update", createFolds)
Expand All @@ -242,7 +240,7 @@ const readOnlyCodeFolding = (...providers: FoldingRangeProvider[]): ReadOnlyCode
/**
* Folding range provider that allows folding of block comments. For this to work,
* you need to befine block comments in the {@link languageMap} for the language.
*
*
* Simply pass this function as one of the arguments when calling {@link readOnlyCodeFolding}.
*/
const blockCommentFolding: FoldingRangeProvider = ({ tokens, value, options: { language } }) => {
Expand All @@ -262,11 +260,7 @@ const blockCommentFolding: FoldingRangeProvider = ({ tokens, value, options: { l
if (comment)
folds.push([position + comment[0].length, position + length - comment[1].length])
} else if (Array.isArray(content))
findBlockComments(
content,
position,
type.indexOf("language-") ? language : type.slice(9),
)
findBlockComments(content, position, type.indexOf("language-") ? language : type.slice(9))
position += length
}
}
Expand All @@ -278,7 +272,7 @@ const blockCommentFolding: FoldingRangeProvider = ({ tokens, value, options: { l

/**
* Folding range provider that allows folding of titles and code blocks in markdown.
*
*
* Simply pass this function as one of the arguments when calling {@link readOnlyCodeFolding}.
*/
const markdownFolding: FoldingRangeProvider = ({ tokens, value, options: { language } }) => {
Expand Down
2 changes: 1 addition & 1 deletion package/src/testsite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const options = {
readOnly: false,
wordWrap: false,
value: code,
rtl: false,
rtl: false,
onUpdate(code) {},
onSelectionChange([start, end, direction], code) {},
onTokenize({ language, code, grammar, tokens }) {}
Expand Down
2 changes: 1 addition & 1 deletion package/src/testsite/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ readonly-editor {
}

readonly-editor {
--number-spacing: 1.6em;
--number-spacing: 1.5em;
}

.error svg {
Expand Down
2 changes: 1 addition & 1 deletion package/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ const scrollToEl = (editor: PrismEditor, el: HTMLElement, paddingTop = 0) => {
style2 = document.documentElement.style

style1.scrollPaddingBlock = style2.scrollPaddingBlock = `${paddingTop}px ${
isChrome && !el.innerText ? Math.round(el.getBoundingClientRect().height - el.scrollHeight) : 0
isChrome && !el.textContent ? el.offsetHeight : 0
}px`

el.scrollIntoView({ block: "nearest" })
Expand Down

0 comments on commit 852d493

Please sign in to comment.