@lvce-editor/editor-worker 18.10.0 → 18.12.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 +303 -199
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -3955,6 +3955,7 @@ const createEditor = async ({
|
|
|
3955
3955
|
savedSelections,
|
|
3956
3956
|
tabSize,
|
|
3957
3957
|
uri,
|
|
3958
|
+
useFunctionalRendering,
|
|
3958
3959
|
width,
|
|
3959
3960
|
x,
|
|
3960
3961
|
y
|
|
@@ -4022,6 +4023,7 @@ const createEditor = async ({
|
|
|
4022
4023
|
uid: id,
|
|
4023
4024
|
undoStack: [],
|
|
4024
4025
|
uri,
|
|
4026
|
+
useFunctionalRendering,
|
|
4025
4027
|
validLines: [],
|
|
4026
4028
|
widgets: [],
|
|
4027
4029
|
width,
|
|
@@ -6335,6 +6337,194 @@ const handlePointerCaptureLost = editor => {
|
|
|
6335
6337
|
return editor;
|
|
6336
6338
|
};
|
|
6337
6339
|
|
|
6340
|
+
const moveRectangleSelection = (editor, position) => {
|
|
6341
|
+
// @ts-ignore
|
|
6342
|
+
// const anchor = EditorMoveSelection.state.position
|
|
6343
|
+
// const startRowIndex = anchor.rowIndex
|
|
6344
|
+
// const startColumnIndex = anchor.columnIndex
|
|
6345
|
+
// const endRowIndex = position.rowIndex
|
|
6346
|
+
// const endColumnIndex = position.columnIndex
|
|
6347
|
+
// const selectionEdits: any[] = []
|
|
6348
|
+
// for (let i = startRowIndex; i <= endRowIndex; i++) {
|
|
6349
|
+
// selectionEdits.push({
|
|
6350
|
+
// start: {
|
|
6351
|
+
// rowIndex: i,
|
|
6352
|
+
// columnIndex: startColumnIndex,
|
|
6353
|
+
// },
|
|
6354
|
+
// end: {
|
|
6355
|
+
// rowIndex: i,
|
|
6356
|
+
// columnIndex: endColumnIndex,
|
|
6357
|
+
// },
|
|
6358
|
+
// })
|
|
6359
|
+
// }
|
|
6360
|
+
// // @ts-ignore
|
|
6361
|
+
// const cursorEdits = [selectionEdits.at(-1).end]
|
|
6362
|
+
// // @ts-ignore
|
|
6363
|
+
// Editor.scheduleCursorsAndSelections(editor, cursorEdits, selectionEdits)
|
|
6364
|
+
return editor;
|
|
6365
|
+
};
|
|
6366
|
+
|
|
6367
|
+
// @ts-ignore
|
|
6368
|
+
const moveRectangleSelectionPx = async (editor, x, y) => {
|
|
6369
|
+
await at(editor, x, y);
|
|
6370
|
+
};
|
|
6371
|
+
|
|
6372
|
+
const requestAnimationFrame = fn => {
|
|
6373
|
+
globalThis.requestAnimationFrame(fn);
|
|
6374
|
+
};
|
|
6375
|
+
|
|
6376
|
+
const LessThan = -1;
|
|
6377
|
+
const Equal = 0;
|
|
6378
|
+
const GreaterThan = 1;
|
|
6379
|
+
|
|
6380
|
+
// @ts-ignore
|
|
6381
|
+
|
|
6382
|
+
// @ts-ignore
|
|
6383
|
+
const compare = (positionA, positionB) => {
|
|
6384
|
+
if (positionA.rowIndex > positionB.rowIndex) {
|
|
6385
|
+
return GreaterThan;
|
|
6386
|
+
}
|
|
6387
|
+
if (positionA.rowIndex === positionB.rowIndex) {
|
|
6388
|
+
if (positionA.columnIndex > positionB.columnIndex) {
|
|
6389
|
+
return GreaterThan;
|
|
6390
|
+
}
|
|
6391
|
+
if (positionA.columnIndex < positionB.columnIndex) {
|
|
6392
|
+
return LessThan;
|
|
6393
|
+
}
|
|
6394
|
+
return Equal;
|
|
6395
|
+
}
|
|
6396
|
+
return LessThan;
|
|
6397
|
+
};
|
|
6398
|
+
|
|
6399
|
+
// @ts-ignore
|
|
6400
|
+
const editorMoveSelectionBackwards = (anchor, position) => {
|
|
6401
|
+
return new Uint32Array([anchor.rowIndex, anchor.columnIndex, position.rowIndex, position.columnIndex]);
|
|
6402
|
+
};
|
|
6403
|
+
|
|
6404
|
+
// @ts-ignore
|
|
6405
|
+
const editorMoveSelectionEqual = (anchor, position) => {
|
|
6406
|
+
return new Uint32Array([position.rowIndex, position.columnIndex, position.rowIndex, position.columnIndex]);
|
|
6407
|
+
};
|
|
6408
|
+
|
|
6409
|
+
// @ts-ignore
|
|
6410
|
+
const editorMoveSelectionForwards = (anchor, position) => {
|
|
6411
|
+
return new Uint32Array([anchor.rowIndex, anchor.columnIndex, position.rowIndex, position.columnIndex]);
|
|
6412
|
+
};
|
|
6413
|
+
|
|
6414
|
+
// @ts-ignore
|
|
6415
|
+
const getNewSelections$5 = (anchor, position) => {
|
|
6416
|
+
switch (compare(position, anchor)) {
|
|
6417
|
+
case Equal:
|
|
6418
|
+
return editorMoveSelectionEqual(anchor, position);
|
|
6419
|
+
case GreaterThan:
|
|
6420
|
+
return editorMoveSelectionForwards(anchor, position);
|
|
6421
|
+
case LessThan:
|
|
6422
|
+
return editorMoveSelectionBackwards(anchor, position);
|
|
6423
|
+
default:
|
|
6424
|
+
throw new Error('unexpected comparison result');
|
|
6425
|
+
}
|
|
6426
|
+
};
|
|
6427
|
+
|
|
6428
|
+
// @ts-ignore
|
|
6429
|
+
const editorMoveSelection = (editor, position) => {
|
|
6430
|
+
const anchor = getPosition$1();
|
|
6431
|
+
const newSelections = getNewSelections$5(anchor, position);
|
|
6432
|
+
// TODO if selection equals previous selection -> do nothing
|
|
6433
|
+
return scheduleSelections(editor, newSelections);
|
|
6434
|
+
};
|
|
6435
|
+
|
|
6436
|
+
// @ts-ignore
|
|
6437
|
+
const getNewEditor$1 = (editor, position) => {
|
|
6438
|
+
const {
|
|
6439
|
+
maxLineY,
|
|
6440
|
+
minLineY,
|
|
6441
|
+
rowHeight
|
|
6442
|
+
} = editor;
|
|
6443
|
+
const diff = maxLineY - minLineY;
|
|
6444
|
+
if (position.rowIndex < minLineY) {
|
|
6445
|
+
const newMinLineY = position.rowIndex;
|
|
6446
|
+
const newMaxLineY = position.rowIndex + diff;
|
|
6447
|
+
const newDeltaY = position.rowIndex * rowHeight;
|
|
6448
|
+
const anchor = getPosition$1();
|
|
6449
|
+
const newSelections = new Uint32Array([position.rowIndex - 1, position.columnIndex, anchor.rowIndex, anchor.columnIndex]);
|
|
6450
|
+
return {
|
|
6451
|
+
...editor,
|
|
6452
|
+
deltaY: newDeltaY,
|
|
6453
|
+
maxLineY: newMaxLineY,
|
|
6454
|
+
minLineY: newMinLineY,
|
|
6455
|
+
selections: newSelections
|
|
6456
|
+
};
|
|
6457
|
+
}
|
|
6458
|
+
if (position.rowIndex > maxLineY) {
|
|
6459
|
+
const diff = maxLineY - minLineY;
|
|
6460
|
+
const newMinLineY = position.rowIndex - diff;
|
|
6461
|
+
const newMaxLineY = position.rowIndex;
|
|
6462
|
+
const newDeltaY = newMinLineY * rowHeight;
|
|
6463
|
+
const anchor = getPosition$1();
|
|
6464
|
+
const newSelections = new Uint32Array([anchor.rowIndex, anchor.columnIndex, position.rowIndex + 1, position.columnIndex]);
|
|
6465
|
+
return {
|
|
6466
|
+
...editor,
|
|
6467
|
+
deltaY: newDeltaY,
|
|
6468
|
+
maxLineY: newMaxLineY,
|
|
6469
|
+
minLineY: newMinLineY,
|
|
6470
|
+
selections: newSelections
|
|
6471
|
+
};
|
|
6472
|
+
}
|
|
6473
|
+
return editor;
|
|
6474
|
+
};
|
|
6475
|
+
const continueScrollingAndMovingSelection = async () => {
|
|
6476
|
+
const editor = getEditor$1();
|
|
6477
|
+
if (!editor) {
|
|
6478
|
+
return;
|
|
6479
|
+
}
|
|
6480
|
+
const position = getPosition();
|
|
6481
|
+
if (position.rowIndex === 0) {
|
|
6482
|
+
return;
|
|
6483
|
+
}
|
|
6484
|
+
const newEditor = getNewEditor$1(editor, position);
|
|
6485
|
+
if (editor === newEditor) {
|
|
6486
|
+
return;
|
|
6487
|
+
}
|
|
6488
|
+
// await Viewlet.setState(ViewletModuleId.EditorText, newEditor)
|
|
6489
|
+
setEditor(newEditor);
|
|
6490
|
+
// @ts-ignore
|
|
6491
|
+
const delta = position.rowIndex < editor.minLineY ? -1 : 1;
|
|
6492
|
+
setPosition({
|
|
6493
|
+
columnIndex: position.columnIndex,
|
|
6494
|
+
rowIndex: position.rowIndex + delta
|
|
6495
|
+
});
|
|
6496
|
+
requestAnimationFrame(continueScrollingAndMovingSelection);
|
|
6497
|
+
// TODO get editor state
|
|
6498
|
+
// if editor is disposed, return and remove animation frame
|
|
6499
|
+
// on cursor up, remove animation frame
|
|
6500
|
+
//
|
|
6501
|
+
};
|
|
6502
|
+
|
|
6503
|
+
// @ts-ignore
|
|
6504
|
+
const moveSelectionPx = async (editor, x, y) => {
|
|
6505
|
+
object(editor);
|
|
6506
|
+
number(x);
|
|
6507
|
+
number(y);
|
|
6508
|
+
const position = await at(editor, x, y);
|
|
6509
|
+
if (!hasListener() && (position.rowIndex < editor.minLineY || position.rowIndex > editor.maxLineY)) {
|
|
6510
|
+
requestAnimationFrame(continueScrollingAndMovingSelection);
|
|
6511
|
+
setEditor(editor);
|
|
6512
|
+
setPosition(position);
|
|
6513
|
+
}
|
|
6514
|
+
return editorMoveSelection(editor, position);
|
|
6515
|
+
};
|
|
6516
|
+
|
|
6517
|
+
const handlePointerMove = (editor, x, y, altKey) => {
|
|
6518
|
+
if (altKey) {
|
|
6519
|
+
return moveRectangleSelectionPx(editor, x, y);
|
|
6520
|
+
}
|
|
6521
|
+
return moveSelectionPx(editor, x, y);
|
|
6522
|
+
};
|
|
6523
|
+
|
|
6524
|
+
const handlePointerUp = editor => {
|
|
6525
|
+
return editor;
|
|
6526
|
+
};
|
|
6527
|
+
|
|
6338
6528
|
// @ts-ignore
|
|
6339
6529
|
|
|
6340
6530
|
// @ts-ignore
|
|
@@ -6736,183 +6926,6 @@ const insertLineBreak = async editor => {
|
|
|
6736
6926
|
return scheduleDocumentAndCursorsSelections(editor, changes, selectionChanges);
|
|
6737
6927
|
};
|
|
6738
6928
|
|
|
6739
|
-
const moveRectangleSelection = (editor, position) => {
|
|
6740
|
-
// @ts-ignore
|
|
6741
|
-
// const anchor = EditorMoveSelection.state.position
|
|
6742
|
-
// const startRowIndex = anchor.rowIndex
|
|
6743
|
-
// const startColumnIndex = anchor.columnIndex
|
|
6744
|
-
// const endRowIndex = position.rowIndex
|
|
6745
|
-
// const endColumnIndex = position.columnIndex
|
|
6746
|
-
// const selectionEdits: any[] = []
|
|
6747
|
-
// for (let i = startRowIndex; i <= endRowIndex; i++) {
|
|
6748
|
-
// selectionEdits.push({
|
|
6749
|
-
// start: {
|
|
6750
|
-
// rowIndex: i,
|
|
6751
|
-
// columnIndex: startColumnIndex,
|
|
6752
|
-
// },
|
|
6753
|
-
// end: {
|
|
6754
|
-
// rowIndex: i,
|
|
6755
|
-
// columnIndex: endColumnIndex,
|
|
6756
|
-
// },
|
|
6757
|
-
// })
|
|
6758
|
-
// }
|
|
6759
|
-
// // @ts-ignore
|
|
6760
|
-
// const cursorEdits = [selectionEdits.at(-1).end]
|
|
6761
|
-
// // @ts-ignore
|
|
6762
|
-
// Editor.scheduleCursorsAndSelections(editor, cursorEdits, selectionEdits)
|
|
6763
|
-
return editor;
|
|
6764
|
-
};
|
|
6765
|
-
|
|
6766
|
-
// @ts-ignore
|
|
6767
|
-
const moveRectangleSelectionPx = async (editor, x, y) => {
|
|
6768
|
-
await at(editor, x, y);
|
|
6769
|
-
};
|
|
6770
|
-
|
|
6771
|
-
const LessThan = -1;
|
|
6772
|
-
const Equal = 0;
|
|
6773
|
-
const GreaterThan = 1;
|
|
6774
|
-
|
|
6775
|
-
// @ts-ignore
|
|
6776
|
-
|
|
6777
|
-
// @ts-ignore
|
|
6778
|
-
const compare = (positionA, positionB) => {
|
|
6779
|
-
if (positionA.rowIndex > positionB.rowIndex) {
|
|
6780
|
-
return GreaterThan;
|
|
6781
|
-
}
|
|
6782
|
-
if (positionA.rowIndex === positionB.rowIndex) {
|
|
6783
|
-
if (positionA.columnIndex > positionB.columnIndex) {
|
|
6784
|
-
return GreaterThan;
|
|
6785
|
-
}
|
|
6786
|
-
if (positionA.columnIndex < positionB.columnIndex) {
|
|
6787
|
-
return LessThan;
|
|
6788
|
-
}
|
|
6789
|
-
return Equal;
|
|
6790
|
-
}
|
|
6791
|
-
return LessThan;
|
|
6792
|
-
};
|
|
6793
|
-
|
|
6794
|
-
// @ts-ignore
|
|
6795
|
-
const editorMoveSelectionBackwards = (anchor, position) => {
|
|
6796
|
-
return new Uint32Array([anchor.rowIndex, anchor.columnIndex, position.rowIndex, position.columnIndex]);
|
|
6797
|
-
};
|
|
6798
|
-
|
|
6799
|
-
// @ts-ignore
|
|
6800
|
-
const editorMoveSelectionEqual = (anchor, position) => {
|
|
6801
|
-
return new Uint32Array([position.rowIndex, position.columnIndex, position.rowIndex, position.columnIndex]);
|
|
6802
|
-
};
|
|
6803
|
-
|
|
6804
|
-
// @ts-ignore
|
|
6805
|
-
const editorMoveSelectionForwards = (anchor, position) => {
|
|
6806
|
-
return new Uint32Array([anchor.rowIndex, anchor.columnIndex, position.rowIndex, position.columnIndex]);
|
|
6807
|
-
};
|
|
6808
|
-
|
|
6809
|
-
// @ts-ignore
|
|
6810
|
-
const getNewSelections$5 = (anchor, position) => {
|
|
6811
|
-
switch (compare(position, anchor)) {
|
|
6812
|
-
case Equal:
|
|
6813
|
-
return editorMoveSelectionEqual(anchor, position);
|
|
6814
|
-
case GreaterThan:
|
|
6815
|
-
return editorMoveSelectionForwards(anchor, position);
|
|
6816
|
-
case LessThan:
|
|
6817
|
-
return editorMoveSelectionBackwards(anchor, position);
|
|
6818
|
-
default:
|
|
6819
|
-
throw new Error('unexpected comparison result');
|
|
6820
|
-
}
|
|
6821
|
-
};
|
|
6822
|
-
|
|
6823
|
-
// @ts-ignore
|
|
6824
|
-
const editorMoveSelection = (editor, position) => {
|
|
6825
|
-
const anchor = getPosition$1();
|
|
6826
|
-
const newSelections = getNewSelections$5(anchor, position);
|
|
6827
|
-
// TODO if selection equals previous selection -> do nothing
|
|
6828
|
-
return scheduleSelections(editor, newSelections);
|
|
6829
|
-
};
|
|
6830
|
-
|
|
6831
|
-
const requestAnimationFrame = fn => {
|
|
6832
|
-
globalThis.requestAnimationFrame(fn);
|
|
6833
|
-
};
|
|
6834
|
-
|
|
6835
|
-
// @ts-ignore
|
|
6836
|
-
const getNewEditor$1 = (editor, position) => {
|
|
6837
|
-
const {
|
|
6838
|
-
maxLineY,
|
|
6839
|
-
minLineY,
|
|
6840
|
-
rowHeight
|
|
6841
|
-
} = editor;
|
|
6842
|
-
const diff = maxLineY - minLineY;
|
|
6843
|
-
if (position.rowIndex < minLineY) {
|
|
6844
|
-
const newMinLineY = position.rowIndex;
|
|
6845
|
-
const newMaxLineY = position.rowIndex + diff;
|
|
6846
|
-
const newDeltaY = position.rowIndex * rowHeight;
|
|
6847
|
-
const anchor = getPosition$1();
|
|
6848
|
-
const newSelections = new Uint32Array([position.rowIndex - 1, position.columnIndex, anchor.rowIndex, anchor.columnIndex]);
|
|
6849
|
-
return {
|
|
6850
|
-
...editor,
|
|
6851
|
-
deltaY: newDeltaY,
|
|
6852
|
-
maxLineY: newMaxLineY,
|
|
6853
|
-
minLineY: newMinLineY,
|
|
6854
|
-
selections: newSelections
|
|
6855
|
-
};
|
|
6856
|
-
}
|
|
6857
|
-
if (position.rowIndex > maxLineY) {
|
|
6858
|
-
const diff = maxLineY - minLineY;
|
|
6859
|
-
const newMinLineY = position.rowIndex - diff;
|
|
6860
|
-
const newMaxLineY = position.rowIndex;
|
|
6861
|
-
const newDeltaY = newMinLineY * rowHeight;
|
|
6862
|
-
const anchor = getPosition$1();
|
|
6863
|
-
const newSelections = new Uint32Array([anchor.rowIndex, anchor.columnIndex, position.rowIndex + 1, position.columnIndex]);
|
|
6864
|
-
return {
|
|
6865
|
-
...editor,
|
|
6866
|
-
deltaY: newDeltaY,
|
|
6867
|
-
maxLineY: newMaxLineY,
|
|
6868
|
-
minLineY: newMinLineY,
|
|
6869
|
-
selections: newSelections
|
|
6870
|
-
};
|
|
6871
|
-
}
|
|
6872
|
-
return editor;
|
|
6873
|
-
};
|
|
6874
|
-
const continueScrollingAndMovingSelection = async () => {
|
|
6875
|
-
const editor = getEditor$1();
|
|
6876
|
-
if (!editor) {
|
|
6877
|
-
return;
|
|
6878
|
-
}
|
|
6879
|
-
const position = getPosition();
|
|
6880
|
-
if (position.rowIndex === 0) {
|
|
6881
|
-
return;
|
|
6882
|
-
}
|
|
6883
|
-
const newEditor = getNewEditor$1(editor, position);
|
|
6884
|
-
if (editor === newEditor) {
|
|
6885
|
-
return;
|
|
6886
|
-
}
|
|
6887
|
-
// await Viewlet.setState(ViewletModuleId.EditorText, newEditor)
|
|
6888
|
-
setEditor(newEditor);
|
|
6889
|
-
// @ts-ignore
|
|
6890
|
-
const delta = position.rowIndex < editor.minLineY ? -1 : 1;
|
|
6891
|
-
setPosition({
|
|
6892
|
-
columnIndex: position.columnIndex,
|
|
6893
|
-
rowIndex: position.rowIndex + delta
|
|
6894
|
-
});
|
|
6895
|
-
requestAnimationFrame(continueScrollingAndMovingSelection);
|
|
6896
|
-
// TODO get editor state
|
|
6897
|
-
// if editor is disposed, return and remove animation frame
|
|
6898
|
-
// on cursor up, remove animation frame
|
|
6899
|
-
//
|
|
6900
|
-
};
|
|
6901
|
-
|
|
6902
|
-
// @ts-ignore
|
|
6903
|
-
const moveSelectionPx = async (editor, x, y) => {
|
|
6904
|
-
object(editor);
|
|
6905
|
-
number(x);
|
|
6906
|
-
number(y);
|
|
6907
|
-
const position = await at(editor, x, y);
|
|
6908
|
-
if (!hasListener() && (position.rowIndex < editor.minLineY || position.rowIndex > editor.maxLineY)) {
|
|
6909
|
-
requestAnimationFrame(continueScrollingAndMovingSelection);
|
|
6910
|
-
setEditor(editor);
|
|
6911
|
-
setPosition(position);
|
|
6912
|
-
}
|
|
6913
|
-
return editorMoveSelection(editor, position);
|
|
6914
|
-
};
|
|
6915
|
-
|
|
6916
6929
|
const Script = 2;
|
|
6917
6930
|
const Unknown$1 = 0;
|
|
6918
6931
|
|
|
@@ -9527,14 +9540,26 @@ const HandleCompositionUpdate = 'handleCompositionUpdate';
|
|
|
9527
9540
|
const HandleContextMenu = 'handleContextMenu';
|
|
9528
9541
|
const HandleCut = 'handleCut';
|
|
9529
9542
|
const HandleFocus = 'handleFocus';
|
|
9543
|
+
const HandleMouseDown = 'handleMouseDown';
|
|
9530
9544
|
const HandleMouseMove = 'handleMouseMove';
|
|
9545
|
+
const HandlePaste = 'handlePaste';
|
|
9546
|
+
const HandlePointerDown = 'handlePointerDown';
|
|
9547
|
+
const HandlePointerMove = 'handlePointerMove';
|
|
9548
|
+
const HandlePointerUp = 'handlePointerUp';
|
|
9531
9549
|
const HandleSashPointerDown = 'handleSashPointerDown';
|
|
9550
|
+
const HandleScrollBarHorizontalPointerDown = 'handleScrollBarHorizontalPointerDown';
|
|
9551
|
+
const HandleScrollBarHorizontalPointerMove = 'handleScrollBarHorizontalPointerMove';
|
|
9552
|
+
const HandleScrollBarHorizontalPointerUp = 'handleScrollBarHorizontalPointerUp';
|
|
9553
|
+
const HandleScrollBarVerticalPointerDown = 'handleScrollBarVerticalPointerDown';
|
|
9554
|
+
const HandleScrollBarVerticalPointerMove = 'handleScrollBarVerticalPointerMove';
|
|
9555
|
+
const HandleScrollBarVerticalPointerUp = 'handleScrollBarVerticalPointerUp';
|
|
9532
9556
|
const HandleWheel = 'handleWheel';
|
|
9533
9557
|
|
|
9534
9558
|
const Div = 4;
|
|
9535
9559
|
const Input = 6;
|
|
9536
9560
|
const Span = 8;
|
|
9537
9561
|
const Text = 12;
|
|
9562
|
+
const TextArea = 62;
|
|
9538
9563
|
|
|
9539
9564
|
const text = data => {
|
|
9540
9565
|
return {
|
|
@@ -11410,6 +11435,29 @@ const getEditorRowsVirtualDom = (textInfos, differences, lineNumbers = true, hig
|
|
|
11410
11435
|
return dom;
|
|
11411
11436
|
};
|
|
11412
11437
|
|
|
11438
|
+
const getScrollBarVirtualDom = () => {
|
|
11439
|
+
return [{
|
|
11440
|
+
childCount: 1,
|
|
11441
|
+
className: 'ScrollBar ScrollBarVertical',
|
|
11442
|
+
onContextMenu: HandleContextMenu,
|
|
11443
|
+
onPointerDown: HandleScrollBarVerticalPointerDown,
|
|
11444
|
+
type: Div
|
|
11445
|
+
}, {
|
|
11446
|
+
childCount: 0,
|
|
11447
|
+
className: 'ScrollBarThumb ScrollBarThumbVertical',
|
|
11448
|
+
type: Div
|
|
11449
|
+
}, {
|
|
11450
|
+
childCount: 1,
|
|
11451
|
+
className: 'ScrollBar ScrollBarHorizontal',
|
|
11452
|
+
onPointerDown: HandleScrollBarHorizontalPointerDown,
|
|
11453
|
+
type: Div
|
|
11454
|
+
}, {
|
|
11455
|
+
childCount: 0,
|
|
11456
|
+
className: 'ScrollBarThumb ScrollBarThumbHorizontal',
|
|
11457
|
+
type: Div
|
|
11458
|
+
}];
|
|
11459
|
+
};
|
|
11460
|
+
|
|
11413
11461
|
const getSelectionsVirtualDom = selections => {
|
|
11414
11462
|
const dom = [];
|
|
11415
11463
|
for (let i = 0; i < selections.length; i += 4) {
|
|
@@ -11450,9 +11498,12 @@ const getEditorVirtualDom = ({
|
|
|
11450
11498
|
const diagnosticsDom = getDiagnosticsVirtualDom(diagnosticsArray);
|
|
11451
11499
|
const gutterDom = getEditorGutterVirtualDom(gutterInfosArray);
|
|
11452
11500
|
const scrollBarDiagnosticsDom = getDiagnosticsVirtualDom(scrollBarDiagnosticsArray);
|
|
11501
|
+
const scrollBarDom = getScrollBarVirtualDom();
|
|
11453
11502
|
return [{
|
|
11454
11503
|
childCount: 2,
|
|
11455
11504
|
className: 'Viewlet Editor',
|
|
11505
|
+
onContextMenu: HandleContextMenu,
|
|
11506
|
+
onWheel: HandleWheel,
|
|
11456
11507
|
role: 'code',
|
|
11457
11508
|
type: Div
|
|
11458
11509
|
}, {
|
|
@@ -11460,9 +11511,32 @@ const getEditorVirtualDom = ({
|
|
|
11460
11511
|
className: 'Gutter',
|
|
11461
11512
|
type: Div
|
|
11462
11513
|
}, ...gutterDom, {
|
|
11463
|
-
childCount:
|
|
11514
|
+
childCount: 5,
|
|
11464
11515
|
className: 'EditorContent',
|
|
11516
|
+
onMouseMove: HandleMouseMove,
|
|
11465
11517
|
type: Div
|
|
11518
|
+
}, {
|
|
11519
|
+
ariaAutoComplete: 'list',
|
|
11520
|
+
ariaMultiLine: 'true',
|
|
11521
|
+
ariaRoleDescription: 'editor',
|
|
11522
|
+
autocapitalize: 'off',
|
|
11523
|
+
autocomplete: 'off',
|
|
11524
|
+
autocorrect: 'off',
|
|
11525
|
+
childCount: 0,
|
|
11526
|
+
className: 'EditorInput',
|
|
11527
|
+
name: 'editor',
|
|
11528
|
+
onBeforeInput: HandleBeforeInput,
|
|
11529
|
+
onBlur: HandleBlur,
|
|
11530
|
+
onCompositionEnd: HandleCompositionEnd,
|
|
11531
|
+
onCompositionStart: HandleCompositionStart,
|
|
11532
|
+
onCompositionUpdate: HandleCompositionUpdate,
|
|
11533
|
+
onCut: HandleCut,
|
|
11534
|
+
onFocus: HandleFocus,
|
|
11535
|
+
onPaste: HandlePaste,
|
|
11536
|
+
role: 'textbox',
|
|
11537
|
+
spellcheck: false,
|
|
11538
|
+
type: TextArea,
|
|
11539
|
+
wrap: 'off'
|
|
11466
11540
|
}, {
|
|
11467
11541
|
childCount: 4,
|
|
11468
11542
|
className: 'EditorLayers',
|
|
@@ -11474,6 +11548,8 @@ const getEditorVirtualDom = ({
|
|
|
11474
11548
|
}, ...selectionsDom, {
|
|
11475
11549
|
childCount: textInfos.length,
|
|
11476
11550
|
className: 'EditorRows',
|
|
11551
|
+
onMouseDown: HandleMouseDown,
|
|
11552
|
+
onPointerDown: HandlePointerDown,
|
|
11477
11553
|
type: Div
|
|
11478
11554
|
}, ...rowsDom, {
|
|
11479
11555
|
childCount: cursorsDom.length,
|
|
@@ -11487,27 +11563,15 @@ const getEditorVirtualDom = ({
|
|
|
11487
11563
|
childCount: scrollBarDiagnosticsDom.length,
|
|
11488
11564
|
className: 'EditorScrollBarDiagnostics',
|
|
11489
11565
|
type: Div
|
|
11490
|
-
}, ...scrollBarDiagnosticsDom,
|
|
11491
|
-
childCount: 1,
|
|
11492
|
-
className: 'ScrollBar ScrollBarVertical',
|
|
11493
|
-
type: Div
|
|
11494
|
-
}, {
|
|
11495
|
-
childCount: 0,
|
|
11496
|
-
className: 'ScrollBarThumb ScrollBarThumbVertical',
|
|
11497
|
-
type: Div
|
|
11498
|
-
}, {
|
|
11499
|
-
childCount: 1,
|
|
11500
|
-
className: 'ScrollBar ScrollBarHorizontal',
|
|
11501
|
-
type: Div
|
|
11502
|
-
}, {
|
|
11503
|
-
childCount: 0,
|
|
11504
|
-
className: 'ScrollBarThumb ScrollBarThumbHorizontal',
|
|
11505
|
-
type: Div
|
|
11506
|
-
}];
|
|
11566
|
+
}, ...scrollBarDiagnosticsDom, ...scrollBarDom];
|
|
11507
11567
|
};
|
|
11508
11568
|
|
|
11509
11569
|
const getDom = state => {
|
|
11510
|
-
|
|
11570
|
+
const {
|
|
11571
|
+
initial,
|
|
11572
|
+
textInfos
|
|
11573
|
+
} = state;
|
|
11574
|
+
if (initial && textInfos.length === 0) {
|
|
11511
11575
|
return [];
|
|
11512
11576
|
}
|
|
11513
11577
|
return getEditorVirtualDom(state);
|
|
@@ -11783,13 +11847,14 @@ const renderEventListeners = () => {
|
|
|
11783
11847
|
params: ['handleFocus']
|
|
11784
11848
|
}, {
|
|
11785
11849
|
name: HandleMouseMove,
|
|
11786
|
-
params: ['
|
|
11850
|
+
params: ['handleMouseMove', ClientX, ClientY, AltKey]
|
|
11787
11851
|
}, {
|
|
11788
11852
|
name: HandleBlur,
|
|
11789
11853
|
params: ['handleBlur']
|
|
11790
11854
|
}, {
|
|
11791
11855
|
name: HandleBeforeInput,
|
|
11792
|
-
params: ['handleBeforeInput', 'event.inputType', 'event.data']
|
|
11856
|
+
params: ['handleBeforeInput', 'event.inputType', 'event.data'],
|
|
11857
|
+
preventDefault: true
|
|
11793
11858
|
}, {
|
|
11794
11859
|
name: HandleCompositionStart,
|
|
11795
11860
|
params: ['compositionStart', 'event.data']
|
|
@@ -11798,11 +11863,28 @@ const renderEventListeners = () => {
|
|
|
11798
11863
|
params: ['compositionUpdate', 'event.data']
|
|
11799
11864
|
}, {
|
|
11800
11865
|
name: HandleCompositionEnd,
|
|
11801
|
-
params: ['
|
|
11866
|
+
params: ['compositionEnd', 'event.data']
|
|
11802
11867
|
}, {
|
|
11803
11868
|
name: HandleCut,
|
|
11804
11869
|
params: ['cut'],
|
|
11805
11870
|
preventDefault: true
|
|
11871
|
+
}, {
|
|
11872
|
+
name: HandlePaste,
|
|
11873
|
+
params: ['paste', 'event.clipboardData ? event.clipboardData.getData("text/plain") : ""'],
|
|
11874
|
+
preventDefault: true
|
|
11875
|
+
}, {
|
|
11876
|
+
name: HandleMouseDown,
|
|
11877
|
+
params: ['handleMouseDown', 'event.button === 2 ? -1 : (((event.metaKey || event.ctrlKey) ? 2048 : 0) | (event.shiftKey ? 1024 : 0) | (event.altKey ? 512 : 0))', ClientX, ClientY, 'event.button === 2 ? 0 : event.detail']
|
|
11878
|
+
}, {
|
|
11879
|
+
name: HandlePointerDown,
|
|
11880
|
+
params: [],
|
|
11881
|
+
trackPointerEvents: [HandlePointerMove, HandlePointerUp]
|
|
11882
|
+
}, {
|
|
11883
|
+
name: HandlePointerMove,
|
|
11884
|
+
params: ['handlePointerMove', ClientX, ClientY, AltKey]
|
|
11885
|
+
}, {
|
|
11886
|
+
name: HandlePointerUp,
|
|
11887
|
+
params: ['handlePointerUp']
|
|
11806
11888
|
}, {
|
|
11807
11889
|
name: HandleWheel,
|
|
11808
11890
|
params: ['setDelta', DeltaMode, DeltaY],
|
|
@@ -11811,6 +11893,26 @@ const renderEventListeners = () => {
|
|
|
11811
11893
|
name: HandleContextMenu,
|
|
11812
11894
|
params: ['handleContextMenu', Button, ClientX, ClientY],
|
|
11813
11895
|
preventDefault: true
|
|
11896
|
+
}, {
|
|
11897
|
+
name: HandleScrollBarVerticalPointerDown,
|
|
11898
|
+
params: ['handleScrollBarVerticalPointerDown', ClientY],
|
|
11899
|
+
trackPointerEvents: [HandleScrollBarVerticalPointerMove, HandleScrollBarVerticalPointerUp]
|
|
11900
|
+
}, {
|
|
11901
|
+
name: HandleScrollBarVerticalPointerMove,
|
|
11902
|
+
params: ['handleScrollBarVerticalPointerMove', ClientY]
|
|
11903
|
+
}, {
|
|
11904
|
+
name: HandleScrollBarVerticalPointerUp,
|
|
11905
|
+
params: ['handlePointerUp']
|
|
11906
|
+
}, {
|
|
11907
|
+
name: HandleScrollBarHorizontalPointerDown,
|
|
11908
|
+
params: ['handleScrollBarHorizontalPointerDown', ClientX],
|
|
11909
|
+
trackPointerEvents: [HandleScrollBarHorizontalPointerMove, HandleScrollBarHorizontalPointerUp]
|
|
11910
|
+
}, {
|
|
11911
|
+
name: HandleScrollBarHorizontalPointerMove,
|
|
11912
|
+
params: ['handleScrollBarHorizontalMove', ClientX]
|
|
11913
|
+
}, {
|
|
11914
|
+
name: HandleScrollBarHorizontalPointerUp,
|
|
11915
|
+
params: ['handlePointerUp']
|
|
11814
11916
|
}];
|
|
11815
11917
|
};
|
|
11816
11918
|
|
|
@@ -11967,6 +12069,8 @@ const commandMap = {
|
|
|
11967
12069
|
'Editor.handleMouseMoveWithAltKey': wrapCommandOld(handleMouseMoveWithAltKey),
|
|
11968
12070
|
'Editor.handleNativeSelectionChange': editorHandleNativeSelectionChange,
|
|
11969
12071
|
'Editor.handlePointerCaptureLost': wrapCommandOld(handlePointerCaptureLost),
|
|
12072
|
+
'Editor.handlePointerMove': wrapCommandOld(handlePointerMove),
|
|
12073
|
+
'Editor.handlePointerUp': wrapCommandOld(handlePointerUp),
|
|
11970
12074
|
'Editor.handleScrollBarClick': handleScrollBarPointerDown,
|
|
11971
12075
|
'Editor.handleScrollBarHorizontalMove': wrapCommandOld(handleScrollBarHorizontalMove),
|
|
11972
12076
|
'Editor.handleScrollBarHorizontalPointerDown': wrapCommandOld(handleScrollBarHorizontalPointerDown),
|