Просмотр исходного кода

fix(Navbar): add setEditorMode to GrowiContextualSubNavigation

Yuki Takei 1 день назад
Родитель
Сommit
5ba6993dcb
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      apps/app/src/client/components/Navbar/GrowiContextualSubNavigation.tsx

+ 4 - 2
apps/app/src/client/components/Navbar/GrowiContextualSubNavigation.tsx

@@ -47,7 +47,7 @@ import {
   isUploadEnabledAtom,
   isUploadEnabledAtom,
 } from '~/states/server-configurations';
 } from '~/states/server-configurations';
 import { useDeviceLargerThanMd } from '~/states/ui/device';
 import { useDeviceLargerThanMd } from '~/states/ui/device';
-import { useEditorMode } from '~/states/ui/editor';
+import { EditorMode, useEditorMode } from '~/states/ui/editor';
 import {
 import {
   PageAccessoriesModalContents,
   PageAccessoriesModalContents,
   usePageAccessoriesModalActions,
   usePageAccessoriesModalActions,
@@ -323,7 +323,7 @@ const GrowiContextualSubNavigation = (
   const revisionId =
   const revisionId =
     revision != null && isPopulated(revision) ? revision._id : undefined;
     revision != null && isPopulated(revision) ? revision._id : undefined;
 
 
-  const { editorMode } = useEditorMode();
+  const { editorMode, setEditorMode } = useEditorMode();
   const pageId = useCurrentPageId(true);
   const pageId = useCurrentPageId(true);
   const currentUser = useCurrentUser();
   const currentUser = useCurrentUser();
   const isGuestUser = useIsGuestUser();
   const isGuestUser = useIsGuestUser();
@@ -390,6 +390,7 @@ const GrowiContextualSubNavigation = (
 
 
         if (isCompletely) {
         if (isCompletely) {
           // redirect to NotFound Page
           // redirect to NotFound Page
+          setEditorMode(EditorMode.View);
           router.push(path);
           router.push(path);
         } else if (currentPathname != null) {
         } else if (currentPathname != null) {
           router.push(currentPathname);
           router.push(currentPathname);
@@ -408,6 +409,7 @@ const GrowiContextualSubNavigation = (
       openDeleteModal,
       openDeleteModal,
       router,
       router,
       mutatePageInfo,
       mutatePageInfo,
+      setEditorMode,
     ],
     ],
   );
   );