mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-17 22:37:04 +08:00
fix(editor): ref on click slots should not be global (#9830)
fix AF-2129
This commit is contained in:
@@ -30,7 +30,10 @@ import { pageHistoryModalAtom } from '../../../components/atoms/page-history';
|
||||
import { useBlockSuiteMetaHelper } from './use-block-suite-meta-helper';
|
||||
import { useExportPage } from './use-export-page';
|
||||
|
||||
export function useRegisterBlocksuiteEditorCommands(editor: Editor) {
|
||||
export function useRegisterBlocksuiteEditorCommands(
|
||||
editor: Editor,
|
||||
active: boolean
|
||||
) {
|
||||
const doc = useService(DocService).doc;
|
||||
const docId = doc.id;
|
||||
const mode = useLiveData(editor.mode$);
|
||||
@@ -82,6 +85,10 @@ export function useRegisterBlocksuiteEditorCommands(editor: Editor) {
|
||||
const openInAppService = useServiceOptional(OpenInAppService);
|
||||
|
||||
useEffect(() => {
|
||||
if (!active) {
|
||||
return;
|
||||
}
|
||||
|
||||
const unsubs: Array<() => void> = [];
|
||||
const preconditionStrategy = () =>
|
||||
PreconditionStrategy.InPaperOrEdgeless && !trash;
|
||||
@@ -375,5 +382,6 @@ export function useRegisterBlocksuiteEditorCommands(editor: Editor) {
|
||||
defaultPageWidth,
|
||||
checked,
|
||||
openInAppService,
|
||||
active,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,9 @@ export function useRegisterCopyLinkCommands({
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!isActiveView) {
|
||||
return;
|
||||
}
|
||||
const unsubs: Array<() => void> = [];
|
||||
|
||||
unsubs.push(
|
||||
|
||||
Reference in New Issue
Block a user