This commit is contained in:
parent
1a2eea3d20
commit
414f57a7e1
1 changed files with 12 additions and 1 deletions
|
@ -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);
|
||||
})
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue