@lvce-editor/editor-worker 19.74.6 → 19.74.7

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.
@@ -9565,14 +9565,18 @@ const getColorPickerBounds = editor => {
9565
9565
  const newStateGenerator$3 = (state, parentUid) => {
9566
9566
  return loadContent$3(state, parentUid);
9567
9567
  };
9568
- const openColorPicker = async editor => {
9568
+ const openColorPicker = async (editor, initialColor) => {
9569
9569
  const fullFocus = true;
9570
9570
  const bounds = getColorPickerBounds(editor);
9571
9571
  const {
9572
9572
  getColorPickerRange
9573
9573
  } = await Promise.resolve().then(function () { return GetColorPickerRange; });
9574
9574
  const range = await getColorPickerRange(editor);
9575
- const createWidget = () => create$5(bounds, range, editor.undoStack.length);
9575
+ const colorRange = initialColor === undefined ? range : {
9576
+ ...range,
9577
+ value: initialColor
9578
+ };
9579
+ const createWidget = () => create$5(bounds, colorRange, editor.undoStack.length);
9576
9580
  return addWidgetToEditor(ColorPicker$2, ColorPicker, editor, createWidget, newStateGenerator$3, fullFocus);
9577
9581
  };
9578
9582
  const closeColorPicker = editor => {
@@ -17621,6 +17625,8 @@ const loadContent = async (state, savedState, largeFile = false, focus = true, f
17621
17625
  tabSize,
17622
17626
  tokenizerId: state.tokenizerId
17623
17627
  };
17628
+ const snapshot = savedState;
17629
+ const hotReload = snapshot?.hotReload === true && Array.isArray(snapshot.lines) && snapshot.lines.every(line => typeof line === 'string');
17624
17630
  let existingEditor;
17625
17631
  if (!forceReload) {
17626
17632
  for (const key of getKeys$2()) {
@@ -17634,7 +17640,10 @@ const loadContent = async (state, savedState, largeFile = false, focus = true, f
17634
17640
  let content = existingEditor ? getText$1(existingEditor) : '';
17635
17641
  let endOfLine = existingEditor?.endOfLine || 'lf';
17636
17642
  try {
17637
- if (!existingEditor) {
17643
+ if (!existingEditor && hotReload) {
17644
+ content = snapshot.lines.join('\n');
17645
+ endOfLine = snapshot.endOfLine === 'crlf' ? 'crlf' : 'lf';
17646
+ } else if (!existingEditor) {
17638
17647
  content = await readFile(state.applicationId, uri, forceReload, state.editorFileCacheEnabled === true);
17639
17648
  endOfLine = getEndOfLine(content);
17640
17649
  content = normalizeLineEndings(content);
@@ -17718,7 +17727,7 @@ const loadContent = async (state, savedState, largeFile = false, focus = true, f
17718
17727
  ...newEditor4,
17719
17728
  completionsOnType: !largeFile && completionsOnType,
17720
17729
  initial: false,
17721
- modified: existingEditor?.modified || false,
17730
+ modified: existingEditor?.modified || hotReload && snapshot.modified === true,
17722
17731
  redoStack: existingEditor?.redoStack || savedHistory?.redoStack || [],
17723
17732
  undoStack: existingEditor?.undoStack || savedHistory?.undoStack || []
17724
17733
  };
@@ -19415,12 +19424,16 @@ const save = async (uid, skipFormatting = false) => {
19415
19424
  }
19416
19425
  };
19417
19426
 
19418
- const saveState = async (state, savedState) => {
19427
+ const saveState = async (state, hotReload) => {
19419
19428
  const {
19429
+ deltaY,
19430
+ endOfLine,
19420
19431
  explicitLanguageId,
19421
19432
  largeFile,
19422
19433
  lines,
19434
+ modified,
19423
19435
  redoStack,
19436
+ selections,
19424
19437
  undoStack,
19425
19438
  widgets: stateWidgets
19426
19439
  } = state;
@@ -19440,7 +19453,7 @@ const saveState = async (state, savedState) => {
19440
19453
  state: widgetState
19441
19454
  });
19442
19455
  }
19443
- return {
19456
+ const savedState = {
19444
19457
  ...(explicitLanguageId && {
19445
19458
  explicitLanguageId
19446
19459
  }),
@@ -19456,6 +19469,20 @@ const saveState = async (state, savedState) => {
19456
19469
  undoStack
19457
19470
  })
19458
19471
  };
19472
+ if (hotReload !== true) {
19473
+ return savedState;
19474
+ }
19475
+ return {
19476
+ ...savedState,
19477
+ deltaY,
19478
+ endOfLine,
19479
+ hotReload: true,
19480
+ lines,
19481
+ modified,
19482
+ redoStack,
19483
+ selections: [...selections],
19484
+ undoStack
19485
+ };
19459
19486
  };
19460
19487
 
19461
19488
  const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
@@ -344,7 +344,17 @@
344
344
  "description": "Enables tab completions",
345
345
  "heading": "Tab Completion",
346
346
  "id": "editor.tabCompletion",
347
- "type": "string",
347
+ "options": [
348
+ {
349
+ "id": "on",
350
+ "label": "On"
351
+ },
352
+ {
353
+ "id": "off",
354
+ "label": "off"
355
+ }
356
+ ],
357
+ "type": "enum",
348
358
  "value": "on"
349
359
  },
350
360
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.74.6",
3
+ "version": "19.74.7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"