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

Merge branch 'master' into fix/search-page-scroll-for-chrome

ryoji-s 3 лет назад
Родитель
Сommit
5ba9163fc3
1 измененных файлов с 6 добавлено и 2 удалено
  1. 6 2
      packages/app/src/components/PageCreateModal.jsx

+ 6 - 2
packages/app/src/components/PageCreateModal.jsx

@@ -13,6 +13,7 @@ import { debounce } from 'throttle-debounce';
 import { toastError } from '~/client/util/apiNotification';
 import { useCurrentUser, useIsSearchServiceReachable } from '~/stores/context';
 import { usePageCreateModal } from '~/stores/modal';
+import { EditorMode, useEditorMode } from '~/stores/ui';
 
 import PagePathAutoComplete from './PagePathAutoComplete';
 
@@ -36,6 +37,8 @@ const PageCreateModal = () => {
   const pageNameInputInitialValue = isCreatable ? pathUtils.addTrailingSlash(pathname) : '/';
   const now = format(new Date(), 'yyyy/MM/dd');
 
+  const { mutate: mutateEditorMode } = useEditorMode();
+
   const [todayInput1, setTodayInput1] = useState(t('Memo'));
   const [todayInput2, setTodayInput2] = useState('');
   const [pageNameInput, setPageNameInput] = useState(pageNameInputInitialValue);
@@ -99,8 +102,9 @@ const PageCreateModal = () => {
    */
   async function redirectToEditor(...paths) {
     try {
-      const editorPath = await generateEditorPath(...paths);
-      router.push(editorPath);
+      const editorPath = generateEditorPath(...paths);
+      await router.push(editorPath);
+      mutateEditorMode(EditorMode.Editor);
 
       // close modal
       closeCreateModal();