فهرست منبع

BugFix: check pageEditorDom is defined (should abort when admin page)

Yuki Takei 8 سال پیش
والد
کامیت
b79b5374c1
1فایلهای تغییر یافته به همراه9 افزوده شده و 1 حذف شده
  1. 9 1
      resource/js/legacy/crowi.js

+ 9 - 1
resource/js/legacy/crowi.js

@@ -71,11 +71,19 @@ Crowi.setCaretLineData = function(line) {
 }
 }
 
 
 /**
 /**
- * invoked when 'shown.bs.tab' event fired
+ * invoked when;
+ *
+ * 1. window loaded
+ * 2. 'shown.bs.tab' event fired
  */
  */
 Crowi.setCaretLineAndFocusToEditor = function() {
 Crowi.setCaretLineAndFocusToEditor = function() {
   // get 'data-caret-line' attributes
   // get 'data-caret-line' attributes
   const pageEditorDom = document.querySelector('#page-editor');
   const pageEditorDom = document.querySelector('#page-editor');
+
+  if (pageEditorDom == null) {
+    return;
+  }
+
   const line = pageEditorDom.getAttribute('data-caret-line');
   const line = pageEditorDom.getAttribute('data-caret-line');
 
 
   if (line != null) {
   if (line != null) {