mirror of
https://github.com/toeverything/AFFiNE.git
synced 2025-01-08 10:07:14 +03:00
fix: add patch doc mode service (#7249)
This commit is contained in:
parent
96df708e3a
commit
4edf0b1d85
@ -15,7 +15,13 @@ import {
|
|||||||
PageEditor,
|
PageEditor,
|
||||||
} from '@blocksuite/presets';
|
} from '@blocksuite/presets';
|
||||||
import type { Doc } from '@blocksuite/store';
|
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, {
|
import React, {
|
||||||
forwardRef,
|
forwardRef,
|
||||||
Fragment,
|
Fragment,
|
||||||
@ -30,6 +36,7 @@ import { PagePropertiesTable } from '../../affine/page-properties';
|
|||||||
import { AffinePageReference } from '../../affine/reference-link';
|
import { AffinePageReference } from '../../affine/reference-link';
|
||||||
import { BlocksuiteEditorJournalDocTitle } from './journal-doc-title';
|
import { BlocksuiteEditorJournalDocTitle } from './journal-doc-title';
|
||||||
import {
|
import {
|
||||||
|
patchDocModeService,
|
||||||
patchForSharedPage,
|
patchForSharedPage,
|
||||||
patchNotificationService,
|
patchNotificationService,
|
||||||
patchPeekViewService,
|
patchPeekViewService,
|
||||||
@ -73,6 +80,8 @@ const usePatchSpecs = (page: Doc, shared: boolean, mode: DocMode) => {
|
|||||||
const [reactToLit, portals] = useLitPortalFactory();
|
const [reactToLit, portals] = useLitPortalFactory();
|
||||||
const peekViewService = useService(PeekViewService);
|
const peekViewService = useService(PeekViewService);
|
||||||
const quickSearchService = useService(QuickSearchService);
|
const quickSearchService = useService(QuickSearchService);
|
||||||
|
const docService = useService(DocService);
|
||||||
|
const docsService = useService(DocsService);
|
||||||
const referenceRenderer: ReferenceReactRenderer = useMemo(() => {
|
const referenceRenderer: ReferenceReactRenderer = useMemo(() => {
|
||||||
return function customReference(reference) {
|
return function customReference(reference) {
|
||||||
const pageId = reference.delta.attributes?.reference?.pageId;
|
const pageId = reference.delta.attributes?.reference?.pageId;
|
||||||
@ -101,9 +110,12 @@ const usePatchSpecs = (page: Doc, shared: boolean, mode: DocMode) => {
|
|||||||
if (shared) {
|
if (shared) {
|
||||||
patched = patchForSharedPage(patched);
|
patched = patchForSharedPage(patched);
|
||||||
}
|
}
|
||||||
|
patched = patchDocModeService(patched, docService, docsService);
|
||||||
return patched;
|
return patched;
|
||||||
}, [
|
}, [
|
||||||
confirmModal,
|
confirmModal,
|
||||||
|
docService,
|
||||||
|
docsService,
|
||||||
page.readonly,
|
page.readonly,
|
||||||
peekViewService,
|
peekViewService,
|
||||||
quickSearchService,
|
quickSearchService,
|
||||||
|
Loading…
Reference in New Issue
Block a user