@lvce-editor/explorer-view 2.62.0 → 2.63.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 +70 -33
- package/package.json +1 -1
|
@@ -2930,9 +2930,19 @@ const handleArrowRight = async state => {
|
|
|
2930
2930
|
const handleBlur = async state => {
|
|
2931
2931
|
// TODO when blur event occurs because of context menu, focused index should stay the same
|
|
2932
2932
|
// but focus outline should be removed
|
|
2933
|
+
const {
|
|
2934
|
+
items
|
|
2935
|
+
} = state;
|
|
2936
|
+
const newItems = items.map(item => {
|
|
2937
|
+
return {
|
|
2938
|
+
...item,
|
|
2939
|
+
selected: false
|
|
2940
|
+
};
|
|
2941
|
+
});
|
|
2933
2942
|
return {
|
|
2934
2943
|
...state,
|
|
2935
|
-
focused: false
|
|
2944
|
+
focused: false,
|
|
2945
|
+
items: newItems
|
|
2936
2946
|
};
|
|
2937
2947
|
};
|
|
2938
2948
|
|
|
@@ -3648,8 +3658,7 @@ const handleDropIntoFile = (state, dirent, index, fileHandles, files, paths) =>
|
|
|
3648
3658
|
if (parentIndex === -1) {
|
|
3649
3659
|
return handleDropRoot(state, fileHandles, files, paths);
|
|
3650
3660
|
}
|
|
3651
|
-
|
|
3652
|
-
return handleDropIndex(parentIndex);
|
|
3661
|
+
return handleDropIndex(state, fileHandles, files, paths, parentIndex);
|
|
3653
3662
|
};
|
|
3654
3663
|
const handleDropIndex = async (state, fileHandles, files, paths, index) => {
|
|
3655
3664
|
const {
|
|
@@ -4076,7 +4085,10 @@ const handlePointerDown = (state, button, x, y) => {
|
|
|
4076
4085
|
focus: List
|
|
4077
4086
|
};
|
|
4078
4087
|
}
|
|
4079
|
-
return
|
|
4088
|
+
return {
|
|
4089
|
+
...state,
|
|
4090
|
+
focusedIndex: index
|
|
4091
|
+
};
|
|
4080
4092
|
};
|
|
4081
4093
|
|
|
4082
4094
|
const handleUpload = async (state, dirents) => {
|
|
@@ -4610,12 +4622,35 @@ const renameDirent = state => {
|
|
|
4610
4622
|
};
|
|
4611
4623
|
};
|
|
4612
4624
|
|
|
4613
|
-
const
|
|
4625
|
+
const getDragLabel = urls => {
|
|
4626
|
+
if (urls.length === 1) {
|
|
4627
|
+
return urls[0];
|
|
4628
|
+
}
|
|
4629
|
+
return `${urls.length}`;
|
|
4630
|
+
};
|
|
4631
|
+
const getDragData = urls => {
|
|
4632
|
+
const data = urls.join('\n');
|
|
4614
4633
|
// TODO send selected urls
|
|
4615
4634
|
const dragData = [{
|
|
4616
4635
|
type: 'text/plain',
|
|
4617
|
-
data
|
|
4636
|
+
data
|
|
4637
|
+
}, {
|
|
4638
|
+
type: 'text/uri-list',
|
|
4639
|
+
data
|
|
4618
4640
|
}];
|
|
4641
|
+
// @ts-ignore
|
|
4642
|
+
dragData.label = getDragLabel(urls);
|
|
4643
|
+
return dragData;
|
|
4644
|
+
};
|
|
4645
|
+
|
|
4646
|
+
const renderDragData = (oldState, newState) => {
|
|
4647
|
+
const {
|
|
4648
|
+
items,
|
|
4649
|
+
focusedIndex
|
|
4650
|
+
} = newState;
|
|
4651
|
+
const selected = items.filter((item, index) => item.selected || index === focusedIndex);
|
|
4652
|
+
const urls = selected.map(item => item.path);
|
|
4653
|
+
const dragData = getDragData(urls);
|
|
4619
4654
|
return ['Viewlet.setDragData', newState.uid, dragData];
|
|
4620
4655
|
};
|
|
4621
4656
|
|
|
@@ -5010,16 +5045,15 @@ const getExpandedType = type => {
|
|
|
5010
5045
|
}
|
|
5011
5046
|
};
|
|
5012
5047
|
|
|
5013
|
-
const
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
return focused;
|
|
5048
|
+
const getTreeItemClassName = (isSelected, isFocused, isDropping) => {
|
|
5049
|
+
let className = TreeItem;
|
|
5050
|
+
if (isSelected || isFocused) {
|
|
5051
|
+
className = mergeClassNames(className, TreeItemActive);
|
|
5018
5052
|
}
|
|
5019
|
-
if (
|
|
5020
|
-
|
|
5053
|
+
if (isDropping) {
|
|
5054
|
+
className = mergeClassNames(className, 'DropTarget');
|
|
5021
5055
|
}
|
|
5022
|
-
return
|
|
5056
|
+
return className;
|
|
5023
5057
|
};
|
|
5024
5058
|
|
|
5025
5059
|
const defaultIndent$1 = 1;
|
|
@@ -5061,7 +5095,8 @@ const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editin
|
|
|
5061
5095
|
const id = isFocused ? 'TreeItemActive' : undefined;
|
|
5062
5096
|
const isSelected = item.selected;
|
|
5063
5097
|
const isCut = cutItems.includes(item.path);
|
|
5064
|
-
const
|
|
5098
|
+
const isDropping = dropTargets.includes(i);
|
|
5099
|
+
const className = getTreeItemClassName(isSelected, isFocused, isDropping); // TODO compute classname in dom function
|
|
5065
5100
|
const expanded = getExpandedType(item.type);
|
|
5066
5101
|
const ariaExpanded = ariaExpandedValues[expanded];
|
|
5067
5102
|
const isEditing = i === editingIndex;
|
|
@@ -5092,25 +5127,25 @@ const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editin
|
|
|
5092
5127
|
|
|
5093
5128
|
const renderItems = (oldState, newState) => {
|
|
5094
5129
|
const {
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5130
|
+
cutItems,
|
|
5131
|
+
deltaY,
|
|
5132
|
+
dropTargets,
|
|
5133
|
+
editingErrorMessage,
|
|
5134
|
+
editingIcon,
|
|
5099
5135
|
editingIndex,
|
|
5100
5136
|
editingType,
|
|
5101
5137
|
editingValue,
|
|
5102
|
-
|
|
5138
|
+
focused,
|
|
5139
|
+
focusedIndex,
|
|
5140
|
+
height,
|
|
5103
5141
|
icons,
|
|
5104
|
-
useChevrons,
|
|
5105
|
-
dropTargets,
|
|
5106
|
-
editingIcon,
|
|
5107
5142
|
itemHeight,
|
|
5108
|
-
|
|
5143
|
+
items,
|
|
5144
|
+
maxLineY,
|
|
5145
|
+
minLineY,
|
|
5109
5146
|
root,
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
height,
|
|
5113
|
-
cutItems
|
|
5147
|
+
useChevrons,
|
|
5148
|
+
width
|
|
5114
5149
|
} = newState;
|
|
5115
5150
|
const visibleDirents = getVisibleExplorerItems(items, minLineY, maxLineY, focusedIndex, editingIndex, editingType, editingValue, editingErrorMessage, icons, useChevrons, dropTargets, editingIcon, cutItems);
|
|
5116
5151
|
const isWide = width > 450;
|
|
@@ -5300,8 +5335,8 @@ const renderEventListeners = () => {
|
|
|
5300
5335
|
preventDefault: true
|
|
5301
5336
|
}, {
|
|
5302
5337
|
name: HandlePointerDown,
|
|
5303
|
-
params: ['handlePointerDown', 'event.button', 'event.clientX', 'event.clientY']
|
|
5304
|
-
preventDefault: true
|
|
5338
|
+
params: ['handlePointerDown', 'event.button', 'event.clientX', 'event.clientY']
|
|
5339
|
+
// preventDefault: true,
|
|
5305
5340
|
}, {
|
|
5306
5341
|
name: HandleEditingInput,
|
|
5307
5342
|
params: ['updateEditingValue', 'event.target.value']
|
|
@@ -5328,9 +5363,11 @@ const renderEventListeners = () => {
|
|
|
5328
5363
|
name: HandleDragStart,
|
|
5329
5364
|
params: ['handleDragStart'],
|
|
5330
5365
|
// @ts-ignore
|
|
5331
|
-
dragInfo: {
|
|
5332
|
-
'text/
|
|
5333
|
-
|
|
5366
|
+
dragInfo: [{
|
|
5367
|
+
type: 'text/plain',
|
|
5368
|
+
data: 'https://example.com'
|
|
5369
|
+
}],
|
|
5370
|
+
dragEffect: 'copyMove'
|
|
5334
5371
|
}];
|
|
5335
5372
|
};
|
|
5336
5373
|
|