@lvce-editor/editor-worker 19.60.3 → 19.61.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14329,9 +14329,10 @@ const getBreadcrumbsEnabled = async () => {
14329
14329
  };
14330
14330
 
14331
14331
  const getEditorPreferences = async () => {
14332
- const [diagnosticsEnabled$1, fontFamily, fontSize, fontWeight, formatOnSave, hoverEnabled, isAutoClosingBracketsEnabled$1, isAutoClosingQuotesEnabled$1, isAutoClosingTagsEnabled$1, isQuickSuggestionsEnabled$1, lineNumbers, highlightActiveLineNumber, rowHeight, tabSize, letterSpacing, completionTriggerCharacters, minimapEnabled, mergeConflictActionsEnabled, breadcrumbsEnabled, insertSpaces, dragAndDropEnabled] = await Promise.all([diagnosticsEnabled(), getFontFamily(), getFontSize(), getFontWeight(), getFormatOnSave(), getHoverEnabled(), isAutoClosingBracketsEnabled(), isAutoClosingQuotesEnabled(), isAutoClosingTagsEnabled(), isQuickSuggestionsEnabled(), getLineNumbers(), getHighlightActiveLineNumber(), getRowHeight(), getTabSize(), getLetterSpacing(), getCompletionTriggerCharacters(), getMinimapEnabled(), getMergeConflictActionsEnabled(), getBreadcrumbsEnabled(), getInsertSpaces(), getDragAndDropEnabled()]);
14332
+ const [diagnosticsEnabled$1, fontFamily, fontSize, fontWeight, formatOnSave, hoverEnabled, isAutoClosingBracketsEnabled$1, isAutoClosingQuotesEnabled$1, isAutoClosingTagsEnabled$1, isQuickSuggestionsEnabled$1, lineNumbers, highlightActiveLineNumber, rowHeight, tabSize, letterSpacing, completionTriggerCharacters, minimapEnabled, mergeConflictActionsEnabled, breadcrumbsEnabled, insertSpaces, dragAndDropEnabled, combineWhitespaceTokens] = await Promise.all([diagnosticsEnabled(), getFontFamily(), getFontSize(), getFontWeight(), getFormatOnSave(), getHoverEnabled(), isAutoClosingBracketsEnabled(), isAutoClosingQuotesEnabled(), isAutoClosingTagsEnabled(), isQuickSuggestionsEnabled(), getLineNumbers(), getHighlightActiveLineNumber(), getRowHeight(), getTabSize(), getLetterSpacing(), getCompletionTriggerCharacters(), getMinimapEnabled(), getMergeConflictActionsEnabled(), getBreadcrumbsEnabled(), getInsertSpaces(), getDragAndDropEnabled(), get$3('editor.combineWhitespaceTokens')]);
14333
14333
  return {
14334
14334
  breadcrumbsEnabled,
14335
+ combineWhitespaceTokens: combineWhitespaceTokens ?? false,
14335
14336
  completionTriggerCharacters,
14336
14337
  diagnosticsEnabled: diagnosticsEnabled$1,
14337
14338
  dragAndDropEnabled,
@@ -14675,6 +14676,7 @@ const loadContent = async (state, savedState) => {
14675
14676
  } = state;
14676
14677
  const {
14677
14678
  breadcrumbsEnabled,
14679
+ combineWhitespaceTokens,
14678
14680
  completionTriggerCharacters,
14679
14681
  diagnosticsEnabled,
14680
14682
  dragAndDropEnabled,
@@ -14710,6 +14712,7 @@ const loadContent = async (state, savedState) => {
14710
14712
  ...state,
14711
14713
  breadcrumbsEnabled,
14712
14714
  charWidth,
14715
+ combineWhitespaceTokens,
14713
14716
  completionTriggerCharacters,
14714
14717
  diagnosticsEnabled,
14715
14718
  dragAndDropEnabled,
@@ -15089,6 +15092,19 @@ const Button = 'button';
15089
15092
  const Code = 'code';
15090
15093
  const TextBox = 'textbox';
15091
15094
 
15095
+ const combineWhitespaceTokens = tokens => {
15096
+ const combined = [];
15097
+ for (let i = 0; i < tokens.length; i += 2) {
15098
+ const tokenText = tokens[i];
15099
+ if (combined.length > 0 && /^[ \t]+$/.test(tokenText)) {
15100
+ combined[combined.length - 2] += tokenText;
15101
+ } else {
15102
+ combined.push(tokenText, tokens[i + 1]);
15103
+ }
15104
+ }
15105
+ return combined;
15106
+ };
15107
+
15092
15108
  const getPathname = uri => {
15093
15109
  return decodeURIComponent(URL.canParse(uri) ? new URL(uri).pathname : uri);
15094
15110
  };
@@ -15633,6 +15649,7 @@ const getEditorVirtualDom = ({
15633
15649
  bracketMatchInfos = [],
15634
15650
  breadcrumbsEnabled = false,
15635
15651
  breakPoints = [],
15652
+ combineWhitespaceTokens: combineWhitespaceTokens$1 = false,
15636
15653
  cursorInfos = [],
15637
15654
  diagnostics = [],
15638
15655
  differences,
@@ -15707,7 +15724,7 @@ const getEditorVirtualDom = ({
15707
15724
  problemsHighlightedRow,
15708
15725
  scrollBarDiagnostics,
15709
15726
  selectionInfos,
15710
- textInfos,
15727
+ textInfos: combineWhitespaceTokens$1 ? textInfos.map(combineWhitespaceTokens) : textInfos,
15711
15728
  visibleLineIndices: visibleLineIndices || [],
15712
15729
  visibleViewLineIndices
15713
15730
  }), ...minimapDom];
@@ -1,4 +1,12 @@
1
1
  [
2
+ {
3
+ "category": "text-editor",
4
+ "description": "Combine space and tab tokens with the preceding token when rendering to reduce DOM nodes",
5
+ "heading": "Combine Whitespace Tokens",
6
+ "id": "editor.combineWhitespaceTokens",
7
+ "type": "boolean",
8
+ "value": false
9
+ },
2
10
  {
3
11
  "category": "text-editor",
4
12
  "description": "The font size of the editor",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.60.3",
3
+ "version": "19.61.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"