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

Merge pull request #3146 from weseek/fix/do-not-work-short-cut-key-e-in-case-of-could-not-create-page

fix
Yuki Takei 5 лет назад
Родитель
Сommit
4a24a37eef
1 измененных файлов с 9 добавлено и 0 удалено
  1. 9 0
      src/client/js/services/NavigationContainer.js

+ 9 - 0
src/client/js/services/NavigationContainer.js

@@ -52,6 +52,9 @@ export default class NavigationContainer extends Container {
     return 'NavigationContainer';
   }
 
+  getPageContainer() {
+    return this.appContainer.getContainer('PageContainer');
+  }
 
   initDeviceSize() {
     const mdOrAvobeHandler = async(mql) => {
@@ -89,12 +92,18 @@ export default class NavigationContainer extends Container {
   }
 
   setEditorMode(editorMode) {
+    const { isNotCreatable } = this.getPageContainer().state;
 
     if (this.appContainer.currentUser == null) {
       logger.warn('Please login or signup to edit the page or use hackmd.');
       return;
     }
 
+    if (isNotCreatable) {
+      logger.warn('This page could not edit.');
+      return;
+    }
+
     this.setState({ editorMode });
     if (editorMode === 'view') {
       $('body').removeClass('on-edit');