Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix: add patch doc mode service (#7249)

akumatus4edf0b1d857e
diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-editor/lit-adaper.tsx b/packages/frontend/core/src/components/blocksuite/block-suite-editor/lit-adaper.tsx
index f1d40544bb..cfe718e54b 100644
--- a/packages/frontend/core/src/components/blocksuite/block-suite-editor/lit-adaper.tsx
+++ b/packages/frontend/core/src/components/blocksuite/block-suite-editor/lit-adaper.tsx
@@ -15,7 +15,13 @@ import {
PageEditor,
} from '@blocksuite/presets';
import type { Doc } from '@blocksuite/store';
-import { type DocMode, useLiveData, useService } from '@toeverything/infra';
+import {
+ type DocMode,
+ DocService,
+ DocsService,
+ useLiveData,
+ useService,
+} from '@toeverything/infra';
import React, {
forwardRef,
Fragment,
@@ -30,6 +36,7 @@ import { PagePropertiesTable } from '../../affine/page-properties';
import { AffinePageReference } from '../../affine/reference-link';
import { BlocksuiteEditorJournalDocTitle } from './journal-doc-title';
import {
+ patchDocModeService,
patchForSharedPage,
patchNotificationService,
patchPeekViewService,
@@ -73,6 +80,8 @@ const usePatchSpecs = (page: Doc, shared: boolean, mode: DocMode) => {
const [reactToLit, portals] = useLitPortalFactory();
const peekViewService = useService(PeekViewService);
const quickSearchService = useService(QuickSearchService);
+ const docService = useService(DocService);
+ const docsService = useService(DocsService);
const referenceRenderer: ReferenceReactRenderer = useMemo(() => {
return function customReference(reference) {
const pageId = reference.delta.attributes?.reference?.pageId;
@@ -101,9 +110,12 @@ const usePatchSpecs = (page: Doc, shared: boolean, mode: DocMode) => {
if (shared) {
patched = patchForSharedPage(patched);
}
+ patched = patchDocModeService(patched, docService, docsService);
return patched;
}, [
confirmModal,
+ docService,
+ docsService,
page.readonly,
peekViewService,
quickSearchService,