@lvce-editor/editor-worker 19.74.3 → 19.74.4
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.
- package/dist/editorWorkerMain.js +30 -7
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -19496,9 +19496,31 @@ const resize = async (editor, dimensions) => {
|
|
|
19496
19496
|
};
|
|
19497
19497
|
const openCompletionDeferred = wrapDeferredCommand(openCompletion);
|
|
19498
19498
|
const updateAutomaticCompletionDeferred = wrapDeferredCommand(updateAutomaticCompletion);
|
|
19499
|
-
const
|
|
19500
|
-
|
|
19499
|
+
const removeHoverFromEditor = editor => {
|
|
19500
|
+
if (!editor.widgets?.some(widget => widget.id === Hover)) {
|
|
19501
|
+
return editor;
|
|
19502
|
+
}
|
|
19503
|
+
const newEditor = {
|
|
19504
|
+
...editor,
|
|
19505
|
+
additionalFocus: 0,
|
|
19506
|
+
focus: FocusEditorText$1,
|
|
19507
|
+
focused: true,
|
|
19508
|
+
widgetRevision: next(editor.uid),
|
|
19509
|
+
widgets: removeEditorWidget(editor.widgets, Hover)
|
|
19510
|
+
};
|
|
19511
|
+
return newEditor;
|
|
19512
|
+
};
|
|
19513
|
+
const wrapTypingCommand = (fn, shouldOpenCompletion, shouldDismissHover, preservesTypingCoalescing = true) => {
|
|
19514
|
+
const command = wrapCommand(async (editor, ...args) => {
|
|
19515
|
+
const newEditor = await fn(editor, ...args);
|
|
19516
|
+
return shouldDismissHover(...args) ? removeHoverFromEditor(newEditor) : newEditor;
|
|
19517
|
+
}, preservesTypingCoalescing);
|
|
19501
19518
|
return async (uid, ...args) => {
|
|
19519
|
+
const dismissHover = shouldDismissHover(...args);
|
|
19520
|
+
if (dismissHover) {
|
|
19521
|
+
clear$2(uid);
|
|
19522
|
+
clear$3(uid);
|
|
19523
|
+
}
|
|
19502
19524
|
await command(uid, ...args);
|
|
19503
19525
|
const editor = get$8(uid)?.newState;
|
|
19504
19526
|
if (editor && (shouldOpenCompletion(...args) && shouldOpenAutomaticCompletion(editor) || editor.widgets?.some(widget => widget.id === Completion && widget.newState.automatic))) {
|
|
@@ -19506,10 +19528,11 @@ const wrapTypingCommand = (fn, shouldOpenCompletion) => {
|
|
|
19506
19528
|
}
|
|
19507
19529
|
};
|
|
19508
19530
|
};
|
|
19509
|
-
const deleteLeftCommand = wrapTypingCommand(deleteCharacterLeft, () => false);
|
|
19510
|
-
const typeCommand = wrapTypingCommand(type, () => true);
|
|
19511
|
-
const typeWithAutoClosingCommand = wrapTypingCommand(typeWithAutoClosing, () => true);
|
|
19512
|
-
const handleBeforeInputCommand = wrapTypingCommand(handleBeforeInput, inputType => inputType === InsertText);
|
|
19531
|
+
const deleteLeftCommand = wrapTypingCommand(deleteCharacterLeft, () => false, () => false);
|
|
19532
|
+
const typeCommand = wrapTypingCommand(type, () => true, Boolean);
|
|
19533
|
+
const typeWithAutoClosingCommand = wrapTypingCommand(typeWithAutoClosing, () => true, Boolean);
|
|
19534
|
+
const handleBeforeInputCommand = wrapTypingCommand(handleBeforeInput, inputType => inputType === InsertText, (inputType, data) => inputType === InsertText && Boolean(data));
|
|
19535
|
+
const handleBeforeInputFromContentEditableCommand = wrapTypingCommand(handleBeforeInputFromContentEditable, () => false, (data, range) => Boolean(data) && Boolean(range), false);
|
|
19513
19536
|
const commandMap = {
|
|
19514
19537
|
'ActivateByEvent.activateByEvent': activateByEvent,
|
|
19515
19538
|
'CodeGenerator.accept': codeGeneratorAccept,
|
|
@@ -19610,7 +19633,7 @@ const commandMap = {
|
|
|
19610
19633
|
'Editor.goToDefinition': wrapCommand(goToDefinition),
|
|
19611
19634
|
'Editor.goToTypeDefinition': wrapCommand(goToTypeDefinition),
|
|
19612
19635
|
'Editor.handleBeforeInput': handleBeforeInputCommand,
|
|
19613
|
-
'Editor.handleBeforeInputFromContentEditable':
|
|
19636
|
+
'Editor.handleBeforeInputFromContentEditable': handleBeforeInputFromContentEditableCommand,
|
|
19614
19637
|
'Editor.handleBlur': wrapCommand(handleBlur$1),
|
|
19615
19638
|
'Editor.handleClickAtPosition': wrapCommand(handleClickAtPosition),
|
|
19616
19639
|
'Editor.handleContextMenu': wrapCommand(handleContextMenu),
|