@lvce-editor/editor-worker 18.11.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 +301 -199
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -6337,6 +6337,194 @@ const handlePointerCaptureLost = editor => {
|
|
|
6337
6337
|
return editor;
|
|
6338
6338
|
};
|
|
6339
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
|
+
|
|
6340
6528
|
// @ts-ignore
|
|
6341
6529
|
|
|
6342
6530
|
// @ts-ignore
|
|
@@ -6738,183 +6926,6 @@ const insertLineBreak = async editor => {
|
|
|
6738
6926
|
return scheduleDocumentAndCursorsSelections(editor, changes, selectionChanges);
|
|
6739
6927
|
};
|
|
6740
6928
|
|
|
6741
|
-
const moveRectangleSelection = (editor, position) => {
|
|
6742
|
-
// @ts-ignore
|
|
6743
|
-
// const anchor = EditorMoveSelection.state.position
|
|
6744
|
-
// const startRowIndex = anchor.rowIndex
|
|
6745
|
-
// const startColumnIndex = anchor.columnIndex
|
|
6746
|
-
// const endRowIndex = position.rowIndex
|
|
6747
|
-
// const endColumnIndex = position.columnIndex
|
|
6748
|
-
// const selectionEdits: any[] = []
|
|
6749
|
-
// for (let i = startRowIndex; i <= endRowIndex; i++) {
|
|
6750
|
-
// selectionEdits.push({
|
|
6751
|
-
// start: {
|
|
6752
|
-
// rowIndex: i,
|
|
6753
|
-
// columnIndex: startColumnIndex,
|
|
6754
|
-
// },
|
|
6755
|
-
// end: {
|
|
6756
|
-
// rowIndex: i,
|
|
6757
|
-
// columnIndex: endColumnIndex,
|
|
6758
|
-
// },
|
|
6759
|
-
// })
|
|
6760
|
-
// }
|
|
6761
|
-
// // @ts-ignore
|
|
6762
|
-
// const cursorEdits = [selectionEdits.at(-1).end]
|
|
6763
|
-
// // @ts-ignore
|
|
6764
|
-
// Editor.scheduleCursorsAndSelections(editor, cursorEdits, selectionEdits)
|
|
6765
|
-
return editor;
|
|
6766
|
-
};
|
|
6767
|
-
|
|
6768
|
-
// @ts-ignore
|
|
6769
|
-
const moveRectangleSelectionPx = async (editor, x, y) => {
|
|
6770
|
-
await at(editor, x, y);
|
|
6771
|
-
};
|
|
6772
|
-
|
|
6773
|
-
const LessThan = -1;
|
|
6774
|
-
const Equal = 0;
|
|
6775
|
-
const GreaterThan = 1;
|
|
6776
|
-
|
|
6777
|
-
// @ts-ignore
|
|
6778
|
-
|
|
6779
|
-
// @ts-ignore
|
|
6780
|
-
const compare = (positionA, positionB) => {
|
|
6781
|
-
if (positionA.rowIndex > positionB.rowIndex) {
|
|
6782
|
-
return GreaterThan;
|
|
6783
|
-
}
|
|
6784
|
-
if (positionA.rowIndex === positionB.rowIndex) {
|
|
6785
|
-
if (positionA.columnIndex > positionB.columnIndex) {
|
|
6786
|
-
return GreaterThan;
|
|
6787
|
-
}
|
|
6788
|
-
if (positionA.columnIndex < positionB.columnIndex) {
|
|
6789
|
-
return LessThan;
|
|
6790
|
-
}
|
|
6791
|
-
return Equal;
|
|
6792
|
-
}
|
|
6793
|
-
return LessThan;
|
|
6794
|
-
};
|
|
6795
|
-
|
|
6796
|
-
// @ts-ignore
|
|
6797
|
-
const editorMoveSelectionBackwards = (anchor, position) => {
|
|
6798
|
-
return new Uint32Array([anchor.rowIndex, anchor.columnIndex, position.rowIndex, position.columnIndex]);
|
|
6799
|
-
};
|
|
6800
|
-
|
|
6801
|
-
// @ts-ignore
|
|
6802
|
-
const editorMoveSelectionEqual = (anchor, position) => {
|
|
6803
|
-
return new Uint32Array([position.rowIndex, position.columnIndex, position.rowIndex, position.columnIndex]);
|
|
6804
|
-
};
|
|
6805
|
-
|
|
6806
|
-
// @ts-ignore
|
|
6807
|
-
const editorMoveSelectionForwards = (anchor, position) => {
|
|
6808
|
-
return new Uint32Array([anchor.rowIndex, anchor.columnIndex, position.rowIndex, position.columnIndex]);
|
|
6809
|
-
};
|
|
6810
|
-
|
|
6811
|
-
// @ts-ignore
|
|
6812
|
-
const getNewSelections$5 = (anchor, position) => {
|
|
6813
|
-
switch (compare(position, anchor)) {
|
|
6814
|
-
case Equal:
|
|
6815
|
-
return editorMoveSelectionEqual(anchor, position);
|
|
6816
|
-
case GreaterThan:
|
|
6817
|
-
return editorMoveSelectionForwards(anchor, position);
|
|
6818
|
-
case LessThan:
|
|
6819
|
-
return editorMoveSelectionBackwards(anchor, position);
|
|
6820
|
-
default:
|
|
6821
|
-
throw new Error('unexpected comparison result');
|
|
6822
|
-
}
|
|
6823
|
-
};
|
|
6824
|
-
|
|
6825
|
-
// @ts-ignore
|
|
6826
|
-
const editorMoveSelection = (editor, position) => {
|
|
6827
|
-
const anchor = getPosition$1();
|
|
6828
|
-
const newSelections = getNewSelections$5(anchor, position);
|
|
6829
|
-
// TODO if selection equals previous selection -> do nothing
|
|
6830
|
-
return scheduleSelections(editor, newSelections);
|
|
6831
|
-
};
|
|
6832
|
-
|
|
6833
|
-
const requestAnimationFrame = fn => {
|
|
6834
|
-
globalThis.requestAnimationFrame(fn);
|
|
6835
|
-
};
|
|
6836
|
-
|
|
6837
|
-
// @ts-ignore
|
|
6838
|
-
const getNewEditor$1 = (editor, position) => {
|
|
6839
|
-
const {
|
|
6840
|
-
maxLineY,
|
|
6841
|
-
minLineY,
|
|
6842
|
-
rowHeight
|
|
6843
|
-
} = editor;
|
|
6844
|
-
const diff = maxLineY - minLineY;
|
|
6845
|
-
if (position.rowIndex < minLineY) {
|
|
6846
|
-
const newMinLineY = position.rowIndex;
|
|
6847
|
-
const newMaxLineY = position.rowIndex + diff;
|
|
6848
|
-
const newDeltaY = position.rowIndex * rowHeight;
|
|
6849
|
-
const anchor = getPosition$1();
|
|
6850
|
-
const newSelections = new Uint32Array([position.rowIndex - 1, position.columnIndex, anchor.rowIndex, anchor.columnIndex]);
|
|
6851
|
-
return {
|
|
6852
|
-
...editor,
|
|
6853
|
-
deltaY: newDeltaY,
|
|
6854
|
-
maxLineY: newMaxLineY,
|
|
6855
|
-
minLineY: newMinLineY,
|
|
6856
|
-
selections: newSelections
|
|
6857
|
-
};
|
|
6858
|
-
}
|
|
6859
|
-
if (position.rowIndex > maxLineY) {
|
|
6860
|
-
const diff = maxLineY - minLineY;
|
|
6861
|
-
const newMinLineY = position.rowIndex - diff;
|
|
6862
|
-
const newMaxLineY = position.rowIndex;
|
|
6863
|
-
const newDeltaY = newMinLineY * rowHeight;
|
|
6864
|
-
const anchor = getPosition$1();
|
|
6865
|
-
const newSelections = new Uint32Array([anchor.rowIndex, anchor.columnIndex, position.rowIndex + 1, position.columnIndex]);
|
|
6866
|
-
return {
|
|
6867
|
-
...editor,
|
|
6868
|
-
deltaY: newDeltaY,
|
|
6869
|
-
maxLineY: newMaxLineY,
|
|
6870
|
-
minLineY: newMinLineY,
|
|
6871
|
-
selections: newSelections
|
|
6872
|
-
};
|
|
6873
|
-
}
|
|
6874
|
-
return editor;
|
|
6875
|
-
};
|
|
6876
|
-
const continueScrollingAndMovingSelection = async () => {
|
|
6877
|
-
const editor = getEditor$1();
|
|
6878
|
-
if (!editor) {
|
|
6879
|
-
return;
|
|
6880
|
-
}
|
|
6881
|
-
const position = getPosition();
|
|
6882
|
-
if (position.rowIndex === 0) {
|
|
6883
|
-
return;
|
|
6884
|
-
}
|
|
6885
|
-
const newEditor = getNewEditor$1(editor, position);
|
|
6886
|
-
if (editor === newEditor) {
|
|
6887
|
-
return;
|
|
6888
|
-
}
|
|
6889
|
-
// await Viewlet.setState(ViewletModuleId.EditorText, newEditor)
|
|
6890
|
-
setEditor(newEditor);
|
|
6891
|
-
// @ts-ignore
|
|
6892
|
-
const delta = position.rowIndex < editor.minLineY ? -1 : 1;
|
|
6893
|
-
setPosition({
|
|
6894
|
-
columnIndex: position.columnIndex,
|
|
6895
|
-
rowIndex: position.rowIndex + delta
|
|
6896
|
-
});
|
|
6897
|
-
requestAnimationFrame(continueScrollingAndMovingSelection);
|
|
6898
|
-
// TODO get editor state
|
|
6899
|
-
// if editor is disposed, return and remove animation frame
|
|
6900
|
-
// on cursor up, remove animation frame
|
|
6901
|
-
//
|
|
6902
|
-
};
|
|
6903
|
-
|
|
6904
|
-
// @ts-ignore
|
|
6905
|
-
const moveSelectionPx = async (editor, x, y) => {
|
|
6906
|
-
object(editor);
|
|
6907
|
-
number(x);
|
|
6908
|
-
number(y);
|
|
6909
|
-
const position = await at(editor, x, y);
|
|
6910
|
-
if (!hasListener() && (position.rowIndex < editor.minLineY || position.rowIndex > editor.maxLineY)) {
|
|
6911
|
-
requestAnimationFrame(continueScrollingAndMovingSelection);
|
|
6912
|
-
setEditor(editor);
|
|
6913
|
-
setPosition(position);
|
|
6914
|
-
}
|
|
6915
|
-
return editorMoveSelection(editor, position);
|
|
6916
|
-
};
|
|
6917
|
-
|
|
6918
6929
|
const Script = 2;
|
|
6919
6930
|
const Unknown$1 = 0;
|
|
6920
6931
|
|
|
@@ -9529,14 +9540,26 @@ const HandleCompositionUpdate = 'handleCompositionUpdate';
|
|
|
9529
9540
|
const HandleContextMenu = 'handleContextMenu';
|
|
9530
9541
|
const HandleCut = 'handleCut';
|
|
9531
9542
|
const HandleFocus = 'handleFocus';
|
|
9543
|
+
const HandleMouseDown = 'handleMouseDown';
|
|
9532
9544
|
const HandleMouseMove = 'handleMouseMove';
|
|
9545
|
+
const HandlePaste = 'handlePaste';
|
|
9546
|
+
const HandlePointerDown = 'handlePointerDown';
|
|
9547
|
+
const HandlePointerMove = 'handlePointerMove';
|
|
9548
|
+
const HandlePointerUp = 'handlePointerUp';
|
|
9533
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';
|
|
9534
9556
|
const HandleWheel = 'handleWheel';
|
|
9535
9557
|
|
|
9536
9558
|
const Div = 4;
|
|
9537
9559
|
const Input = 6;
|
|
9538
9560
|
const Span = 8;
|
|
9539
9561
|
const Text = 12;
|
|
9562
|
+
const TextArea = 62;
|
|
9540
9563
|
|
|
9541
9564
|
const text = data => {
|
|
9542
9565
|
return {
|
|
@@ -11412,6 +11435,29 @@ const getEditorRowsVirtualDom = (textInfos, differences, lineNumbers = true, hig
|
|
|
11412
11435
|
return dom;
|
|
11413
11436
|
};
|
|
11414
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
|
+
|
|
11415
11461
|
const getSelectionsVirtualDom = selections => {
|
|
11416
11462
|
const dom = [];
|
|
11417
11463
|
for (let i = 0; i < selections.length; i += 4) {
|
|
@@ -11452,9 +11498,12 @@ const getEditorVirtualDom = ({
|
|
|
11452
11498
|
const diagnosticsDom = getDiagnosticsVirtualDom(diagnosticsArray);
|
|
11453
11499
|
const gutterDom = getEditorGutterVirtualDom(gutterInfosArray);
|
|
11454
11500
|
const scrollBarDiagnosticsDom = getDiagnosticsVirtualDom(scrollBarDiagnosticsArray);
|
|
11501
|
+
const scrollBarDom = getScrollBarVirtualDom();
|
|
11455
11502
|
return [{
|
|
11456
11503
|
childCount: 2,
|
|
11457
11504
|
className: 'Viewlet Editor',
|
|
11505
|
+
onContextMenu: HandleContextMenu,
|
|
11506
|
+
onWheel: HandleWheel,
|
|
11458
11507
|
role: 'code',
|
|
11459
11508
|
type: Div
|
|
11460
11509
|
}, {
|
|
@@ -11462,9 +11511,32 @@ const getEditorVirtualDom = ({
|
|
|
11462
11511
|
className: 'Gutter',
|
|
11463
11512
|
type: Div
|
|
11464
11513
|
}, ...gutterDom, {
|
|
11465
|
-
childCount:
|
|
11514
|
+
childCount: 5,
|
|
11466
11515
|
className: 'EditorContent',
|
|
11516
|
+
onMouseMove: HandleMouseMove,
|
|
11467
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'
|
|
11468
11540
|
}, {
|
|
11469
11541
|
childCount: 4,
|
|
11470
11542
|
className: 'EditorLayers',
|
|
@@ -11476,6 +11548,8 @@ const getEditorVirtualDom = ({
|
|
|
11476
11548
|
}, ...selectionsDom, {
|
|
11477
11549
|
childCount: textInfos.length,
|
|
11478
11550
|
className: 'EditorRows',
|
|
11551
|
+
onMouseDown: HandleMouseDown,
|
|
11552
|
+
onPointerDown: HandlePointerDown,
|
|
11479
11553
|
type: Div
|
|
11480
11554
|
}, ...rowsDom, {
|
|
11481
11555
|
childCount: cursorsDom.length,
|
|
@@ -11489,27 +11563,15 @@ const getEditorVirtualDom = ({
|
|
|
11489
11563
|
childCount: scrollBarDiagnosticsDom.length,
|
|
11490
11564
|
className: 'EditorScrollBarDiagnostics',
|
|
11491
11565
|
type: Div
|
|
11492
|
-
}, ...scrollBarDiagnosticsDom,
|
|
11493
|
-
childCount: 1,
|
|
11494
|
-
className: 'ScrollBar ScrollBarVertical',
|
|
11495
|
-
type: Div
|
|
11496
|
-
}, {
|
|
11497
|
-
childCount: 0,
|
|
11498
|
-
className: 'ScrollBarThumb ScrollBarThumbVertical',
|
|
11499
|
-
type: Div
|
|
11500
|
-
}, {
|
|
11501
|
-
childCount: 1,
|
|
11502
|
-
className: 'ScrollBar ScrollBarHorizontal',
|
|
11503
|
-
type: Div
|
|
11504
|
-
}, {
|
|
11505
|
-
childCount: 0,
|
|
11506
|
-
className: 'ScrollBarThumb ScrollBarThumbHorizontal',
|
|
11507
|
-
type: Div
|
|
11508
|
-
}];
|
|
11566
|
+
}, ...scrollBarDiagnosticsDom, ...scrollBarDom];
|
|
11509
11567
|
};
|
|
11510
11568
|
|
|
11511
11569
|
const getDom = state => {
|
|
11512
|
-
|
|
11570
|
+
const {
|
|
11571
|
+
initial,
|
|
11572
|
+
textInfos
|
|
11573
|
+
} = state;
|
|
11574
|
+
if (initial && textInfos.length === 0) {
|
|
11513
11575
|
return [];
|
|
11514
11576
|
}
|
|
11515
11577
|
return getEditorVirtualDom(state);
|
|
@@ -11785,13 +11847,14 @@ const renderEventListeners = () => {
|
|
|
11785
11847
|
params: ['handleFocus']
|
|
11786
11848
|
}, {
|
|
11787
11849
|
name: HandleMouseMove,
|
|
11788
|
-
params: ['
|
|
11850
|
+
params: ['handleMouseMove', ClientX, ClientY, AltKey]
|
|
11789
11851
|
}, {
|
|
11790
11852
|
name: HandleBlur,
|
|
11791
11853
|
params: ['handleBlur']
|
|
11792
11854
|
}, {
|
|
11793
11855
|
name: HandleBeforeInput,
|
|
11794
|
-
params: ['handleBeforeInput', 'event.inputType', 'event.data']
|
|
11856
|
+
params: ['handleBeforeInput', 'event.inputType', 'event.data'],
|
|
11857
|
+
preventDefault: true
|
|
11795
11858
|
}, {
|
|
11796
11859
|
name: HandleCompositionStart,
|
|
11797
11860
|
params: ['compositionStart', 'event.data']
|
|
@@ -11800,11 +11863,28 @@ const renderEventListeners = () => {
|
|
|
11800
11863
|
params: ['compositionUpdate', 'event.data']
|
|
11801
11864
|
}, {
|
|
11802
11865
|
name: HandleCompositionEnd,
|
|
11803
|
-
params: ['
|
|
11866
|
+
params: ['compositionEnd', 'event.data']
|
|
11804
11867
|
}, {
|
|
11805
11868
|
name: HandleCut,
|
|
11806
11869
|
params: ['cut'],
|
|
11807
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']
|
|
11808
11888
|
}, {
|
|
11809
11889
|
name: HandleWheel,
|
|
11810
11890
|
params: ['setDelta', DeltaMode, DeltaY],
|
|
@@ -11813,6 +11893,26 @@ const renderEventListeners = () => {
|
|
|
11813
11893
|
name: HandleContextMenu,
|
|
11814
11894
|
params: ['handleContextMenu', Button, ClientX, ClientY],
|
|
11815
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']
|
|
11816
11916
|
}];
|
|
11817
11917
|
};
|
|
11818
11918
|
|
|
@@ -11969,6 +12069,8 @@ const commandMap = {
|
|
|
11969
12069
|
'Editor.handleMouseMoveWithAltKey': wrapCommandOld(handleMouseMoveWithAltKey),
|
|
11970
12070
|
'Editor.handleNativeSelectionChange': editorHandleNativeSelectionChange,
|
|
11971
12071
|
'Editor.handlePointerCaptureLost': wrapCommandOld(handlePointerCaptureLost),
|
|
12072
|
+
'Editor.handlePointerMove': wrapCommandOld(handlePointerMove),
|
|
12073
|
+
'Editor.handlePointerUp': wrapCommandOld(handlePointerUp),
|
|
11972
12074
|
'Editor.handleScrollBarClick': handleScrollBarPointerDown,
|
|
11973
12075
|
'Editor.handleScrollBarHorizontalMove': wrapCommandOld(handleScrollBarHorizontalMove),
|
|
11974
12076
|
'Editor.handleScrollBarHorizontalPointerDown': wrapCommandOld(handleScrollBarHorizontalPointerDown),
|