feature: 1. add TOC & adjust get eidtor style;

This commit is contained in:
mitsuha
2022-08-25 11:22:44 +08:00
parent 16a99c7507
commit 637a03ae1d
5 changed files with 25 additions and 34 deletions
+7 -7
View File
@@ -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,