@lvce-editor/explorer-view 2.51.0 → 2.53.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.
|
@@ -936,6 +936,7 @@ const {
|
|
|
936
936
|
set: set$1
|
|
937
937
|
} = RendererWorker;
|
|
938
938
|
|
|
939
|
+
// TODO use direct connection
|
|
939
940
|
const invoke = async (method, ...params) => {
|
|
940
941
|
return invoke$1(method, ...params);
|
|
941
942
|
};
|
|
@@ -1957,6 +1958,7 @@ const create2 = (uid, uri, x, y, width, height, args, parentUid, platform = 0) =
|
|
|
1957
1958
|
editingIcon: '',
|
|
1958
1959
|
fileIconCache: Object.create(null),
|
|
1959
1960
|
useChevrons: false,
|
|
1961
|
+
confirmDelete: false,
|
|
1960
1962
|
icons: [],
|
|
1961
1963
|
platform,
|
|
1962
1964
|
focus: 0,
|
|
@@ -1969,7 +1971,8 @@ const create2 = (uid, uri, x, y, width, height, args, parentUid, platform = 0) =
|
|
|
1969
1971
|
finalDeltaY: 0,
|
|
1970
1972
|
handleOffset: 0,
|
|
1971
1973
|
scrollBarActive: false,
|
|
1972
|
-
scrollBarHeight: 0
|
|
1974
|
+
scrollBarHeight: 0,
|
|
1975
|
+
confirmPaste: false
|
|
1973
1976
|
};
|
|
1974
1977
|
set(uid, state, state);
|
|
1975
1978
|
};
|
|
@@ -2002,6 +2005,7 @@ const create = (id, uri, x, y, width, height, args, parentUid, platform = 0) =>
|
|
|
2002
2005
|
editingIcon: '',
|
|
2003
2006
|
fileIconCache: Object.create(null),
|
|
2004
2007
|
useChevrons: false,
|
|
2008
|
+
confirmDelete: false,
|
|
2005
2009
|
icons: [],
|
|
2006
2010
|
platform,
|
|
2007
2011
|
focus: 0,
|
|
@@ -2014,7 +2018,8 @@ const create = (id, uri, x, y, width, height, args, parentUid, platform = 0) =>
|
|
|
2014
2018
|
finalDeltaY: 0,
|
|
2015
2019
|
handleOffset: 0,
|
|
2016
2020
|
scrollBarActive: false,
|
|
2017
|
-
scrollBarHeight: 0
|
|
2021
|
+
scrollBarHeight: 0,
|
|
2022
|
+
confirmPaste: false
|
|
2018
2023
|
};
|
|
2019
2024
|
set(state.uid, state, state);
|
|
2020
2025
|
return state;
|
|
@@ -3311,6 +3316,7 @@ const createUploadTree = async (root, fileHandles) => {
|
|
|
3311
3316
|
const childTree = await createUploadTree(name, children);
|
|
3312
3317
|
uploadTree[name] = childTree;
|
|
3313
3318
|
} else if (isFileHandle(fileHandle)) {
|
|
3319
|
+
// TODO maybe save blob and use filesystem.writeblob
|
|
3314
3320
|
const text = await getFileHandleText(fileHandle);
|
|
3315
3321
|
uploadTree[name] = text;
|
|
3316
3322
|
}
|
|
@@ -3860,10 +3866,17 @@ const getWorkspacePath = () => {
|
|
|
3860
3866
|
};
|
|
3861
3867
|
|
|
3862
3868
|
const getSettings = async () => {
|
|
3869
|
+
// TODO get all settings at once
|
|
3863
3870
|
const useChevronsRaw = await invoke$1('Preferences.get', 'explorer.useChevrons');
|
|
3864
3871
|
const useChevrons = useChevronsRaw === false ? false : true;
|
|
3872
|
+
const confirmDeleteRaw = await invoke$1('Preferences.get', 'explorer.confirmdelete');
|
|
3873
|
+
const confirmDelete = confirmDeleteRaw === false ? false : false;
|
|
3874
|
+
const confirmPasteRaw = await invoke$1('Preferences.get', 'explorer.confirmpaste');
|
|
3875
|
+
const confirmPaste = confirmPasteRaw === false ? false : false;
|
|
3865
3876
|
return {
|
|
3866
|
-
useChevrons
|
|
3877
|
+
useChevrons,
|
|
3878
|
+
confirmDelete,
|
|
3879
|
+
confirmPaste
|
|
3867
3880
|
};
|
|
3868
3881
|
};
|
|
3869
3882
|
|
|
@@ -3992,7 +4005,8 @@ const loadContent = async (state, savedState) => {
|
|
|
3992
4005
|
fileIconCache
|
|
3993
4006
|
} = state;
|
|
3994
4007
|
const {
|
|
3995
|
-
useChevrons
|
|
4008
|
+
useChevrons,
|
|
4009
|
+
confirmDelete
|
|
3996
4010
|
} = await getSettings();
|
|
3997
4011
|
const workspacePath = await getWorkspacePath();
|
|
3998
4012
|
const root = getSavedRoot(savedState, workspacePath);
|
|
@@ -4029,7 +4043,8 @@ const loadContent = async (state, savedState) => {
|
|
|
4029
4043
|
maxLineY,
|
|
4030
4044
|
pathSeparator,
|
|
4031
4045
|
excluded,
|
|
4032
|
-
useChevrons
|
|
4046
|
+
useChevrons,
|
|
4047
|
+
confirmDelete
|
|
4033
4048
|
};
|
|
4034
4049
|
};
|
|
4035
4050
|
|
|
@@ -4207,6 +4222,14 @@ const openContainingFolder = async state => {
|
|
|
4207
4222
|
return state;
|
|
4208
4223
|
};
|
|
4209
4224
|
|
|
4225
|
+
const confirmDelete = async paths => {
|
|
4226
|
+
// TODO use i18n string
|
|
4227
|
+
const message = paths.length === 1 ? `Are you sure you want to delete "${paths[0]}"?` : `Are you sure you want to delete ${paths.length} items?`;
|
|
4228
|
+
// @ts-ignore
|
|
4229
|
+
const result = await invoke$1('Confirmprompt.prompt', message);
|
|
4230
|
+
return result === true;
|
|
4231
|
+
};
|
|
4232
|
+
|
|
4210
4233
|
const getSelectedItems = (items, focusedIndex) => {
|
|
4211
4234
|
const dirent = items[focusedIndex];
|
|
4212
4235
|
const selectedItems = items.filter(item => item.selected || item === dirent);
|
|
@@ -4226,13 +4249,22 @@ const removePaths = async paths => {
|
|
|
4226
4249
|
const removeDirent = async state => {
|
|
4227
4250
|
const {
|
|
4228
4251
|
items,
|
|
4229
|
-
focusedIndex
|
|
4252
|
+
focusedIndex,
|
|
4253
|
+
confirmDelete: confirmDelete$1
|
|
4230
4254
|
} = state;
|
|
4231
4255
|
const selectedItems = getSelectedItems(items, focusedIndex);
|
|
4232
4256
|
if (selectedItems.length === 0) {
|
|
4233
4257
|
return state;
|
|
4234
4258
|
}
|
|
4235
4259
|
const toRemove = getPaths(selectedItems);
|
|
4260
|
+
if (confirmDelete$1) {
|
|
4261
|
+
const confirmed = await confirmDelete(toRemove);
|
|
4262
|
+
if (!confirmed) {
|
|
4263
|
+
return state;
|
|
4264
|
+
}
|
|
4265
|
+
}
|
|
4266
|
+
|
|
4267
|
+
// TODO use file operations, bulk edit and explorer refresh
|
|
4236
4268
|
await removePaths(toRemove);
|
|
4237
4269
|
const newState = await refresh(state);
|
|
4238
4270
|
return newState;
|