@syncfusion/ej2-filemanager 26.2.5 → 26.2.10

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.
@@ -2914,11 +2914,17 @@ function createAjax(parent, data, fn, event, operation, targetPath) {
2914
2914
  const action = getValue('action', data);
2915
2915
  const isFileOperation = (action === 'move' || action === 'rename' || action === 'copy' || action === 'delete' || action === 'search') && event !== 'rename-end';
2916
2916
  if (action === 'read' || action === 'create' || event === 'rename-end') {
2917
+ const rootId = parent.fileSystemData
2918
+ .filter((item) => isNullOrUndefined(item.parentId))
2919
+ .length > 0
2920
+ ? parent.fileSystemData
2921
+ .filter((item) => isNullOrUndefined(item.parentId))[0].id
2922
+ : 0;
2917
2923
  parent.responseData = {
2918
- cwd: filterById(parent, parent.path === '/' && event !== 'node-expand' && event !== 'rename-end-parent' ? 0 : idValue),
2924
+ cwd: filterById(parent, parent.path === '/' && event !== 'node-expand' && event !== 'rename-end-parent' ? rootId : idValue),
2919
2925
  details: null,
2920
2926
  error: null,
2921
- files: filterByParent(parent, parent.path === '/' && event !== 'node-expand' && event !== 'rename-end-parent' ? 0 : idValue)
2927
+ files: filterByParent(parent, parent.path === '/' && event !== 'node-expand' && event !== 'rename-end-parent' ? rootId : idValue)
2922
2928
  };
2923
2929
  if (isNullOrUndefined(parent.responseData.cwd)) {
2924
2930
  const message = 'Cannot load empty data within the File Manager.';
@@ -3142,19 +3148,33 @@ function triggerAjaxFailure(parent, beforeSendArgs, fn, result, event, operation
3142
3148
  * @private
3143
3149
  */
3144
3150
  function readSuccess(parent, result, event) {
3145
- if (!isNullOrUndefined(result.files)) {
3146
- parent.notify(event, result);
3147
- parent.notify(selectionChanged, {});
3148
- const args = { action: 'read', result: result };
3149
- parent.trigger('success', args);
3150
- }
3151
- else {
3152
- if (result.error.code === '401') {
3153
- result.files = [];
3151
+ try {
3152
+ if (!isNullOrUndefined(result.files)) {
3154
3153
  parent.notify(event, result);
3155
3154
  parent.notify(selectionChanged, {});
3155
+ const args = { action: 'read', result: result };
3156
+ parent.trigger('success', args);
3156
3157
  }
3157
- onFailure(parent, result, 'read');
3158
+ else {
3159
+ if (!isNullOrUndefined(result.error) && result.error.code === '401') {
3160
+ result.files = [];
3161
+ parent.notify(event, result);
3162
+ parent.notify(selectionChanged, {});
3163
+ }
3164
+ onFailure(parent, result, 'read');
3165
+ parent.setProperties({ path: parent.oldPath }, true);
3166
+ parent.pathNames.pop();
3167
+ }
3168
+ }
3169
+ catch (error) {
3170
+ const errorResult = {
3171
+ files: null,
3172
+ error: {
3173
+ message: error.message,
3174
+ fileExists: null
3175
+ }
3176
+ };
3177
+ onFailure(parent, errorResult, 'read');
3158
3178
  parent.setProperties({ path: parent.oldPath }, true);
3159
3179
  parent.pathNames.pop();
3160
3180
  }
@@ -6642,6 +6662,9 @@ class ContextMenu {
6642
6662
  }
6643
6663
  else if (closest(target, '#' + this.parent.element.id + TREE_ID)) {
6644
6664
  uid = closest(target, 'li').getAttribute('data-uid');
6665
+ if (!isNullOrUndefined(uid)) {
6666
+ this.parent.navigationpaneModule.treeObj.selectedNodes = [uid];
6667
+ }
6645
6668
  treeFolder = true;
6646
6669
  }
6647
6670
  /* istanbul ignore next */
@@ -6899,12 +6922,7 @@ class ContextMenu {
6899
6922
  break;
6900
6923
  case 'paste':
6901
6924
  if (this.menuType === 'folder') {
6902
- if ((this.parent.activeModule === 'largeiconsview') || (this.parent.activeModule === 'detailsview')) {
6903
- this.parent.folderPath = getFullPath(this.parent, this.menuItemData, this.parent.path);
6904
- }
6905
- else {
6906
- this.parent.folderPath = '';
6907
- }
6925
+ this.parent.folderPath = getFullPath(this.parent, this.menuItemData, this.parent.path);
6908
6926
  }
6909
6927
  else {
6910
6928
  this.parent.folderPath = '';