Parcourir la source

add boolean for edit mode

kaori il y a 5 ans
Parent
commit
27e7d7a31d

+ 5 - 2
src/client/js/legacy/crowi.js

@@ -200,13 +200,16 @@ $(() => {
 });
 
 window.addEventListener('load', (e) => {
-  const { appContainer } = window;
+  const { appContainer, pageContainer } = window;
+  const {
+    isPageExist, isPageForbidden, isNotCreatable, isTrashPage,
+  } = pageContainer.state;
 
   // hash on page
   if (window.location.hash) {
     const navigationContainer = appContainer.getContainer('NavigationContainer');
 
-    if (window.location.hash === '#edit') {
+    if (window.location.hash === '#edit' && isPageExist && !isPageForbidden && !isNotCreatable && !isTrashPage) {
       navigationContainer.setEditorMode('edit');
 
       // focus

+ 1 - 1
src/server/views/widget/not_creatable_content.html

@@ -1,4 +1,4 @@
-<div class="row not-found-message-row m-2">
+<div class="row not-found-message-row">
   <div class="col-md-12">
     <h2 class="text-muted">
       <i class="icon-ban" aria-hidden="true"></i>