@growgroup/visual-editor 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@growgroup/visual-editor",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "HTMLをブラウザ上で直接編集するビジュアルエディタ。スライド(固定サイズ)とWebページ(可変高さ)の両方に使え、保存先はアダプタで差し替えられます。",
5
5
  "keywords": [
6
6
  "visual-editor",
@@ -62,7 +62,7 @@ export function useKeepArtboardInPlace(
62
62
  }
63
63
  lastRef.current = {
64
64
  left,
65
- viewportWidth: doc?.documentElement.clientWidth ?? 0,
65
+ viewportWidth: doc?.documentElement?.clientWidth ?? 0,
66
66
  scrollLeft: scroller?.scrollLeft ?? 0,
67
67
  };
68
68
  });
@@ -78,7 +78,8 @@ export function useKeepArtboardInPlace(
78
78
  if (!doc || !scroller) return;
79
79
  const remember = () => {
80
80
  const last = lastRef.current;
81
- if (last && doc.documentElement.clientWidth === last.viewportWidth) last.scrollLeft = scroller.scrollLeft;
81
+ // ページを移る途中は文書が差し替わり、documentElement が無いことがある(⌘ クリックのリンク移動で実測)
82
+ if (last && doc.documentElement && doc.documentElement.clientWidth === last.viewportWidth) last.scrollLeft = scroller.scrollLeft;
82
83
  };
83
84
  remember();
84
85
  scroller.addEventListener('scroll', remember, { passive: true });
package/src/version.ts CHANGED
@@ -6,4 +6,4 @@
6
6
  * 利用側はこの値と node_modules の package.json を見比べて、食い違っていれば
7
7
  * 「再起動してください」と出せる(構成ラフのテンプレートが行っている)
8
8
  */
9
- export const EDITOR_VERSION = '0.7.0';
9
+ export const EDITOR_VERSION = '0.7.1';