@lvce-editor/explorer-view 6.7.0 → 6.8.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.
@@ -1563,11 +1563,22 @@ const getIndex = (dirents, uri) => {
1563
1563
  return -1;
1564
1564
  };
1565
1565
 
1566
- const getParentFolder = (dirents, index, root) => {
1566
+ const isFileLike = type => {
1567
+ return type === File || type === SymLinkFile;
1568
+ };
1569
+ const getParentFolder = (dirents, index, root, pathSeparator) => {
1567
1570
  if (index < 0) {
1568
1571
  return root;
1569
1572
  }
1570
- return dirents[index].path;
1573
+ const item = dirents[index];
1574
+ if (!item) {
1575
+ return root;
1576
+ }
1577
+ if (isFileLike(item.type)) {
1578
+ const parentFolder = dirname(pathSeparator, item.path);
1579
+ return parentFolder || root;
1580
+ }
1581
+ return item.path;
1571
1582
  };
1572
1583
 
1573
1584
  const getPathParts = (root, uri, pathSeparator) => {
@@ -2008,7 +2019,7 @@ const acceptCreate = async (state, newDirentType) => {
2008
2019
  editingErrorMessage
2009
2020
  };
2010
2021
  }
2011
- const parentFolder = getParentFolder(items, focusedIndex, root);
2022
+ const parentFolder = getParentFolder(items, focusedIndex, root, pathSeparator);
2012
2023
  const absolutePath = join2(parentFolder, newFileName);
2013
2024
  const operations = getFileOperationsCreate(editingValue, newDirentType, pathSeparator, absolutePath, root);
2014
2025
  const createErrorMessage = await applyFileOperations(operations);
@@ -4368,6 +4379,10 @@ const handleContextMenu = async (state, button, x, y) => {
4368
4379
  return newState;
4369
4380
  };
4370
4381
 
4382
+ const handleContextMenuWelcome = state => {
4383
+ return state;
4384
+ };
4385
+
4371
4386
  const handleCopy = async state => {
4372
4387
  // TODO handle multiple files
4373
4388
  // TODO if not file is selected, what happens?
@@ -5975,6 +5990,7 @@ const HandleButtonClick = 18;
5975
5990
  const HandleClick = 1;
5976
5991
  const HandleClickOpenFolder = 2;
5977
5992
  const HandleContextMenu = 3;
5993
+ const HandleContextMenuWelcome = 20;
5978
5994
  const HandleDragEnd = 19;
5979
5995
  const HandleDragLeave = 4;
5980
5996
  const HandleDragOver = 5;
@@ -5997,6 +6013,7 @@ const getExplorerWelcomeVirtualDom = (isWide, dropTargets) => {
5997
6013
  return [{
5998
6014
  childCount: 1,
5999
6015
  className: getClassName$1(dropTargets),
6016
+ onContextMenu: HandleContextMenuWelcome,
6000
6017
  onDragLeave: HandleDragLeave,
6001
6018
  onDragOver: HandleDragOver,
6002
6019
  onDrop: HandleDrop,
@@ -6488,6 +6505,10 @@ const renderEventListeners = () => {
6488
6505
  name: HandleContextMenu,
6489
6506
  params: ['handleContextMenu', Button$3, ClientX, ClientY],
6490
6507
  preventDefault: true
6508
+ }, {
6509
+ name: HandleContextMenuWelcome,
6510
+ params: ['handleContextMenuWelcome'],
6511
+ preventDefault: true
6491
6512
  }, {
6492
6513
  name: HandleWheel,
6493
6514
  params: ['handleWheel', DeltaMode, DeltaY],
@@ -6849,6 +6870,7 @@ const commandMap = {
6849
6870
  'Explorer.handleClickOpenFolder': wrapListItemCommand(handleClickOpenFolder),
6850
6871
  'Explorer.handleContextMenu': wrapListItemCommand(handleContextMenu),
6851
6872
  'Explorer.handleContextMenuKeyboard': wrapListItemCommand(handleContextMenuKeyboard),
6873
+ 'Explorer.handleContextMenuWelcome': wrapListItemCommand(handleContextMenuWelcome),
6852
6874
  'Explorer.handleCopy': wrapListItemCommand(handleCopy),
6853
6875
  'Explorer.handleCut': wrapListItemCommand(handleCut),
6854
6876
  'Explorer.handleDoubleClick': wrapListItemCommand(handleDoubleClick),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/explorer-view",
3
- "version": "6.7.0",
3
+ "version": "6.8.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",