@lvce-editor/editor-worker 3.24.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 +68 -67
- 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 = '"';
|
|
@@ -2281,13 +2282,31 @@ const closeCompletion = editor => {
|
|
|
2281
2282
|
};
|
|
2282
2283
|
|
|
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
|
+
|
|
2302
|
+
const isMatchingWidget = widget => {
|
|
2284
2303
|
return widget.id === SourceAction;
|
|
2285
2304
|
};
|
|
2286
2305
|
const closeSourceAction = editor => {
|
|
2287
2306
|
const {
|
|
2288
2307
|
widgets
|
|
2289
2308
|
} = editor;
|
|
2290
|
-
const index = widgets.findIndex(isMatchingWidget
|
|
2309
|
+
const index = widgets.findIndex(isMatchingWidget);
|
|
2291
2310
|
if (index === -1) {
|
|
2292
2311
|
return editor;
|
|
2293
2312
|
}
|
|
@@ -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) {
|
|
@@ -7599,24 +7611,6 @@ const toggleDetails = editor => {
|
|
|
7599
7611
|
return closeDetails(editor);
|
|
7600
7612
|
};
|
|
7601
7613
|
|
|
7602
|
-
const isMatchingWidget = widget => {
|
|
7603
|
-
return widget.id === Find;
|
|
7604
|
-
};
|
|
7605
|
-
const closeFind = editor => {
|
|
7606
|
-
const {
|
|
7607
|
-
widgets
|
|
7608
|
-
} = editor;
|
|
7609
|
-
const index = widgets.findIndex(isMatchingWidget);
|
|
7610
|
-
if (index === -1) {
|
|
7611
|
-
return editor;
|
|
7612
|
-
}
|
|
7613
|
-
const newWidgets = [...widgets.slice(0, index), ...widgets.slice(index + 1)];
|
|
7614
|
-
return {
|
|
7615
|
-
...editor,
|
|
7616
|
-
widgets: newWidgets
|
|
7617
|
-
};
|
|
7618
|
-
};
|
|
7619
|
-
|
|
7620
7614
|
const loadContent = async (editorUid, state, position) => {
|
|
7621
7615
|
const hoverInfo = await getEditorHoverInfo(editorUid, position);
|
|
7622
7616
|
if (!hoverInfo) {
|
|
@@ -7914,7 +7908,7 @@ const getText = editorUid => {
|
|
|
7914
7908
|
const {
|
|
7915
7909
|
lines
|
|
7916
7910
|
} = editor;
|
|
7917
|
-
return lines.join(
|
|
7911
|
+
return lines.join(NewLine$4);
|
|
7918
7912
|
};
|
|
7919
7913
|
|
|
7920
7914
|
const InsertText = 'insertText';
|
|
@@ -8871,7 +8865,13 @@ const widgetCommands = {
|
|
|
8871
8865
|
'FindWidget.focusReplaceAllButton': Find,
|
|
8872
8866
|
'FindWidget.focusNextMatchButton': Find,
|
|
8873
8867
|
'FindWidget.focusPreviousMatchButton': Find,
|
|
8874
|
-
'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,
|
|
8875
8875
|
};
|
|
8876
8876
|
|
|
8877
8877
|
// TODO wrap commands globally, not per editor
|
|
@@ -8907,8 +8907,8 @@ const commandMap = {
|
|
|
8907
8907
|
'Editor.braceCompletion': braceCompletion,
|
|
8908
8908
|
'Editor.cancelSelection': cancelSelection,
|
|
8909
8909
|
'Editor.closeCompletion': closeCompletion,
|
|
8910
|
-
'Editor.closeSourceAction': closeSourceAction,
|
|
8911
8910
|
'Editor.closeFind': closeFind,
|
|
8911
|
+
'Editor.closeSourceAction': closeSourceAction,
|
|
8912
8912
|
'Editor.compositionEnd': compositionEnd,
|
|
8913
8913
|
'Editor.compositionStart': compositionStart,
|
|
8914
8914
|
'Editor.compositionUpdate': compositionUpdate,
|
|
@@ -9038,6 +9038,7 @@ const commandMap = {
|
|
|
9038
9038
|
'EditorCompletion.handleEditorClick': handleEditorClick,
|
|
9039
9039
|
'EditorCompletion.handleEditorDeleteLeft': handleEditorDeleteLeft$1,
|
|
9040
9040
|
'EditorCompletion.handleEditorType': handleEditorType$1,
|
|
9041
|
+
'EditorCompletion.handleWheel': handelWheel,
|
|
9041
9042
|
'EditorCompletion.loadContent': loadContent$2,
|
|
9042
9043
|
'EditorCompletion.openDetails': openDetails,
|
|
9043
9044
|
'EditorCompletion.selectCurrent': selectCurrent,
|