@lvce-editor/explorer-view 7.24.1 → 7.25.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.
@@ -4873,7 +4873,16 @@ const getNewDirentsForNewDirent = async (items, focusedIndex, type, root, exclud
4873
4873
  // Create new array with updated items
4874
4874
  const parentIndex = focusedIndex;
4875
4875
  const itemsBeforeParent = items.slice(0, parentIndex);
4876
- const itemsAfterChildren = items.slice(parentIndex + updatedChildren.length);
4876
+ const parentEndIndex = getParentEndIndex(items, parentIndex);
4877
+ const existingDescendants = items.slice(parentIndex + 1, parentEndIndex);
4878
+ let childIndex = 0;
4879
+ for (let i = 0; i < existingDescendants.length; i++) {
4880
+ if (existingDescendants[i].depth === depth) {
4881
+ existingDescendants[i] = updatedChildren[childIndex++];
4882
+ }
4883
+ }
4884
+ const newChildren = existingDescendants.length === 0 ? updatedChildren : [...existingDescendants, updatedChildren.at(-1)];
4885
+ const itemsAfterChildren = items.slice(parentEndIndex);
4877
4886
  let updatedParent = {
4878
4887
  ...items[parentIndex],
4879
4888
  setSize: (items[parentIndex]?.setSize || 0) + 1
@@ -4886,7 +4895,7 @@ const getNewDirentsForNewDirent = async (items, focusedIndex, type, root, exclud
4886
4895
  type: DirectoryExpanded
4887
4896
  };
4888
4897
  }
4889
- return [...itemsBeforeParent, updatedParent, ...updatedChildren, ...itemsAfterChildren];
4898
+ return [...itemsBeforeParent, updatedParent, ...newChildren, ...itemsAfterChildren];
4890
4899
  };
4891
4900
 
4892
4901
  const getNewDirentType = editingType => {
@@ -6529,7 +6538,7 @@ const set = rpc => {
6529
6538
  state.connected = true;
6530
6539
  };
6531
6540
 
6532
- const handleMessagePort = async (port, viewletCommandMap) => {
6541
+ const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess = true) => {
6533
6542
  const executeViewletCommand = async (uid, command, ...args) => {
6534
6543
  const fn = viewletCommandMap[`Explorer.${command}`];
6535
6544
  if (typeof fn !== 'function') {
@@ -6544,7 +6553,9 @@ const handleMessagePort = async (port, viewletCommandMap) => {
6544
6553
  },
6545
6554
  messagePort: port
6546
6555
  });
6547
- set(rpc);
6556
+ if (setAsRendererProcess) {
6557
+ set(rpc);
6558
+ }
6548
6559
  };
6549
6560
 
6550
6561
  const scrollInto = (index, minLineY, maxLineY) => {
@@ -8336,7 +8347,7 @@ const updateEditingValue = async (state, value, inputSource = User) => {
8336
8347
  };
8337
8348
  };
8338
8349
 
8339
- const handleDirectMessagePort = port => handleMessagePort(port, commandMap);
8350
+ const handleDirectMessagePort = (port, setAsRendererProcess) => handleMessagePort(port, commandMap, setAsRendererProcess);
8340
8351
  const commandMap = {
8341
8352
  'Explorer.acceptEdit': wrapListItemCommand(acceptEdit),
8342
8353
  'Explorer.cancelEdit': wrapListItemCommand(cancelEdit),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/explorer-view",
3
- "version": "7.24.1",
3
+ "version": "7.25.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",