@lvce-editor/explorer-view 2.60.0 → 2.61.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/explorerViewWorkerMain.js +75 -22
- package/package.json +1 -1
|
@@ -931,17 +931,34 @@ const create$2 = rpcId => {
|
|
|
931
931
|
};
|
|
932
932
|
const RendererWorker$1 = 1;
|
|
933
933
|
const {
|
|
934
|
-
invoke: invoke$
|
|
934
|
+
invoke: invoke$3,
|
|
935
935
|
set: set$3} = create$2(RendererWorker$1);
|
|
936
|
+
const showContextMenu$1 = async (x, y, id, ...args) => {
|
|
937
|
+
return invoke$3('ContextMenu.show', x, y, id, ...args);
|
|
938
|
+
};
|
|
939
|
+
const confirm$1 = async (message, options) => {
|
|
940
|
+
// @ts-ignore
|
|
941
|
+
const result = await invoke$3('Confirmprompt.prompt', message, options);
|
|
942
|
+
return result;
|
|
943
|
+
};
|
|
944
|
+
const writeClipBoardText$1 = async text => {
|
|
945
|
+
await invoke$3('ClipBoard.writeText', /* text */text);
|
|
946
|
+
};
|
|
936
947
|
const RendererWorker = {
|
|
937
948
|
__proto__: null,
|
|
938
|
-
|
|
939
|
-
|
|
949
|
+
confirm: confirm$1,
|
|
950
|
+
invoke: invoke$3,
|
|
951
|
+
set: set$3,
|
|
952
|
+
showContextMenu: showContextMenu$1,
|
|
953
|
+
writeClipBoardText: writeClipBoardText$1
|
|
940
954
|
};
|
|
941
955
|
|
|
942
956
|
const {
|
|
943
957
|
invoke: invoke$1,
|
|
944
|
-
set: set$1
|
|
958
|
+
set: set$1,
|
|
959
|
+
writeClipBoardText,
|
|
960
|
+
confirm,
|
|
961
|
+
showContextMenu
|
|
945
962
|
} = RendererWorker;
|
|
946
963
|
|
|
947
964
|
// TODO use direct connection
|
|
@@ -1870,7 +1887,7 @@ const copyPath = async state => {
|
|
|
1870
1887
|
};
|
|
1871
1888
|
|
|
1872
1889
|
const writeText = async text => {
|
|
1873
|
-
await
|
|
1890
|
+
await writeClipBoardText(text);
|
|
1874
1891
|
};
|
|
1875
1892
|
const readNativeFiles = async () => {
|
|
1876
1893
|
// @ts-ignore
|
|
@@ -2391,7 +2408,7 @@ const focusPrevious = state => {
|
|
|
2391
2408
|
}
|
|
2392
2409
|
};
|
|
2393
2410
|
|
|
2394
|
-
const commandIds = ['acceptEdit', 'cancelEdit', 'cancelTypeAhead', 'collapseAll', 'copyPath', 'copyRelativePath', 'dispose', 'expandAll', 'expandRecursively', 'focus', 'focusFirst', 'focusIndex', 'focusLast', 'handleCut', 'selectIndices', 'focusNext', 'focusNone', 'focusPrevious', 'getFocusedDirent', 'getMenuEntries2', 'getMouseActions', 'handleArrowLeft', 'handleArrowLeft', 'handleArrowRight', 'handleArrowRight', 'handleBlur', 'handleClick', 'handleClickAt', 'handleClickCurrent', 'handleClickCurrentButKeepFocus', 'handleClickOpenFolder', 'handleContextMenu', 'handleContextMenuKeyboard', 'handleCopy', 'handleDragLeave', 'handleDragOver', 'handleDrop', 'handleFocus', 'handleIconThemeChange', 'handleInputBlur', 'handleInputClick', 'handleInputKeyDown', 'handleKeyDown', 'handleLanguagesChanged', 'handleMouseEnter', 'handleMouseLeave', 'handlePaste', 'handlePointerDown', 'handleUpload', 'handleWheel', 'handleWorkspaceChange', 'hotReload', 'newFile', 'newFolder', 'openContainingFolder', 'refresh', 'removeDirent', 'rename', 'renameDirent', 'renderEventListeners', 'revealItem', 'revealItem', 'scrollDown', 'scrollUp', 'selectAll', 'selectDown', 'selectUp', 'setDeltaY', 'setSelectedIndices', 'updateEditingValue', 'updateIcons'];
|
|
2411
|
+
const commandIds = ['acceptEdit', 'cancelEdit', 'cancelTypeAhead', 'collapseAll', 'copyPath', 'copyRelativePath', 'dispose', 'expandAll', 'expandRecursively', 'focus', 'focusFirst', 'focusIndex', 'focusLast', 'handleCut', 'selectIndices', 'toggleIndividualSelection', 'focusNext', 'focusNone', 'focusPrevious', 'getFocusedDirent', 'getMenuEntries2', 'getMouseActions', 'handleArrowLeft', 'handleArrowLeft', 'handleArrowRight', 'handleArrowRight', 'handleBlur', 'handleClick', 'handleClickAt', 'handleClickCurrent', 'handleClickCurrentButKeepFocus', 'handleClickOpenFolder', 'handleContextMenu', 'handleContextMenuKeyboard', 'handleCopy', 'handleDragLeave', 'handleDragOver', 'handleDrop', 'handleFocus', 'handleIconThemeChange', 'handleInputBlur', 'handleInputClick', 'handleInputKeyDown', 'handleKeyDown', 'handleLanguagesChanged', 'handleMouseEnter', 'handleMouseLeave', 'handlePaste', 'handlePointerDown', 'handleUpload', 'handleWheel', 'handleWorkspaceChange', 'hotReload', 'newFile', 'newFolder', 'openContainingFolder', 'refresh', 'removeDirent', 'rename', 'renameDirent', 'renderEventListeners', 'revealItem', 'revealItem', 'scrollDown', 'scrollUp', 'selectAll', 'selectDown', 'selectUp', 'setDeltaY', 'setSelectedIndices', 'updateEditingValue', 'updateIcons'];
|
|
2395
2412
|
|
|
2396
2413
|
const getCommandIds = () => {
|
|
2397
2414
|
return commandIds;
|
|
@@ -3090,14 +3107,44 @@ const handleClickAtRangeSelection = async (state, index) => {
|
|
|
3090
3107
|
return handleRangeSelection(state, min, max);
|
|
3091
3108
|
};
|
|
3092
3109
|
|
|
3110
|
+
const toggleIndividualSelection = async (state, index) => {
|
|
3111
|
+
const {
|
|
3112
|
+
items
|
|
3113
|
+
} = state;
|
|
3114
|
+
|
|
3115
|
+
// If index is out of range, do nothing
|
|
3116
|
+
if (index < 0 || index >= items.length) {
|
|
3117
|
+
return state;
|
|
3118
|
+
}
|
|
3119
|
+
const newItems = items.map((item, i) => ({
|
|
3120
|
+
...item,
|
|
3121
|
+
selected: i === index ? !item.selected : item.selected
|
|
3122
|
+
}));
|
|
3123
|
+
return {
|
|
3124
|
+
...state,
|
|
3125
|
+
items: newItems
|
|
3126
|
+
};
|
|
3127
|
+
};
|
|
3128
|
+
|
|
3093
3129
|
const handleClickAt = async (state, defaultPrevented, button, ctrlKey, shiftKey, x, y) => {
|
|
3094
3130
|
if (defaultPrevented || button !== LeftClick) {
|
|
3095
3131
|
return state;
|
|
3096
3132
|
}
|
|
3097
3133
|
const index = getIndexFromPosition(state, x, y);
|
|
3134
|
+
if (index === -1) {
|
|
3135
|
+
return {
|
|
3136
|
+
...state,
|
|
3137
|
+
focused: true,
|
|
3138
|
+
focusedIndex: -1
|
|
3139
|
+
// TODO mark all items as not selected
|
|
3140
|
+
};
|
|
3141
|
+
}
|
|
3098
3142
|
if (shiftKey) {
|
|
3099
3143
|
return handleClickAtRangeSelection(state, index);
|
|
3100
3144
|
}
|
|
3145
|
+
if (ctrlKey) {
|
|
3146
|
+
return toggleIndividualSelection(state, index);
|
|
3147
|
+
}
|
|
3101
3148
|
return handleClick(state, index);
|
|
3102
3149
|
};
|
|
3103
3150
|
|
|
@@ -3119,7 +3166,7 @@ const handleClickOpenFolder = async state => {
|
|
|
3119
3166
|
};
|
|
3120
3167
|
|
|
3121
3168
|
const show = async (x, y, id, ...args) => {
|
|
3122
|
-
return
|
|
3169
|
+
return showContextMenu(x, y, id, ...args);
|
|
3123
3170
|
};
|
|
3124
3171
|
|
|
3125
3172
|
const Explorer$1 = 4;
|
|
@@ -4284,6 +4331,10 @@ const handleWorkspaceChange = async state => {
|
|
|
4284
4331
|
return newState;
|
|
4285
4332
|
};
|
|
4286
4333
|
|
|
4334
|
+
const initialize = async () => {
|
|
4335
|
+
// TODO create file system worker connection
|
|
4336
|
+
};
|
|
4337
|
+
|
|
4287
4338
|
const ExplorerEditBox = FocusExplorerEditBox;
|
|
4288
4339
|
|
|
4289
4340
|
const getNewChildDirentsForNewDirent = async (items, depth, parentPath, direntType) => {
|
|
@@ -4452,7 +4503,7 @@ const confirmDelete = async paths => {
|
|
|
4452
4503
|
// TODO use i18n string
|
|
4453
4504
|
const message = paths.length === 1 ? `Are you sure you want to delete "${paths[0]}"?` : `Are you sure you want to delete ${paths.length} items?`;
|
|
4454
4505
|
// @ts-ignore
|
|
4455
|
-
const result = await
|
|
4506
|
+
const result = await confirm(message);
|
|
4456
4507
|
return result === true;
|
|
4457
4508
|
};
|
|
4458
4509
|
|
|
@@ -4670,19 +4721,19 @@ const getErrorMessageDom = (errorMessage, errorMessageLeft, errorMessageTop) =>
|
|
|
4670
4721
|
}, text(errorMessage)];
|
|
4671
4722
|
};
|
|
4672
4723
|
|
|
4673
|
-
const HandleClick =
|
|
4674
|
-
const HandleClickOpenFolder =
|
|
4675
|
-
const HandleContextMenu =
|
|
4676
|
-
const HandleDragLeave =
|
|
4677
|
-
const HandleDragOver =
|
|
4678
|
-
const HandleDrop =
|
|
4679
|
-
const HandleEditingInput =
|
|
4680
|
-
const HandleInputBlur =
|
|
4681
|
-
const HandleInputClick =
|
|
4682
|
-
const HandleListBlur =
|
|
4683
|
-
const HandleListFocus =
|
|
4684
|
-
const HandlePointerDown =
|
|
4685
|
-
const HandleWheel =
|
|
4724
|
+
const HandleClick = 1;
|
|
4725
|
+
const HandleClickOpenFolder = 2;
|
|
4726
|
+
const HandleContextMenu = 3;
|
|
4727
|
+
const HandleDragLeave = 4;
|
|
4728
|
+
const HandleDragOver = 5;
|
|
4729
|
+
const HandleDrop = 6;
|
|
4730
|
+
const HandleEditingInput = 7;
|
|
4731
|
+
const HandleInputBlur = 8;
|
|
4732
|
+
const HandleInputClick = 9;
|
|
4733
|
+
const HandleListBlur = 11;
|
|
4734
|
+
const HandleListFocus = 12;
|
|
4735
|
+
const HandlePointerDown = 14;
|
|
4736
|
+
const HandleWheel = 15;
|
|
4686
4737
|
|
|
4687
4738
|
const getExplorerWelcomeVirtualDom = isWide => {
|
|
4688
4739
|
return [{
|
|
@@ -5598,10 +5649,11 @@ const commandMap = {
|
|
|
5598
5649
|
'Explorer.revealItem': wrapCommand(revealItem),
|
|
5599
5650
|
'Explorer.selectAll': wrapCommand(selectAll),
|
|
5600
5651
|
'Explorer.selectDown': wrapCommand(selectDown),
|
|
5652
|
+
'Explorer.selectIndices': wrapCommand(setSelectedIndices),
|
|
5601
5653
|
'Explorer.selectUp': wrapCommand(selectUp),
|
|
5602
5654
|
'Explorer.setDeltaY': wrapCommand(setDeltaY),
|
|
5603
5655
|
'Explorer.setSelectedIndices': wrapCommand(setSelectedIndices),
|
|
5604
|
-
'Explorer.
|
|
5656
|
+
'Explorer.toggleIndividualSelection': wrapCommand(toggleIndividualSelection),
|
|
5605
5657
|
'Explorer.updateEditingValue': wrapCommand(updateEditingValue),
|
|
5606
5658
|
'Explorer.updateIcons': wrapCommand(updateIcons),
|
|
5607
5659
|
// not wrapped
|
|
@@ -5614,6 +5666,7 @@ const commandMap = {
|
|
|
5614
5666
|
'Explorer.renderEventListeners': renderEventListeners,
|
|
5615
5667
|
'Explorer.saveState': saveState,
|
|
5616
5668
|
'Explorer.terminate': terminate,
|
|
5669
|
+
'Explorer.initialize': initialize,
|
|
5617
5670
|
// deprecated
|
|
5618
5671
|
'Explorer.create': create
|
|
5619
5672
|
};
|