@growgroup/visual-editor 0.7.1 → 0.7.2

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.1",
3
+ "version": "0.7.2",
4
4
  "description": "HTMLをブラウザ上で直接編集するビジュアルエディタ。スライド(固定サイズ)とWebページ(可変高さ)の両方に使え、保存先はアダプタで差し替えられます。",
5
5
  "keywords": [
6
6
  "visual-editor",
@@ -726,7 +726,7 @@ function FrontendVisualEditorInner({
726
726
  async (item: MediaItem) => {
727
727
  setIsMediaLibraryOpen(false);
728
728
 
729
- // blob: iframe では相対パスが解決できないため絶対URLへ(保存時に相対へ戻る)
729
+ // 埋め込みiframeでも同じ素材を参照できるよう絶対URLへ(保存時に相対へ戻る)
730
730
  const src = toEditorMediaUrl(item.url);
731
731
 
732
732
  if (isImageSelected) {
@@ -978,7 +978,7 @@ export function EditorCanvas() {
978
978
  // eslint-disable-next-line react-hooks/exhaustive-deps
979
979
  }, []);
980
980
 
981
- // iframeのsrcを設定。
981
+ // 本文をsrcdocで渡す。Blob URLを解決できない埋め込みブラウザでも読み込める。
982
982
  // 依存に iframeHtml(=originalHtml由来)を含めることで、ページ切替(サムネイル/URL)で
983
983
  // コンテンツが差し替わったときに**iframeだけ**を作り直す。殻(ヘッダー・パネル・
984
984
  // サムネイル)は残るので、切替のたびに画面全体がリロードされたようには見えない
@@ -993,14 +993,10 @@ export function EditorCanvas() {
993
993
  // マルチフレームのキャンバスはこれを見て、前のページの姿が新しい枠に
994
994
  // 見えないようエディタを隠す(読み込みが済むまで見るだけの紙面が透ける)
995
995
  setIframeReady(false);
996
- const blob = new Blob([iframeHtml], { type: "text/html" });
997
- iframe.src = URL.createObjectURL(blob);
996
+ iframe.srcdoc = iframeHtml;
998
997
 
999
998
  return () => {
1000
999
  iframe.removeEventListener("load", handleIframeLoad);
1001
- if (iframe.src.startsWith("blob:")) {
1002
- URL.revokeObjectURL(iframe.src);
1003
- }
1004
1000
 
1005
1001
  // 重要: アンマウント時にすべてのイベントリスナーをクリーンアップ
1006
1002
  // これにより、メモリリークとゴーストリスナーを防ぐ
@@ -138,10 +138,7 @@ export function EditorHeader({
138
138
  const handleReset = () => {
139
139
  const iframe = iframeRef.current;
140
140
  if (iframe) {
141
- const blob = new Blob([generateEditableHtml(originalHtml, editorMode)], {
142
- type: "text/html",
143
- });
144
- iframe.src = URL.createObjectURL(blob);
141
+ iframe.srcdoc = generateEditableHtml(originalHtml, editorMode);
145
142
  }
146
143
  setHtml(originalHtml);
147
144
  setSelectedElement(null);
@@ -525,14 +525,10 @@ export function useIframeInitializer() {
525
525
 
526
526
  iframe.addEventListener('load', handleLoad);
527
527
 
528
- const blob = new Blob([generateEditableHtml(html, editorMode)], { type: 'text/html' });
529
- iframe.src = URL.createObjectURL(blob);
528
+ iframe.srcdoc = generateEditableHtml(html, editorMode);
530
529
 
531
530
  return () => {
532
531
  iframe.removeEventListener('load', handleLoad);
533
- if (iframe.src.startsWith('blob:')) {
534
- URL.revokeObjectURL(iframe.src);
535
- }
536
532
  };
537
533
  }, []);
538
534
 
@@ -59,7 +59,7 @@ async function fetchMediaItems(): Promise<MediaItem[]> {
59
59
  /**
60
60
  * カタログのURL(`/media/...`)をエディタのiframeで解決できる形へ変換する。
61
61
  *
62
- * エディタのキャンバスは blob: URL の iframe なのでルート相対パスが解決できない。
62
+ * エディタのキャンバスは埋め込みiframe。実行時のbaseに依存させず、元のページと同じ素材を参照する。
63
63
  * `src/lib/slide-html.ts` の toEditorUrls / fromEditorUrls と同じ規約に合わせ、
64
64
  * 挿入時は絶対URLにしておく(保存時に fromEditorUrls が相対へ戻す)。
65
65
  */
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.1';
9
+ export const EDITOR_VERSION = '0.7.2';