mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-22 19:53:48 +08:00
fix: view in edgeless button of surface block (#6013)
Co-authored-by: donteatfriedrice <huisheng.chen7788@outlook.com> Co-authored-by: Chen <99816898+donteatfriedrice@users.noreply.github.com>
This commit is contained in:
co-authored by
donteatfriedrice
Chen
parent
ebf7a74387
commit
b06aeb22dd
@@ -9,6 +9,7 @@ import {
|
|||||||
EmbedYoutubeService,
|
EmbedYoutubeService,
|
||||||
ImageService,
|
ImageService,
|
||||||
} from '@blocksuite/blocks';
|
} from '@blocksuite/blocks';
|
||||||
|
import { DisposableGroup } from '@blocksuite/global/utils';
|
||||||
import type { AffineEditorContainer } from '@blocksuite/presets';
|
import type { AffineEditorContainer } from '@blocksuite/presets';
|
||||||
import type { Doc as BlockSuiteDoc } from '@blocksuite/store';
|
import type { Doc as BlockSuiteDoc } from '@blocksuite/store';
|
||||||
import {
|
import {
|
||||||
@@ -134,6 +135,8 @@ const DetailPageImpl = memo(function DetailPageImpl() {
|
|||||||
|
|
||||||
// provide page mode and updated date to blocksuite
|
// provide page mode and updated date to blocksuite
|
||||||
const pageService = editorHost.std.spec.getService('affine:page');
|
const pageService = editorHost.std.spec.getService('affine:page');
|
||||||
|
const disposable = new DisposableGroup();
|
||||||
|
|
||||||
pageService.getEditorMode = (pageId: string) =>
|
pageService.getEditorMode = (pageId: string) =>
|
||||||
pageRecordList.record(pageId).value?.mode.value ?? 'page';
|
pageRecordList.record(pageId).value?.mode.value ?? 'page';
|
||||||
pageService.getDocUpdatedAt = (pageId: string) => {
|
pageService.getDocUpdatedAt = (pageId: string) => {
|
||||||
@@ -147,18 +150,26 @@ const DetailPageImpl = memo(function DetailPageImpl() {
|
|||||||
|
|
||||||
page.setMode(mode);
|
page.setMode(mode);
|
||||||
// fixme: it seems pageLinkClicked is not triggered sometimes?
|
// fixme: it seems pageLinkClicked is not triggered sometimes?
|
||||||
const dispose = editor.slots.docLinkClicked.on(({ docId }) => {
|
disposable.add(
|
||||||
return openPage(blockSuiteWorkspace.id, docId);
|
editor.slots.docLinkClicked.on(({ docId }) => {
|
||||||
});
|
return openPage(blockSuiteWorkspace.id, docId);
|
||||||
const disposeTagClick = editor.slots.tagClicked.on(({ tagId }) => {
|
})
|
||||||
jumpToTag(currentWorkspace.id, tagId);
|
);
|
||||||
});
|
disposable.add(
|
||||||
|
editor.slots.tagClicked.on(({ tagId }) => {
|
||||||
|
jumpToTag(currentWorkspace.id, tagId);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
disposable.add(
|
||||||
|
pageService.slots.editorModeSwitch.on(mode => {
|
||||||
|
page.setMode(mode);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
setEditor(editor);
|
setEditor(editor);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
dispose.dispose();
|
disposable.dispose();
|
||||||
disposeTagClick.dispose();
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
|
|||||||
Reference in New Issue
Block a user