mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
refactor(editor): set readonly (#9475)
This commit is contained in:
@@ -169,7 +169,7 @@ export const useSnapshotPage = (
|
||||
page = historyShellWorkspace.createDoc({
|
||||
id: pageId,
|
||||
});
|
||||
page.awarenessStore.setReadonly(page.blockCollection, true);
|
||||
page.readonly = true;
|
||||
const spaceDoc = page.spaceDoc;
|
||||
page.load(() => {
|
||||
applyUpdate(spaceDoc, new Uint8Array(snapshot));
|
||||
|
||||
@@ -56,11 +56,8 @@ export function useDocMetaHelper() {
|
||||
const setDocReadonly = useCallback(
|
||||
(docId: string, readonly: boolean) => {
|
||||
const doc = workspaceService.workspace.docCollection.getDoc(docId);
|
||||
if (doc?.blockCollection) {
|
||||
workspaceService.workspace.docCollection.awarenessStore.setReadonly(
|
||||
doc.blockCollection,
|
||||
readonly
|
||||
);
|
||||
if (doc) {
|
||||
doc.readonly = readonly;
|
||||
}
|
||||
},
|
||||
[workspaceService]
|
||||
|
||||
Reference in New Issue
Block a user