mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-10 05:29:08 +08:00
feature: 1. add TOC & adjust get eidtor style;
This commit is contained in:
@@ -9,7 +9,10 @@
|
||||
* 6. Dependencies between plugins are not supported for the time being
|
||||
*/
|
||||
import type { PatchNode } from '@toeverything/components/ui';
|
||||
import type { BlockFlavors } from '@toeverything/datasource/db-service';
|
||||
import type {
|
||||
BlockFlavors,
|
||||
ReturnEditorBlock,
|
||||
} from '@toeverything/datasource/db-service';
|
||||
import type { IdList, SelectionInfo, SelectionManager } from './selection';
|
||||
|
||||
import { Point } from '@toeverything/utils';
|
||||
@@ -67,6 +70,8 @@ export interface Virgo {
|
||||
) => Promise<AsyncBlock>;
|
||||
getRootBlockId: () => string;
|
||||
getBlockById(blockId: string): Promise<AsyncBlock | null>;
|
||||
getBlockByIds(blockId: string[]): Promise<(AsyncBlock | null)[]>;
|
||||
queryByPageId(pageId: string): Promise<(ReturnEditorBlock | null)[]>;
|
||||
setHotKeysScope(scope?: string): void;
|
||||
getBlockList: () => Promise<AsyncBlock[]>;
|
||||
getBlockListByLevelOrder: () => Promise<AsyncBlock[]>;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { atom, useAtom } from 'jotai';
|
||||
import { useEffect } from 'react';
|
||||
import { useLocation, useParams } from 'react-router-dom';
|
||||
// import { Virgo } from '@toeverything/components/editor-core';
|
||||
|
||||
@@ -14,12 +13,13 @@ export const useCurrentEditors = () => {
|
||||
const { pathname } = useLocation();
|
||||
const [currentEditors, setCurrentEditors] = useAtom(_currentEditors);
|
||||
|
||||
useEffect(() => {
|
||||
if (!workspaceId || !pageId) return;
|
||||
if (pathname.split('/').length >= 3) {
|
||||
setCurrentEditors({});
|
||||
}
|
||||
}, [pageId, pathname, setCurrentEditors, workspaceId]);
|
||||
/* not useful: 2022.8.25 */
|
||||
// useEffect(() => {
|
||||
// if (!workspaceId || !pageId) return;
|
||||
// if (pathname.split('/').length >= 3) {
|
||||
// setCurrentEditors({});
|
||||
// }
|
||||
// }, [pageId, pathname, setCurrentEditors, workspaceId]);
|
||||
|
||||
return {
|
||||
currentEditors,
|
||||
|
||||
Reference in New Issue
Block a user