Skip to content

Commit

Permalink
Fixed folder move and rename while files inside it are opened
Browse files Browse the repository at this point in the history
  • Loading branch information
StanZGenchev committed Nov 16, 2023
1 parent 5fef554 commit 3b9ac4c
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ projectsView.controller('ProjectsViewController', [
for (let i = 0; i < result.data.files.length; i++) {
messageHub.announceFileMoved({
name: result.data.files[i].substring(result.data.files[i].lastIndexOf('/') + 1, result.data.files[i].length),
path: result.data.files[i].replace(oldPath, moveObj.node.data.path),
oldPath: result.data.files[i],
path: result.data.files[i].replace(`/${moveObj.node.data.workspace}`, '').replace(oldPath, moveObj.node.data.path),
oldPath: result.data.files[i].replace(`/${moveObj.node.data.workspace}`, ''),
workspace: moveObj.node.data.workspace,
});
}
Expand Down Expand Up @@ -1794,16 +1794,19 @@ projectsView.controller('ProjectsViewController', [
}
});
} else {
messageHub.getCurrentlyOpenedFiles(`/${$scope.renameNodeData.data.workspace}${$scope.renameNodeData.data.path}`).then(function (result) {
for (let i = 0; i < result.data.files.length; i++) {
messageHub.announceFileMoved({
name: result.data.files[i].substring(result.data.files[i].lastIndexOf('/') + 1, result.data.files[i].length),
path: result.data.files[i].replace(`/${$scope.renameNodeData.data.workspace}`, '').replace($scope.renameNodeData.data.path, guessedPath),
oldPath: result.data.files[i].replace(`/${$scope.renameNodeData.data.workspace}`, ''),
workspace: $scope.renameNodeData.data.workspace,
});
}
});
for (let i = 0; i < $scope.renameNodeData.children_d.length; i++) {
let child = $scope.jstreeWidget.jstree(true).get_node($scope.renameNodeData.children_d[i]);
const oldPath = child.data.path;
child.data.path = guessedPath + child.data.path.substring($scope.renameNodeData.data.path.length);
messageHub.announceFileMoved({
name: child.text,
path: child.data.path,
oldPath: oldPath,
workspace: child.data.workspace,
});
}
node.text = msg.data.formData[0].value;
node.data.path = guessedPath;
Expand Down

0 comments on commit 3b9ac4c

Please sign in to comment.