@lvce-editor/explorer-view 1.8.0 → 1.10.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.
|
@@ -2325,7 +2325,7 @@ const handleClickDirectoryExpanding = (state, dirent, index, keepFocus) => {
|
|
|
2325
2325
|
};
|
|
2326
2326
|
|
|
2327
2327
|
const handleClickFile$1 = async (state, dirent, index, keepFocus = false) => {
|
|
2328
|
-
|
|
2328
|
+
await invoke(/* Main.openAbsolutePath */'Main.openUri', /* absolutePath */dirent.path, /* focus */!keepFocus);
|
|
2329
2329
|
return {
|
|
2330
2330
|
...state,
|
|
2331
2331
|
focusedIndex: index,
|
|
@@ -3280,13 +3280,78 @@ const removeDirent = async state => {
|
|
|
3280
3280
|
} else {
|
|
3281
3281
|
indexToFocus = Math.max(state.focusedIndex - 1, 0);
|
|
3282
3282
|
}
|
|
3283
|
+
const visible = newDirents.slice(state.minLineY, state.maxLineY);
|
|
3284
|
+
const icons = await getFileIcons(visible);
|
|
3285
|
+
console.log({
|
|
3286
|
+
icons
|
|
3287
|
+
});
|
|
3283
3288
|
return {
|
|
3284
3289
|
...state,
|
|
3285
3290
|
items: newDirents,
|
|
3291
|
+
icons,
|
|
3286
3292
|
focusedIndex: indexToFocus
|
|
3287
3293
|
};
|
|
3288
3294
|
};
|
|
3289
3295
|
|
|
3296
|
+
const canBeDroppedInto = dirent => {
|
|
3297
|
+
if (!dirent) {
|
|
3298
|
+
return false;
|
|
3299
|
+
}
|
|
3300
|
+
switch (dirent.type) {
|
|
3301
|
+
case Directory:
|
|
3302
|
+
case DirectoryExpanded:
|
|
3303
|
+
case DirectoryExpanding:
|
|
3304
|
+
return true;
|
|
3305
|
+
default:
|
|
3306
|
+
return false;
|
|
3307
|
+
}
|
|
3308
|
+
};
|
|
3309
|
+
|
|
3310
|
+
const getNewDropTargets = (state, x, y) => {
|
|
3311
|
+
const {
|
|
3312
|
+
items
|
|
3313
|
+
} = state;
|
|
3314
|
+
const index = getIndexFromPosition(state, x, y);
|
|
3315
|
+
if (index === -1) {
|
|
3316
|
+
return [-1];
|
|
3317
|
+
}
|
|
3318
|
+
const item = items[index];
|
|
3319
|
+
if (!canBeDroppedInto(item)) {
|
|
3320
|
+
return [];
|
|
3321
|
+
}
|
|
3322
|
+
const newDropTargets = [index];
|
|
3323
|
+
return newDropTargets;
|
|
3324
|
+
};
|
|
3325
|
+
|
|
3326
|
+
const isEqual = (a, b) => {
|
|
3327
|
+
if (a.length !== b.length) {
|
|
3328
|
+
return false;
|
|
3329
|
+
}
|
|
3330
|
+
const length = a.length;
|
|
3331
|
+
for (let i = 0; i < length; i++) {
|
|
3332
|
+
if (a[i] !== b[i]) {
|
|
3333
|
+
return false;
|
|
3334
|
+
}
|
|
3335
|
+
}
|
|
3336
|
+
return true;
|
|
3337
|
+
};
|
|
3338
|
+
|
|
3339
|
+
const handleDragOver = (state, x, y) => {
|
|
3340
|
+
number(x);
|
|
3341
|
+
number(y);
|
|
3342
|
+
const {
|
|
3343
|
+
dropTargets
|
|
3344
|
+
} = state;
|
|
3345
|
+
const newDropTargets = getNewDropTargets(state, x, y);
|
|
3346
|
+
if (isEqual(dropTargets, newDropTargets)) {
|
|
3347
|
+
return state;
|
|
3348
|
+
}
|
|
3349
|
+
return {
|
|
3350
|
+
...state,
|
|
3351
|
+
dropTargets: newDropTargets
|
|
3352
|
+
};
|
|
3353
|
+
};
|
|
3354
|
+
|
|
3290
3355
|
const renameDirent = state => {
|
|
3291
3356
|
const {
|
|
3292
3357
|
focusedIndex,
|
|
@@ -3688,6 +3753,7 @@ const commandMap = {
|
|
|
3688
3753
|
'Explorer.handleClickOpenFolder': handleClickOpenFolder,
|
|
3689
3754
|
'Explorer.handleContextMenu': handleContextMenu,
|
|
3690
3755
|
'Explorer.handleCopy': handleCopy,
|
|
3756
|
+
'Explorer.handleDragOver': handleDragOver,
|
|
3691
3757
|
'Explorer.handleDrop': handleDrop,
|
|
3692
3758
|
'Explorer.handleIconThemeChange': handleIconThemeChange,
|
|
3693
3759
|
'Explorer.handlePaste': handlePaste,
|