|
@@ -8,6 +8,7 @@ import {getAssetName, getDisplayName, pathPosix, setNotebookName} from "../util/
|
|
|
import {fetchPost} from "../util/fetch";
|
|
|
import {Constants} from "../constants";
|
|
|
import {showTooltip} from "../dialog/tooltip";
|
|
|
+import {getAllEditor, getAllModels} from "../layout/getAll";
|
|
|
|
|
|
export const validateName = (name: string, targetElement?: HTMLElement) => {
|
|
|
if (/\r\n|\r|\n|\u2028|\u2029|\t|\//.test(name)) {
|
|
@@ -132,7 +133,17 @@ export const renameAsset = (assetPath: string) => {
|
|
|
dialog.destroy();
|
|
|
return false;
|
|
|
}
|
|
|
- fetchPost("/api/asset/renameAsset", {oldPath: assetPath, newName: inputElement.value});
|
|
|
+
|
|
|
+ fetchPost("/api/asset/renameAsset", {oldPath: assetPath, newName: inputElement.value}, (response) => {
|
|
|
+ getAllModels().asset.forEach(item => {
|
|
|
+ if (item.path === assetPath) {
|
|
|
+ item.parent.updateTitle(getDisplayName(response.data.newPath));
|
|
|
+ }
|
|
|
+ })
|
|
|
+ getAllEditor().forEach(item => {
|
|
|
+ item.reload(false);
|
|
|
+ })
|
|
|
+ });
|
|
|
});
|
|
|
};
|
|
|
|