feat: add readonly status in trash

This commit is contained in:
QiShaoXuan
2022-12-16 00:09:21 +08:00
parent fe58ca6d8b
commit 09ed481dc8
2 changed files with 12 additions and 0 deletions
@@ -113,6 +113,11 @@ const EditorReactor = ({
editor.mode = pageMeta.mode; editor.mode = pageMeta.mode;
} }
if (pageMeta?.trash) {
// @ts-ignore
editor.readonly = true;
}
setEditor(editor); setEditor(editor);
}, [workspace, currentPage, setEditor]); }, [workspace, currentPage, setEditor]);
@@ -42,6 +42,13 @@ export const useEditorHandler = ({
trash: !pageMeta.trash, trash: !pageMeta.trash,
trashDate: +new Date(), trashDate: +new Date(),
}); });
if (pageMeta.trash) {
toast('Removed to trash');
const editor = document.querySelector('editor-container');
// @ts-ignore
editor?.setAttribute('readonly', 'false');
}
} }
}, },
permanentlyDeletePage: pageId => { permanentlyDeletePage: pageId => {