Auto-refresh images on edit

Only for Markdown images, not drawing blocks, since those will eventually be deprecated.
This commit is contained in:
MassiveBox 2025-04-03 15:51:33 +02:00
parent 5e51589ffa
commit e9a9961b61
Signed by: massivebox
GPG key ID: 9B74D3A59181947D
4 changed files with 33 additions and 5 deletions

View file

@ -5,6 +5,7 @@ import 'js-draw/styles';
import {getFile, saveFile} from "@/file";
import {DATA_PATH, JSON_MIME, SVG_MIME, TOOLBAR_PATH} from "@/const";
import {idToPath} from "@/helper";
import {replaceAntiCacheID} from "@/protyle";
export function openEditorTab(p: Plugin, path: string) {
openTab({
@ -22,6 +23,7 @@ async function saveCallback(editor: Editor, path: string, saveButton: BaseWidget
const svgElem = editor.toSVG();
try {
saveFile(DATA_PATH + path, SVG_MIME, svgElem.outerHTML);
await replaceAntiCacheID(path);
saveButton.setDisabled(true);
setTimeout(() => { // @todo improve save button feedback
saveButton.setDisabled(false);