@lvce-editor/editor-worker 3.23.0 → 3.25.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.
- package/dist/editorWorkerMain.js +67 -47
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -461,6 +461,7 @@ const getSelectionPairs = (selections, i) => {
|
|
|
461
461
|
};
|
|
462
462
|
|
|
463
463
|
const EmptyString$1 = '';
|
|
464
|
+
const NewLine$4 = '\n';
|
|
464
465
|
const Space$1 = ' ';
|
|
465
466
|
const Tab = '\t';
|
|
466
467
|
const DoubleQuote$1 = '"';
|
|
@@ -2280,6 +2281,24 @@ const closeCompletion = editor => {
|
|
|
2280
2281
|
};
|
|
2281
2282
|
};
|
|
2282
2283
|
|
|
2284
|
+
const isMatchingWidget$1 = widget => {
|
|
2285
|
+
return widget.id === Find;
|
|
2286
|
+
};
|
|
2287
|
+
const closeFind = editor => {
|
|
2288
|
+
const {
|
|
2289
|
+
widgets
|
|
2290
|
+
} = editor;
|
|
2291
|
+
const index = widgets.findIndex(isMatchingWidget$1);
|
|
2292
|
+
if (index === -1) {
|
|
2293
|
+
return editor;
|
|
2294
|
+
}
|
|
2295
|
+
const newWidgets = [...widgets.slice(0, index), ...widgets.slice(index + 1)];
|
|
2296
|
+
return {
|
|
2297
|
+
...editor,
|
|
2298
|
+
widgets: newWidgets
|
|
2299
|
+
};
|
|
2300
|
+
};
|
|
2301
|
+
|
|
2283
2302
|
const isMatchingWidget = widget => {
|
|
2284
2303
|
return widget.id === SourceAction;
|
|
2285
2304
|
};
|
|
@@ -4476,7 +4495,11 @@ const create$4 = () => {
|
|
|
4476
4495
|
x: 0,
|
|
4477
4496
|
y: 0,
|
|
4478
4497
|
width: 0,
|
|
4479
|
-
height: 0
|
|
4498
|
+
height: 0,
|
|
4499
|
+
deltaY: 0,
|
|
4500
|
+
finalDeltaY: 0,
|
|
4501
|
+
focused: false,
|
|
4502
|
+
headerHeight: 0
|
|
4480
4503
|
},
|
|
4481
4504
|
newState: {
|
|
4482
4505
|
items: [],
|
|
@@ -4489,7 +4512,11 @@ const create$4 = () => {
|
|
|
4489
4512
|
x: 0,
|
|
4490
4513
|
y: 0,
|
|
4491
4514
|
width: 0,
|
|
4492
|
-
height: 0
|
|
4515
|
+
height: 0,
|
|
4516
|
+
deltaY: 0,
|
|
4517
|
+
finalDeltaY: 0,
|
|
4518
|
+
headerHeight: 0,
|
|
4519
|
+
focused: false
|
|
4493
4520
|
}
|
|
4494
4521
|
};
|
|
4495
4522
|
return completionWidget;
|
|
@@ -7406,57 +7433,38 @@ const closeDetails = editor => {
|
|
|
7406
7433
|
};
|
|
7407
7434
|
};
|
|
7408
7435
|
|
|
7409
|
-
const
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
return widget.id === Completion;
|
|
7415
|
-
};
|
|
7416
|
-
const focusIndex = (editor, index) => {
|
|
7417
|
-
const child = getCompletionState(editor);
|
|
7418
|
-
if (index === -1) {
|
|
7419
|
-
return editor;
|
|
7420
|
-
}
|
|
7421
|
-
const childIndex = editor.widgets.findIndex(isCompletion$1);
|
|
7422
|
-
// TODO scroll up/down if necessary
|
|
7423
|
-
const childWidget = editor.widgets[childIndex];
|
|
7424
|
-
const newWidget = {
|
|
7425
|
-
...childWidget,
|
|
7426
|
-
newState: {
|
|
7427
|
-
...child,
|
|
7428
|
-
focusedIndex: index,
|
|
7429
|
-
focused: true
|
|
7430
|
-
}
|
|
7431
|
-
};
|
|
7432
|
-
const newWidgets = [...editor.widgets.slice(0, childIndex), newWidget, ...editor.widgets.slice(childIndex + 1)];
|
|
7433
|
-
return {
|
|
7434
|
-
...editor,
|
|
7435
|
-
widgets: newWidgets
|
|
7436
|
+
const focusIndex = (state, index) => {
|
|
7437
|
+
const newState = {
|
|
7438
|
+
...state,
|
|
7439
|
+
focusedIndex: index,
|
|
7440
|
+
focused: true
|
|
7436
7441
|
};
|
|
7442
|
+
return newState;
|
|
7437
7443
|
};
|
|
7438
7444
|
|
|
7439
|
-
const focusFirst =
|
|
7445
|
+
const focusFirst = state => {
|
|
7440
7446
|
const firstIndex = 0;
|
|
7441
|
-
return focusIndex(
|
|
7447
|
+
return focusIndex(state, firstIndex);
|
|
7442
7448
|
};
|
|
7443
7449
|
|
|
7444
|
-
const focusNext =
|
|
7445
|
-
const
|
|
7446
|
-
|
|
7447
|
-
return editor;
|
|
7448
|
-
}
|
|
7449
|
-
const nextIndex = child.focusedIndex + 1;
|
|
7450
|
-
return focusIndex(editor, nextIndex);
|
|
7450
|
+
const focusNext = state => {
|
|
7451
|
+
const nextIndex = state.focusedIndex + 1;
|
|
7452
|
+
return focusIndex(state, nextIndex);
|
|
7451
7453
|
};
|
|
7452
7454
|
|
|
7453
|
-
const focusPrevious =
|
|
7454
|
-
const
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
|
|
7459
|
-
|
|
7455
|
+
const focusPrevious = state => {
|
|
7456
|
+
const previousIndex = state.focusedIndex - 1;
|
|
7457
|
+
return focusIndex(state, previousIndex);
|
|
7458
|
+
};
|
|
7459
|
+
|
|
7460
|
+
const handelWheel = (state, deltaMode, deltaY) => {
|
|
7461
|
+
console.log({
|
|
7462
|
+
deltaMode,
|
|
7463
|
+
deltaY,
|
|
7464
|
+
state
|
|
7465
|
+
});
|
|
7466
|
+
// TODO
|
|
7467
|
+
return state;
|
|
7460
7468
|
};
|
|
7461
7469
|
|
|
7462
7470
|
const create = () => {
|
|
@@ -7492,6 +7500,10 @@ const getCompletionDetailBounds = (completionBounds, borderSize) => {
|
|
|
7492
7500
|
};
|
|
7493
7501
|
};
|
|
7494
7502
|
|
|
7503
|
+
const getCompletionState = editor => {
|
|
7504
|
+
return getWidgetState(editor, Completion);
|
|
7505
|
+
};
|
|
7506
|
+
|
|
7495
7507
|
const openDetails = editor => {
|
|
7496
7508
|
const child = getCompletionState(editor);
|
|
7497
7509
|
if (!child) {
|
|
@@ -7896,7 +7908,7 @@ const getText = editorUid => {
|
|
|
7896
7908
|
const {
|
|
7897
7909
|
lines
|
|
7898
7910
|
} = editor;
|
|
7899
|
-
return lines.join(
|
|
7911
|
+
return lines.join(NewLine$4);
|
|
7900
7912
|
};
|
|
7901
7913
|
|
|
7902
7914
|
const InsertText = 'insertText';
|
|
@@ -8853,7 +8865,13 @@ const widgetCommands = {
|
|
|
8853
8865
|
'FindWidget.focusReplaceAllButton': Find,
|
|
8854
8866
|
'FindWidget.focusNextMatchButton': Find,
|
|
8855
8867
|
'FindWidget.focusPreviousMatchButton': Find,
|
|
8856
|
-
'FindWidget.focusCloseButton': Find
|
|
8868
|
+
'FindWidget.focusCloseButton': Find,
|
|
8869
|
+
'EditorCompletion.handleWheel': Completion,
|
|
8870
|
+
// TODO
|
|
8871
|
+
// 'EditorCompletion.focusFirst': WidgetId.Completion,
|
|
8872
|
+
'EditorCompletion.focusNext': Completion
|
|
8873
|
+
// 'EditorCompletion.focusPrevious': WidgetId.Completion,
|
|
8874
|
+
// 'EditorCompletion.focusLast': WidgetId.Completion,
|
|
8857
8875
|
};
|
|
8858
8876
|
|
|
8859
8877
|
// TODO wrap commands globally, not per editor
|
|
@@ -8889,6 +8907,7 @@ const commandMap = {
|
|
|
8889
8907
|
'Editor.braceCompletion': braceCompletion,
|
|
8890
8908
|
'Editor.cancelSelection': cancelSelection,
|
|
8891
8909
|
'Editor.closeCompletion': closeCompletion,
|
|
8910
|
+
'Editor.closeFind': closeFind,
|
|
8892
8911
|
'Editor.closeSourceAction': closeSourceAction,
|
|
8893
8912
|
'Editor.compositionEnd': compositionEnd,
|
|
8894
8913
|
'Editor.compositionStart': compositionStart,
|
|
@@ -9019,6 +9038,7 @@ const commandMap = {
|
|
|
9019
9038
|
'EditorCompletion.handleEditorClick': handleEditorClick,
|
|
9020
9039
|
'EditorCompletion.handleEditorDeleteLeft': handleEditorDeleteLeft$1,
|
|
9021
9040
|
'EditorCompletion.handleEditorType': handleEditorType$1,
|
|
9041
|
+
'EditorCompletion.handleWheel': handelWheel,
|
|
9022
9042
|
'EditorCompletion.loadContent': loadContent$2,
|
|
9023
9043
|
'EditorCompletion.openDetails': openDetails,
|
|
9024
9044
|
'EditorCompletion.selectCurrent': selectCurrent,
|