@lvce-editor/editor-worker 18.0.0 → 18.2.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 +62 -7
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -1123,7 +1123,7 @@ const LeftArrow = 13;
|
|
|
1123
1123
|
const UpArrow = 14;
|
|
1124
1124
|
const RightArrow = 15;
|
|
1125
1125
|
const DownArrow = 16;
|
|
1126
|
-
const Delete = 18;
|
|
1126
|
+
const Delete$1 = 18;
|
|
1127
1127
|
const KeyA = 29;
|
|
1128
1128
|
const KeyC = 31;
|
|
1129
1129
|
const KeyD = 32;
|
|
@@ -1811,6 +1811,7 @@ const loadContent$2 = async (state, parentUid) => {
|
|
|
1811
1811
|
// TODO use numeric enum
|
|
1812
1812
|
const CompositionUpdate = 'compositionUpdate';
|
|
1813
1813
|
const ContentEditableInput = 'contentEditableInput';
|
|
1814
|
+
const Delete = 'delete';
|
|
1814
1815
|
const DeleteHorizontalRight = 'deleteHorizontalRight';
|
|
1815
1816
|
const DeleteLeft = 'deleteLeft';
|
|
1816
1817
|
const EditorCut = 'editorCut';
|
|
@@ -3784,7 +3785,7 @@ const setBounds = (editor, x, y, width, height, columnWidth) => {
|
|
|
3784
3785
|
y
|
|
3785
3786
|
};
|
|
3786
3787
|
};
|
|
3787
|
-
const setText = (editor, text) => {
|
|
3788
|
+
const setText$1 = (editor, text) => {
|
|
3788
3789
|
const lines = splitLines(text);
|
|
3789
3790
|
const {
|
|
3790
3791
|
itemHeight,
|
|
@@ -4182,7 +4183,7 @@ const createEditor = async ({
|
|
|
4182
4183
|
|
|
4183
4184
|
// TODO avoid creating intermediate editors here
|
|
4184
4185
|
const newEditor1 = setBounds(editor, x, y, width, height, 9);
|
|
4185
|
-
const newEditor2 = setText(newEditor1, content);
|
|
4186
|
+
const newEditor2 = setText$1(newEditor1, content);
|
|
4186
4187
|
let newEditor3;
|
|
4187
4188
|
if (lineToReveal && columnToReveal) {
|
|
4188
4189
|
const delta = lineToReveal * rowHeight;
|
|
@@ -5405,6 +5406,33 @@ const cut$1 = async editor => {
|
|
|
5405
5406
|
return cutSelectedText(editor);
|
|
5406
5407
|
};
|
|
5407
5408
|
|
|
5409
|
+
const deleteAll = editor => {
|
|
5410
|
+
const {
|
|
5411
|
+
lines
|
|
5412
|
+
} = editor;
|
|
5413
|
+
const endRowIndex = lines.length - 1;
|
|
5414
|
+
const endColumnIndex = lines.at(-1).length;
|
|
5415
|
+
const start = {
|
|
5416
|
+
columnIndex: 0,
|
|
5417
|
+
rowIndex: 0
|
|
5418
|
+
};
|
|
5419
|
+
const end = {
|
|
5420
|
+
columnIndex: endColumnIndex,
|
|
5421
|
+
rowIndex: endRowIndex
|
|
5422
|
+
};
|
|
5423
|
+
const changes = [{
|
|
5424
|
+
deleted: getSelectionText(editor, {
|
|
5425
|
+
end,
|
|
5426
|
+
start
|
|
5427
|
+
}),
|
|
5428
|
+
end,
|
|
5429
|
+
inserted: [''],
|
|
5430
|
+
origin: Delete,
|
|
5431
|
+
start
|
|
5432
|
+
}];
|
|
5433
|
+
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
5434
|
+
};
|
|
5435
|
+
|
|
5408
5436
|
// TODO optimize this function by profiling and not allocating too many objects
|
|
5409
5437
|
// @ts-ignore
|
|
5410
5438
|
const getChanges$5 = (lines, selections, getDelta) => {
|
|
@@ -8129,6 +8157,31 @@ const setSelections = (editor, selections) => {
|
|
|
8129
8157
|
};
|
|
8130
8158
|
};
|
|
8131
8159
|
|
|
8160
|
+
const setText = (editor, text) => {
|
|
8161
|
+
string(text);
|
|
8162
|
+
const endRowIndex = editor.lines.length - 1;
|
|
8163
|
+
const endColumnIndex = editor.lines.at(-1).length;
|
|
8164
|
+
const start = {
|
|
8165
|
+
columnIndex: 0,
|
|
8166
|
+
rowIndex: 0
|
|
8167
|
+
};
|
|
8168
|
+
const end = {
|
|
8169
|
+
columnIndex: endColumnIndex,
|
|
8170
|
+
rowIndex: endRowIndex
|
|
8171
|
+
};
|
|
8172
|
+
const changes = [{
|
|
8173
|
+
deleted: getSelectionText(editor, {
|
|
8174
|
+
end,
|
|
8175
|
+
start
|
|
8176
|
+
}),
|
|
8177
|
+
end,
|
|
8178
|
+
inserted: splitLines(text),
|
|
8179
|
+
origin: EditorType,
|
|
8180
|
+
start
|
|
8181
|
+
}];
|
|
8182
|
+
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
8183
|
+
};
|
|
8184
|
+
|
|
8132
8185
|
const create$1 = () => {
|
|
8133
8186
|
const uid = create$7();
|
|
8134
8187
|
const widget = {
|
|
@@ -10206,7 +10259,7 @@ const getKeyBindings = () => {
|
|
|
10206
10259
|
when: FocusEditorText
|
|
10207
10260
|
}, {
|
|
10208
10261
|
command: 'Editor.deleteWordPartRight',
|
|
10209
|
-
key: Alt$1 | Delete,
|
|
10262
|
+
key: Alt$1 | Delete$1,
|
|
10210
10263
|
when: FocusEditorText
|
|
10211
10264
|
}, {
|
|
10212
10265
|
command: 'Editor.deleteWordLeft',
|
|
@@ -10214,7 +10267,7 @@ const getKeyBindings = () => {
|
|
|
10214
10267
|
when: FocusEditorText
|
|
10215
10268
|
}, {
|
|
10216
10269
|
command: 'Editor.deleteWordRight',
|
|
10217
|
-
key: CtrlCmd | Delete,
|
|
10270
|
+
key: CtrlCmd | Delete$1,
|
|
10218
10271
|
when: FocusEditorText
|
|
10219
10272
|
}, {
|
|
10220
10273
|
command: 'Editor.selectNextOccurrence',
|
|
@@ -10290,7 +10343,7 @@ const getKeyBindings = () => {
|
|
|
10290
10343
|
when: FocusEditorText
|
|
10291
10344
|
}, {
|
|
10292
10345
|
command: 'Editor.deleteAllRight',
|
|
10293
|
-
key: CtrlCmd | Shift | Delete,
|
|
10346
|
+
key: CtrlCmd | Shift | Delete$1,
|
|
10294
10347
|
when: FocusEditorText
|
|
10295
10348
|
}, {
|
|
10296
10349
|
command: 'Editor.cancelSelection',
|
|
@@ -10322,7 +10375,7 @@ const getKeyBindings = () => {
|
|
|
10322
10375
|
when: FocusEditorText
|
|
10323
10376
|
}, {
|
|
10324
10377
|
command: 'Editor.deleteRight',
|
|
10325
|
-
key: Delete,
|
|
10378
|
+
key: Delete$1,
|
|
10326
10379
|
when: FocusEditorText
|
|
10327
10380
|
}, {
|
|
10328
10381
|
command: 'Editor.insertLineBreak',
|
|
@@ -11411,6 +11464,7 @@ const commandMap = {
|
|
|
11411
11464
|
'Editor.cursorWordPartRight': wrapCommand(cursorWordPartRight),
|
|
11412
11465
|
'Editor.cursorWordRight': wrapCommand(cursorWordRight),
|
|
11413
11466
|
'Editor.cut': wrapCommand(cut$1),
|
|
11467
|
+
'Editor.deleteAll': wrapCommand(deleteAll),
|
|
11414
11468
|
'Editor.deleteAllLeft': wrapCommand(deleteAllLeft),
|
|
11415
11469
|
'Editor.deleteAllRight': wrapCommand(deleteAllRight),
|
|
11416
11470
|
'Editor.deleteCharacterLeft': wrapCommand(deleteCharacterLeft),
|
|
@@ -11523,6 +11577,7 @@ const commandMap = {
|
|
|
11523
11577
|
'Editor.setLanguageId': wrapCommand(setLanguageId),
|
|
11524
11578
|
'Editor.setSelections': wrapCommand(setSelections),
|
|
11525
11579
|
'Editor.setSelections2': setSelections2,
|
|
11580
|
+
'Editor.setText': wrapCommand(setText),
|
|
11526
11581
|
'Editor.showHover': showHover,
|
|
11527
11582
|
'Editor.showHover2': showHover3,
|
|
11528
11583
|
'Editor.showSourceActions': showSourceActions,
|