@lvce-editor/explorer-view 3.0.0 → 3.1.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.
|
@@ -2416,7 +2416,7 @@ const focusPrevious = state => {
|
|
|
2416
2416
|
}
|
|
2417
2417
|
};
|
|
2418
2418
|
|
|
2419
|
-
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', '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'];
|
|
2419
|
+
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'];
|
|
2420
2420
|
|
|
2421
2421
|
const getCommandIds = () => {
|
|
2422
2422
|
return commandIds;
|
|
@@ -3294,19 +3294,28 @@ const canBeDroppedInto = dirent => {
|
|
|
3294
3294
|
}
|
|
3295
3295
|
};
|
|
3296
3296
|
|
|
3297
|
+
const countInRange = (start, end) => {
|
|
3298
|
+
const items = [];
|
|
3299
|
+
for (let i = start; i < end; i++) {
|
|
3300
|
+
items.push(i);
|
|
3301
|
+
}
|
|
3302
|
+
return items;
|
|
3303
|
+
};
|
|
3304
|
+
|
|
3297
3305
|
const dropTargetFull = [-1];
|
|
3298
3306
|
|
|
3299
|
-
const getNewDropTargets = (state,
|
|
3307
|
+
const getNewDropTargets = (state, index) => {
|
|
3300
3308
|
const {
|
|
3301
3309
|
items
|
|
3302
3310
|
} = state;
|
|
3303
|
-
const index = getIndexFromPosition(state, x, y);
|
|
3304
3311
|
if (index === -1) {
|
|
3305
3312
|
return dropTargetFull;
|
|
3306
3313
|
}
|
|
3307
3314
|
const item = items[index];
|
|
3308
3315
|
if (!canBeDroppedInto(item)) {
|
|
3309
|
-
|
|
3316
|
+
const startIndex = getParentStartIndex(items, index);
|
|
3317
|
+
const endIndex = getParentEndIndex(items, index);
|
|
3318
|
+
return countInRange(startIndex, endIndex);
|
|
3310
3319
|
}
|
|
3311
3320
|
const newDropTargets = [index];
|
|
3312
3321
|
return newDropTargets;
|
|
@@ -3327,13 +3336,11 @@ const isEqual = (a, b) => {
|
|
|
3327
3336
|
return true;
|
|
3328
3337
|
};
|
|
3329
3338
|
|
|
3330
|
-
const
|
|
3331
|
-
number(x);
|
|
3332
|
-
number(y);
|
|
3339
|
+
const handleDragOverIndex = (state, index) => {
|
|
3333
3340
|
const {
|
|
3334
3341
|
dropTargets
|
|
3335
3342
|
} = state;
|
|
3336
|
-
const newDropTargets = getNewDropTargets(state,
|
|
3343
|
+
const newDropTargets = getNewDropTargets(state, index);
|
|
3337
3344
|
if (isEqual(dropTargets, newDropTargets)) {
|
|
3338
3345
|
return state;
|
|
3339
3346
|
}
|
|
@@ -3343,6 +3350,13 @@ const handleDragOver = (state, x, y) => {
|
|
|
3343
3350
|
};
|
|
3344
3351
|
};
|
|
3345
3352
|
|
|
3353
|
+
const handleDragOver = (state, x, y) => {
|
|
3354
|
+
number(x);
|
|
3355
|
+
number(y);
|
|
3356
|
+
const index = getIndexFromPosition(state, x, y);
|
|
3357
|
+
return handleDragOverIndex(state, index);
|
|
3358
|
+
};
|
|
3359
|
+
|
|
3346
3360
|
const handleDragStart = state => {
|
|
3347
3361
|
return state;
|
|
3348
3362
|
};
|
|
@@ -5673,6 +5687,7 @@ const commandMap = {
|
|
|
5673
5687
|
'Explorer.focusIndex': wrapCommand(focusIndex),
|
|
5674
5688
|
'Explorer.focusLast': wrapCommand(focusLast),
|
|
5675
5689
|
'Explorer.handleDragStart': wrapCommand(handleDragStart),
|
|
5690
|
+
'Explorer.handleDragOverIndex': wrapCommand(handleDragOverIndex),
|
|
5676
5691
|
'Explorer.focusNext': wrapCommand(focusNext),
|
|
5677
5692
|
'Explorer.focusNone': wrapCommand(focusNone),
|
|
5678
5693
|
'Explorer.focusPrevious': wrapCommand(focusPrevious),
|