@lvce-editor/explorer-view 3.7.0 → 3.8.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 +48 -15
- package/package.json +1 -1
|
@@ -2038,6 +2038,11 @@ const treeToArray = (map, root) => {
|
|
|
2038
2038
|
return items;
|
|
2039
2039
|
};
|
|
2040
2040
|
|
|
2041
|
+
const EmptyString = '';
|
|
2042
|
+
const Slash$1 = '/';
|
|
2043
|
+
const Dot = '.';
|
|
2044
|
+
const BackSlash = '\\';
|
|
2045
|
+
|
|
2041
2046
|
const emptyObject = {};
|
|
2042
2047
|
const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
|
|
2043
2048
|
const i18nString = (key, placeholders = emptyObject) => {
|
|
@@ -2058,6 +2063,8 @@ const Cut = 'Cut';
|
|
|
2058
2063
|
const Delete = 'Delete';
|
|
2059
2064
|
const FileNameCannotStartWithSlash = 'A file or folder name cannot start with a slash.';
|
|
2060
2065
|
const FileOrFolderNameMustBeProvider = 'A file or folder name must be provided.';
|
|
2066
|
+
const FileCannotStartWithDot = 'A file or folder name cannot start with a dot.';
|
|
2067
|
+
const FileCannotStartWithBackSlash = 'A file or folder name cannot start with a backslash.';
|
|
2061
2068
|
const FilesExplorer = 'Files Explorer';
|
|
2062
2069
|
const NewFile$1 = 'New File...';
|
|
2063
2070
|
const NewFolder$1 = 'New Folder...';
|
|
@@ -2124,6 +2131,12 @@ const fileOrFolderNameMustBeProvided = () => {
|
|
|
2124
2131
|
const fileCannotStartWithSlash = () => {
|
|
2125
2132
|
return i18nString(FileNameCannotStartWithSlash);
|
|
2126
2133
|
};
|
|
2134
|
+
const fileCannotStartWithDot = () => {
|
|
2135
|
+
return i18nString(FileCannotStartWithDot);
|
|
2136
|
+
};
|
|
2137
|
+
const fileCannotStartWithBackSlash = () => {
|
|
2138
|
+
return i18nString(FileCannotStartWithBackSlash);
|
|
2139
|
+
};
|
|
2127
2140
|
const typeAFileName = () => {
|
|
2128
2141
|
return i18nString(TypeAFileName);
|
|
2129
2142
|
};
|
|
@@ -2133,9 +2146,15 @@ const validateFileName2 = name => {
|
|
|
2133
2146
|
const editingErrorMessage = fileOrFolderNameMustBeProvided();
|
|
2134
2147
|
return editingErrorMessage;
|
|
2135
2148
|
}
|
|
2136
|
-
if (name.startsWith(
|
|
2149
|
+
if (name.startsWith(Dot)) {
|
|
2150
|
+
return fileCannotStartWithDot();
|
|
2151
|
+
}
|
|
2152
|
+
if (name.startsWith(Slash$1)) {
|
|
2137
2153
|
return fileCannotStartWithSlash();
|
|
2138
2154
|
}
|
|
2155
|
+
if (name.startsWith(BackSlash)) {
|
|
2156
|
+
return fileCannotStartWithBackSlash();
|
|
2157
|
+
}
|
|
2139
2158
|
return '';
|
|
2140
2159
|
};
|
|
2141
2160
|
|
|
@@ -2321,12 +2340,17 @@ const isNormalItem = item => {
|
|
|
2321
2340
|
return item.type !== EditingFile && item.type !== EditingFolder;
|
|
2322
2341
|
};
|
|
2323
2342
|
|
|
2324
|
-
const cancelEditCreate = (state, keepFocus) => {
|
|
2343
|
+
const cancelEditCreate = async (state, keepFocus) => {
|
|
2325
2344
|
const {
|
|
2326
2345
|
editingIndex,
|
|
2327
|
-
items
|
|
2346
|
+
items,
|
|
2347
|
+
fileIconCache
|
|
2328
2348
|
} = state;
|
|
2329
2349
|
const filteredItems = items.filter(isNormalItem);
|
|
2350
|
+
const {
|
|
2351
|
+
icons,
|
|
2352
|
+
newFileIconCache
|
|
2353
|
+
} = await getFileIcons(filteredItems, fileIconCache);
|
|
2330
2354
|
return {
|
|
2331
2355
|
...state,
|
|
2332
2356
|
items: filteredItems,
|
|
@@ -2336,7 +2360,9 @@ const cancelEditCreate = (state, keepFocus) => {
|
|
|
2336
2360
|
editingValue: '',
|
|
2337
2361
|
editingErrorMessage: '',
|
|
2338
2362
|
editingType: None$5,
|
|
2339
|
-
focus: List
|
|
2363
|
+
focus: List,
|
|
2364
|
+
icons,
|
|
2365
|
+
fileIconCache: newFileIconCache
|
|
2340
2366
|
};
|
|
2341
2367
|
};
|
|
2342
2368
|
|
|
@@ -2378,7 +2404,7 @@ const cancelEditRename = (state, keepFocus) => {
|
|
|
2378
2404
|
};
|
|
2379
2405
|
};
|
|
2380
2406
|
|
|
2381
|
-
const cancelEditInternal = (state, keepFocus) => {
|
|
2407
|
+
const cancelEditInternal = async (state, keepFocus) => {
|
|
2382
2408
|
const {
|
|
2383
2409
|
editingType
|
|
2384
2410
|
} = state;
|
|
@@ -2388,7 +2414,7 @@ const cancelEditInternal = (state, keepFocus) => {
|
|
|
2388
2414
|
return cancelEditCreate(state, keepFocus);
|
|
2389
2415
|
};
|
|
2390
2416
|
|
|
2391
|
-
const cancelEdit = state => {
|
|
2417
|
+
const cancelEdit = async state => {
|
|
2392
2418
|
return cancelEditInternal(state, true);
|
|
2393
2419
|
};
|
|
2394
2420
|
|
|
@@ -2563,7 +2589,9 @@ const create$1 = () => {
|
|
|
2563
2589
|
const {
|
|
2564
2590
|
get,
|
|
2565
2591
|
set,
|
|
2566
|
-
wrapCommand
|
|
2592
|
+
wrapCommand,
|
|
2593
|
+
registerCommands,
|
|
2594
|
+
getCommandIds
|
|
2567
2595
|
} = create$1();
|
|
2568
2596
|
|
|
2569
2597
|
const ListItem = 22;
|
|
@@ -3011,12 +3039,6 @@ const focusPrevious = state => {
|
|
|
3011
3039
|
}
|
|
3012
3040
|
};
|
|
3013
3041
|
|
|
3014
|
-
const commandIds = ['acceptEdit', 'cancelEdit', 'cancelTypeAhead', 'collapseAll', 'copyPath', 'copyRelativePath', 'dispose', 'expandAll', 'expandRecursively', 'focus', 'focusFirst', 'focusIndex', 'focusLast', 'focusNext', 'focusNone', 'focusPrevious', 'getFocusedDirent', 'getMenuEntries2', 'getMouseActions', 'handleArrowLeft', 'handleArrowLeft', 'handleArrowRight', 'handleArrowRight', 'handleBlur', 'handleClick', 'handleClickAt', 'handleClickCurrent', 'handleClickCurrentButKeepFocus', 'handleClickOpenFolder', 'handleContextMenu', 'handleContextMenuKeyboard', 'handleCopy', 'handleCut', 'handleDragLeave', 'handleDragOver', 'handleDragOverIndex', 'handleDragStart', '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', 'selectIndices', 'selectUp', 'setDeltaY', 'setSelectedIndices', 'toggleIndividualSelection', 'updateEditingValue', 'updateIcons'];
|
|
3015
|
-
|
|
3016
|
-
const getCommandIds = () => {
|
|
3017
|
-
return commandIds;
|
|
3018
|
-
};
|
|
3019
|
-
|
|
3020
3042
|
const mergeClassNames = (...classNames) => {
|
|
3021
3043
|
return classNames.filter(Boolean).join(' ');
|
|
3022
3044
|
};
|
|
@@ -3124,6 +3146,10 @@ const getKeyBindings = () => {
|
|
|
3124
3146
|
key: Enter,
|
|
3125
3147
|
command: 'Explorer.handleClickCurrent',
|
|
3126
3148
|
when: FocusExplorer
|
|
3149
|
+
}, {
|
|
3150
|
+
key: Escape,
|
|
3151
|
+
command: 'Explorer.handleEscape',
|
|
3152
|
+
when: FocusExplorer
|
|
3127
3153
|
}, {
|
|
3128
3154
|
key: CtrlCmd | KeyA,
|
|
3129
3155
|
command: 'Explorer.selectAll',
|
|
@@ -4305,6 +4331,13 @@ const handleDrop = async (state, x, y, fileIds, fileList) => {
|
|
|
4305
4331
|
}
|
|
4306
4332
|
};
|
|
4307
4333
|
|
|
4334
|
+
const handleEscape = async state => {
|
|
4335
|
+
return {
|
|
4336
|
+
...state,
|
|
4337
|
+
cutItems: []
|
|
4338
|
+
};
|
|
4339
|
+
};
|
|
4340
|
+
|
|
4308
4341
|
const handleFocus = async state => {
|
|
4309
4342
|
await setFocus(FocusExplorer);
|
|
4310
4343
|
return state;
|
|
@@ -4747,8 +4780,6 @@ const getSettings = async () => {
|
|
|
4747
4780
|
};
|
|
4748
4781
|
};
|
|
4749
4782
|
|
|
4750
|
-
const EmptyString = '';
|
|
4751
|
-
|
|
4752
4783
|
const getSavedChildDirents = (map, path, depth, excluded, pathSeparator) => {
|
|
4753
4784
|
let children = map[path];
|
|
4754
4785
|
if (!children) {
|
|
@@ -6280,6 +6311,7 @@ const commandMap = {
|
|
|
6280
6311
|
'Explorer.getMouseActions': getMouseActions,
|
|
6281
6312
|
'Explorer.handleArrowLeft': wrapCommand(handleArrowLeft),
|
|
6282
6313
|
'Explorer.handleArrowRight': wrapCommand(handleArrowRight),
|
|
6314
|
+
'Explorer.handleEscape': wrapCommand(handleEscape),
|
|
6283
6315
|
'Explorer.handleBlur': wrapCommand(handleBlur),
|
|
6284
6316
|
'Explorer.handleClick': wrapCommand(handleClick),
|
|
6285
6317
|
'Explorer.handleClickAt': wrapCommand(handleClickAt),
|
|
@@ -6338,6 +6370,7 @@ const commandMap = {
|
|
|
6338
6370
|
};
|
|
6339
6371
|
|
|
6340
6372
|
const listen = async () => {
|
|
6373
|
+
registerCommands(commandMap);
|
|
6341
6374
|
const rpc = await WebWorkerRpcClient.create({
|
|
6342
6375
|
commandMap: commandMap
|
|
6343
6376
|
});
|