ソースを参照

Merge pull request #120 from weseek/master

release v1.2.14
Yuki Takei 8 年 前
コミット
a6d00a7a5a
3 ファイル変更18 行追加7 行削除
  1. 6 3
      CHANGES.md
  2. 1 1
      package.json
  3. 11 3
      resource/js/legacy/crowi.js

+ 6 - 3
CHANGES.md

@@ -1,15 +1,18 @@
 CHANGES
 ========
 
-## 1.2.13
+## 1.2.14
 
-* Fix: The problem when disabling pushing states with History API when tabs changes 
+* Fix: Tabs(`a[data-toggle="tab"][href="#..."]`) push browser history twice
+* Fix: `a[href="#edit-form"]` still save history even when disabling pushing states option
 
-## 1.2.12
+## 1.2.13
 
 * Improvement: Enabled to switch whether to push states with History API when tabs changes 
 * Fix: Layout of the Not Found page
 
+## 1.2.12 (Missing number)
+
 ## 1.2.11
 
 * Improvement: Enabled to open editing form from affix header

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "crowi-plus",
-  "version": "1.2.13-RC",
+  "version": "1.2.14-RC",
   "description": "Enhanced Crowi",
   "tags": [
     "wiki",

+ 11 - 3
resource/js/legacy/crowi.js

@@ -757,13 +757,17 @@ $(function() {
   // hash handling
   if (isSavedStatesOfTabChanges) {
     $('a[data-toggle="tab"][href="#revision-history"]').on('show.bs.tab', function() {
-      window.history.pushState('', 'History', '#revision-history');
+      window.location.hash = '#revision-history';
+      window.history.replaceState('', 'History', '#revision-history');
     });
     $('a[data-toggle="tab"][href="#edit-form"]').on('show.bs.tab', function() {
-      window.history.pushState('', 'Edit', '#edit-form');
+      window.location.hash = '#edit-form';
+      window.history.replaceState('', 'Edit', '#edit-form');
     });
     $('a[data-toggle="tab"][href="#revision-body"]').on('show.bs.tab', function() {
-      window.history.pushState('', '',  location.href.replace(location.hash, ''));
+      // couln't solve https://github.com/weseek/crowi-plus/issues/119 completely -- 2017.07.03 Yuki Takei
+      window.location.hash = '#';
+      window.history.replaceState('', '', location.href);
     });
   }
   else {
@@ -776,6 +780,10 @@ $(function() {
     $('a[data-toggle="tab"][href="#revision-body"]').on('show.bs.tab', function() {
       window.history.replaceState('', '',  location.href.replace(location.hash, ''));
     });
+    // replace all href="#edit-form" link behaviors
+    $(document).on('click', 'a[href="#edit-form"]', function() {
+      window.location.replace('#edit-form');
+    });
   }
 });