@bagelink/vue 0.0.1272 → 0.0.1274

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.
@@ -1 +1 @@
1
- {"version":3,"file":"useCommands.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/inputs/RichText/composables/useCommands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAGnD,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,CAAC,EAAE;IAAE,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE;uBAK5F,MAAM,UAAU,MAAM;;;EA8D1C"}
1
+ {"version":3,"file":"useCommands.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/inputs/RichText/composables/useCommands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAGnD,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,CAAC,EAAE;IAAE,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE;uBAK5F,MAAM,UAAU,MAAM;;;EAkD1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"useEditor.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/inputs/RichText/composables/useEditor.ts"],"names":[],"mappings":"AAmCA,wBAAgB,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eALR,UAAU;;;;;;;;;;;;qDAlBI,CAAC;;+CAG9B,CAAD;;;;2CAGC,CAAC;;;gBAqWiB,QAAQ;;;0BAjSR,MAAM,GAAG,MAAM;;;;;;;;;EAuXlC"}
1
+ {"version":3,"file":"useEditor.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/inputs/RichText/composables/useEditor.ts"],"names":[],"mappings":"AAmCA,wBAAgB,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eALR,UAAU;;;;;;;;;;;;qDAlBI,CAAC;;+CAG9B,CAAD;;;;2CAGC,CAAC;;;gBAsTiB,QAAQ;;;0BApPR,MAAM,GAAG,MAAM;;;;;;;;;EAwUlC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.vue.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/inputs/RichText/index.vue"],"names":[],"mappings":"AA8RA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAQpD,KAAK,WAAW,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,aAAa,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;;;;;;;;AA8V1G,wBASG"}
1
+ {"version":3,"file":"index.vue.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/inputs/RichText/index.vue"],"names":[],"mappings":"AAyRA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAQpD,KAAK,WAAW,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,aAAa,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;;;;;;;;AAyV1G,wBASG"}
package/dist/index.cjs CHANGED
@@ -27394,10 +27394,8 @@ function useCommands(state2, debug) {
27394
27394
  return {
27395
27395
  execute: (command, value) => {
27396
27396
  if (!state2.doc) return;
27397
- console.log("[useCommands.execute] Starting command execution:", command, value);
27398
27397
  debug == null ? void 0 : debug.logCommand(command, value);
27399
27398
  if (["splitView", "codeView", "fullScreen"].includes(command)) {
27400
- console.log("[useCommands.execute] Handling view state command:", command);
27401
27399
  switch (command) {
27402
27400
  case "splitView":
27403
27401
  state2.isSplitView = !state2.isSplitView;
@@ -27410,25 +27408,16 @@ function useCommands(state2, debug) {
27410
27408
  return;
27411
27409
  }
27412
27410
  }
27413
- console.log("[useCommands.execute] Focusing editor");
27414
27411
  state2.doc.body.focus();
27415
- console.log("[useCommands.execute] Executing command");
27416
27412
  executor.execute(command, value);
27417
27413
  const newContent = state2.doc.body.innerHTML;
27418
- console.log("[useCommands.execute] Checking content changes");
27419
- console.log("[useCommands.execute] Old content length:", state2.content.length);
27420
- console.log("[useCommands.execute] New content length:", newContent.length);
27421
27414
  if (newContent !== state2.content) {
27422
- console.log("[useCommands.execute] Content changed, updating state");
27423
27415
  state2.content = newContent;
27424
27416
  }
27425
- console.log("[useCommands.execute] Checking selection changes");
27426
27417
  const selection = state2.doc.getSelection();
27427
27418
  if (selection == null ? void 0 : selection.rangeCount) {
27428
27419
  const hasSelectionChanged = !state2.selection || state2.selection !== selection || state2.rangeCount !== selection.rangeCount;
27429
- console.log("[useCommands.execute] Selection changed:", hasSelectionChanged);
27430
27420
  if (hasSelectionChanged) {
27431
- console.log("[useCommands.execute] Updating selection state");
27432
27421
  state2.selection = selection;
27433
27422
  state2.range = selection.getRangeAt(0).cloneRange();
27434
27423
  state2.rangeCount = selection.rangeCount;
@@ -27625,7 +27614,6 @@ function useEditor() {
27625
27614
  const updateState = {
27626
27615
  styles: () => {
27627
27616
  if (!state2.doc) return;
27628
- console.log("[updateState.styles] Starting style update");
27629
27617
  const styles = /* @__PURE__ */ new Set();
27630
27618
  const styleTypes = [
27631
27619
  "bold",
@@ -27648,82 +27636,59 @@ function useEditor() {
27648
27636
  styles.add(style);
27649
27637
  }
27650
27638
  });
27651
- console.log("[updateState.styles] New styles:", Array.from(styles));
27652
27639
  state2.selectedStyles = styles;
27653
27640
  },
27654
27641
  content: (source) => {
27655
27642
  if (!state2.doc) return;
27656
- console.log("[updateState.content] Starting content update, source:", source);
27657
27643
  const currentContent = state2.doc.body.innerHTML;
27658
- console.log("[updateState.content] Current content length:", currentContent.length);
27659
- console.log("[updateState.content] State content length:", state2.content.length);
27660
27644
  if (currentContent !== state2.content) {
27661
- console.log("[updateState.content] Content changed, pushing to undo stack");
27662
27645
  state2.undoStack.push(state2.content);
27663
27646
  state2.redoStack = [];
27664
27647
  }
27665
27648
  const selection = state2.doc.getSelection();
27666
27649
  const range2 = (selection == null ? void 0 : selection.rangeCount) ? selection.getRangeAt(0).cloneRange() : null;
27667
- console.log("[updateState.content] Has selection:", !!selection, "Has range:", !!range2);
27668
27650
  if (source === "html") {
27669
- console.log("[updateState.content] Processing HTML content");
27670
27651
  const preserved = preserveIframes(state2.content);
27671
- console.log("[updateState.content] Preserved iframes count:", preserved.iframes.length);
27672
27652
  state2.doc.body.innerHTML = preserved.html;
27673
27653
  setTimeout(() => {
27674
- console.log("[updateState.content] Restoring iframes");
27675
27654
  if (state2.doc) {
27676
27655
  restoreIframes(state2.doc, state2.content, preserved.iframes);
27677
27656
  if (range2 && selection) {
27678
27657
  try {
27679
27658
  selection.removeAllRanges();
27680
27659
  selection.addRange(range2);
27681
- console.log("[updateState.content] Selection restored");
27682
27660
  } catch (e) {
27683
- console.warn("[updateState.content] Could not restore selection:", e);
27684
27661
  }
27685
27662
  }
27686
27663
  }
27687
27664
  }, 0);
27688
27665
  } else {
27689
- console.log("[updateState.content] Setting text content");
27690
27666
  state2.doc.body.textContent = state2.content;
27691
27667
  }
27692
27668
  },
27693
27669
  selection: () => {
27694
27670
  if (!state2.doc) return;
27695
- console.log("[updateState.selection] Starting selection update");
27696
27671
  const newSelection = state2.doc.getSelection();
27697
27672
  if (!newSelection) {
27698
- console.log("[updateState.selection] No selection available");
27699
27673
  return;
27700
27674
  }
27701
27675
  try {
27702
27676
  if (!state2.doc.body.contains(newSelection.anchorNode)) {
27703
- console.log("[updateState.selection] Selection outside editor body, refocusing");
27704
27677
  state2.doc.body.focus();
27705
27678
  return;
27706
27679
  }
27707
27680
  const hasSelectionChanged = !state2.selection || state2.selection !== newSelection || state2.rangeCount !== newSelection.rangeCount || newSelection.rangeCount > 0 && state2.range && (state2.range.startContainer !== newSelection.getRangeAt(0).startContainer || state2.range.startOffset !== newSelection.getRangeAt(0).startOffset || state2.range.endContainer !== newSelection.getRangeAt(0).endContainer || state2.range.endOffset !== newSelection.getRangeAt(0).endOffset);
27708
- console.log("[updateState.selection] Selection changed:", hasSelectionChanged);
27709
27681
  if (hasSelectionChanged) {
27710
27682
  state2.selection = newSelection;
27711
27683
  state2.rangeCount = newSelection.rangeCount;
27712
27684
  if (newSelection.rangeCount > 0) {
27713
27685
  state2.range = newSelection.getRangeAt(0).cloneRange();
27714
- console.log("[updateState.selection] New range:", {
27715
- startOffset: state2.range.startOffset,
27716
- endOffset: state2.range.endOffset,
27717
- collapsed: state2.range.collapsed
27718
- });
27719
27686
  }
27720
27687
  requestAnimationFrame(() => {
27721
- console.log("[updateState.selection] Updating styles in RAF");
27722
27688
  updateState.styles();
27723
27689
  });
27724
27690
  }
27725
27691
  } catch (e) {
27726
- console.warn("[updateState.selection] Selection error:", e);
27727
27692
  state2.selection = null;
27728
27693
  state2.range = null;
27729
27694
  state2.rangeCount = 0;
@@ -27813,70 +27778,44 @@ function useEditor() {
27813
27778
  }
27814
27779
  };
27815
27780
  function setupEventListeners(doc) {
27816
- console.log("[setupEventListeners] Starting setup");
27817
27781
  if (cleanupListeners) {
27818
- console.log("[setupEventListeners] Cleaning up existing listeners");
27819
27782
  cleanupListeners();
27820
27783
  cleanupListeners = null;
27821
27784
  }
27822
27785
  let isUpdating = false;
27823
27786
  let contentUpdateTimeout = null;
27824
27787
  let selectionUpdateTimeout = null;
27825
- let updateCount = 0;
27826
27788
  const events = {
27827
27789
  input: () => {
27828
- updateCount++;
27829
- console.log(`[input event #${updateCount}] Starting, isUpdating:`, isUpdating);
27830
- if (isUpdating) {
27831
- console.log(`[input event #${updateCount}] Skipped - already updating`);
27832
- return;
27833
- }
27790
+ if (isUpdating) return;
27834
27791
  isUpdating = true;
27835
27792
  if (contentUpdateTimeout) {
27836
- console.log(`[input event #${updateCount}] Clearing previous timeout`);
27837
27793
  window.clearTimeout(contentUpdateTimeout);
27838
27794
  }
27839
27795
  contentUpdateTimeout = window.setTimeout(() => {
27840
- console.log(`[input event #${updateCount}] Timeout fired`);
27841
27796
  const newContent = doc.body.innerHTML;
27842
27797
  if (newContent !== state2.content) {
27843
- console.log(`[input event #${updateCount}] Content changed, updating state`);
27844
27798
  state2.content = newContent;
27845
- } else {
27846
- console.log(`[input event #${updateCount}] Content unchanged`);
27847
27799
  }
27848
27800
  isUpdating = false;
27849
27801
  }, 100);
27850
27802
  },
27851
27803
  selectionchange: () => {
27852
- updateCount++;
27853
- console.log(`[selectionchange #${updateCount}] Starting, isUpdating:`, isUpdating);
27854
- if (isUpdating) {
27855
- console.log(`[selectionchange #${updateCount}] Skipped - already updating`);
27856
- return;
27857
- }
27804
+ if (isUpdating) return;
27858
27805
  if (selectionUpdateTimeout) {
27859
- console.log(`[selectionchange #${updateCount}] Clearing previous timeout`);
27860
27806
  window.clearTimeout(selectionUpdateTimeout);
27861
27807
  }
27862
27808
  selectionUpdateTimeout = window.setTimeout(() => {
27863
- console.log(`[selectionchange #${updateCount}] Timeout fired`);
27864
27809
  if (!isUpdating) {
27865
27810
  updateState.selection();
27866
- } else {
27867
- console.log(`[selectionchange #${updateCount}] Skipped - still updating`);
27868
27811
  }
27869
27812
  }, 150);
27870
27813
  },
27871
27814
  mouseup: () => {
27872
- updateCount++;
27873
- console.log(`[mouseup #${updateCount}] Starting, isUpdating:`, isUpdating);
27874
27815
  if (isUpdating) return;
27875
27816
  updateState.selection();
27876
27817
  },
27877
27818
  keyup: (e) => {
27878
- updateCount++;
27879
- console.log(`[keyup #${updateCount}] Key:`, e.key, "isUpdating:", isUpdating);
27880
27819
  if (isUpdating) return;
27881
27820
  if (["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(e.key)) {
27882
27821
  updateState.selection();
@@ -27885,10 +27824,8 @@ function useEditor() {
27885
27824
  };
27886
27825
  Object.entries(events).forEach(([event, handler]) => {
27887
27826
  doc.addEventListener(event, handler);
27888
- console.log("[setupEventListeners] Added listener for:", event);
27889
27827
  });
27890
27828
  cleanupListeners = () => {
27891
- console.log("[setupEventListeners] Cleaning up event listeners");
27892
27829
  if (contentUpdateTimeout) window.clearTimeout(contentUpdateTimeout);
27893
27830
  if (selectionUpdateTimeout) window.clearTimeout(selectionUpdateTimeout);
27894
27831
  Object.entries(events).forEach(([event, handler]) => {
@@ -27898,9 +27835,7 @@ function useEditor() {
27898
27835
  return cleanupListeners;
27899
27836
  }
27900
27837
  function init(doc) {
27901
- console.log("[init] Starting initialization");
27902
27838
  if (state2.hasInit) {
27903
- console.log("[init] Already initialized, cleaning up first");
27904
27839
  if (cleanupListeners) {
27905
27840
  cleanupListeners();
27906
27841
  cleanupListeners = null;
@@ -28092,9 +28027,7 @@ const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
28092
28027
  });
28093
28028
  async function initEditor() {
28094
28029
  var _a2;
28095
- console.log("[initEditor] Starting, isInitializing:", isInitializing.value, "hasInitialized:", hasInitialized.value);
28096
28030
  if (isInitializing.value || !iframe.value || hasInitialized.value) {
28097
- console.log("[initEditor] Skipped - already initializing/initialized or no iframe");
28098
28031
  return;
28099
28032
  }
28100
28033
  isInitializing.value = true;
@@ -28122,10 +28055,7 @@ const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
28122
28055
  </html>
28123
28056
  `;
28124
28057
  const doc = iframe.value.contentDocument || ((_a2 = iframe.value.contentWindow) == null ? void 0 : _a2.document);
28125
- if (!doc) {
28126
- console.warn("[initEditor] No document found");
28127
- return;
28128
- }
28058
+ if (!doc) return;
28129
28059
  doc.open();
28130
28060
  doc.write(htmlContent);
28131
28061
  doc.close();
@@ -28164,7 +28094,7 @@ const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
28164
28094
  doc.body.focus();
28165
28095
  hasInitialized.value = true;
28166
28096
  } catch (error) {
28167
- console.error("[initEditor] Error during initialization:", error);
28097
+ console.error("Error during editor initialization:", error);
28168
28098
  } finally {
28169
28099
  isInitializing.value = false;
28170
28100
  }
@@ -28172,7 +28102,6 @@ const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
28172
28102
  vue.watch(() => props2.modelValue, (newValue, oldValue) => {
28173
28103
  if (newValue !== editor.state.content) {
28174
28104
  if (!oldValue || Math.abs(newValue.length - oldValue.length) > 50) {
28175
- console.log("[watch] Significant content change, resetting initialization state");
28176
28105
  hasInitialized.value = false;
28177
28106
  editor.state.content = newValue;
28178
28107
  editor.updateState.content("html");
@@ -28209,8 +28138,8 @@ const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
28209
28138
  ref: iframe,
28210
28139
  class: "editableContent",
28211
28140
  title: "Editor",
28141
+ srcdoc: "",
28212
28142
  sandbox: "allow-same-origin allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-presentation allow-scripts allow-top-navigation allow-top-navigation-by-user-activation",
28213
- src: "about:blank",
28214
28143
  onLoad: initEditor
28215
28144
  }, null, 544)
28216
28145
  ]),
@@ -28268,7 +28197,7 @@ const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
28268
28197
  };
28269
28198
  }
28270
28199
  });
28271
- const RichText = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-b58de58d"]]);
28200
+ const RichText = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-44cb2419"]]);
28272
28201
  const _hoisted_1$r = { class: "flex gap-05" };
28273
28202
  const _hoisted_2$h = ["disabled"];
28274
28203
  const _hoisted_3$d = { key: 1 };
package/dist/index.mjs CHANGED
@@ -27392,10 +27392,8 @@ function useCommands(state2, debug) {
27392
27392
  return {
27393
27393
  execute: (command, value) => {
27394
27394
  if (!state2.doc) return;
27395
- console.log("[useCommands.execute] Starting command execution:", command, value);
27396
27395
  debug == null ? void 0 : debug.logCommand(command, value);
27397
27396
  if (["splitView", "codeView", "fullScreen"].includes(command)) {
27398
- console.log("[useCommands.execute] Handling view state command:", command);
27399
27397
  switch (command) {
27400
27398
  case "splitView":
27401
27399
  state2.isSplitView = !state2.isSplitView;
@@ -27408,25 +27406,16 @@ function useCommands(state2, debug) {
27408
27406
  return;
27409
27407
  }
27410
27408
  }
27411
- console.log("[useCommands.execute] Focusing editor");
27412
27409
  state2.doc.body.focus();
27413
- console.log("[useCommands.execute] Executing command");
27414
27410
  executor.execute(command, value);
27415
27411
  const newContent = state2.doc.body.innerHTML;
27416
- console.log("[useCommands.execute] Checking content changes");
27417
- console.log("[useCommands.execute] Old content length:", state2.content.length);
27418
- console.log("[useCommands.execute] New content length:", newContent.length);
27419
27412
  if (newContent !== state2.content) {
27420
- console.log("[useCommands.execute] Content changed, updating state");
27421
27413
  state2.content = newContent;
27422
27414
  }
27423
- console.log("[useCommands.execute] Checking selection changes");
27424
27415
  const selection = state2.doc.getSelection();
27425
27416
  if (selection == null ? void 0 : selection.rangeCount) {
27426
27417
  const hasSelectionChanged = !state2.selection || state2.selection !== selection || state2.rangeCount !== selection.rangeCount;
27427
- console.log("[useCommands.execute] Selection changed:", hasSelectionChanged);
27428
27418
  if (hasSelectionChanged) {
27429
- console.log("[useCommands.execute] Updating selection state");
27430
27419
  state2.selection = selection;
27431
27420
  state2.range = selection.getRangeAt(0).cloneRange();
27432
27421
  state2.rangeCount = selection.rangeCount;
@@ -27623,7 +27612,6 @@ function useEditor() {
27623
27612
  const updateState = {
27624
27613
  styles: () => {
27625
27614
  if (!state2.doc) return;
27626
- console.log("[updateState.styles] Starting style update");
27627
27615
  const styles = /* @__PURE__ */ new Set();
27628
27616
  const styleTypes = [
27629
27617
  "bold",
@@ -27646,82 +27634,59 @@ function useEditor() {
27646
27634
  styles.add(style);
27647
27635
  }
27648
27636
  });
27649
- console.log("[updateState.styles] New styles:", Array.from(styles));
27650
27637
  state2.selectedStyles = styles;
27651
27638
  },
27652
27639
  content: (source) => {
27653
27640
  if (!state2.doc) return;
27654
- console.log("[updateState.content] Starting content update, source:", source);
27655
27641
  const currentContent = state2.doc.body.innerHTML;
27656
- console.log("[updateState.content] Current content length:", currentContent.length);
27657
- console.log("[updateState.content] State content length:", state2.content.length);
27658
27642
  if (currentContent !== state2.content) {
27659
- console.log("[updateState.content] Content changed, pushing to undo stack");
27660
27643
  state2.undoStack.push(state2.content);
27661
27644
  state2.redoStack = [];
27662
27645
  }
27663
27646
  const selection = state2.doc.getSelection();
27664
27647
  const range2 = (selection == null ? void 0 : selection.rangeCount) ? selection.getRangeAt(0).cloneRange() : null;
27665
- console.log("[updateState.content] Has selection:", !!selection, "Has range:", !!range2);
27666
27648
  if (source === "html") {
27667
- console.log("[updateState.content] Processing HTML content");
27668
27649
  const preserved = preserveIframes(state2.content);
27669
- console.log("[updateState.content] Preserved iframes count:", preserved.iframes.length);
27670
27650
  state2.doc.body.innerHTML = preserved.html;
27671
27651
  setTimeout(() => {
27672
- console.log("[updateState.content] Restoring iframes");
27673
27652
  if (state2.doc) {
27674
27653
  restoreIframes(state2.doc, state2.content, preserved.iframes);
27675
27654
  if (range2 && selection) {
27676
27655
  try {
27677
27656
  selection.removeAllRanges();
27678
27657
  selection.addRange(range2);
27679
- console.log("[updateState.content] Selection restored");
27680
27658
  } catch (e) {
27681
- console.warn("[updateState.content] Could not restore selection:", e);
27682
27659
  }
27683
27660
  }
27684
27661
  }
27685
27662
  }, 0);
27686
27663
  } else {
27687
- console.log("[updateState.content] Setting text content");
27688
27664
  state2.doc.body.textContent = state2.content;
27689
27665
  }
27690
27666
  },
27691
27667
  selection: () => {
27692
27668
  if (!state2.doc) return;
27693
- console.log("[updateState.selection] Starting selection update");
27694
27669
  const newSelection = state2.doc.getSelection();
27695
27670
  if (!newSelection) {
27696
- console.log("[updateState.selection] No selection available");
27697
27671
  return;
27698
27672
  }
27699
27673
  try {
27700
27674
  if (!state2.doc.body.contains(newSelection.anchorNode)) {
27701
- console.log("[updateState.selection] Selection outside editor body, refocusing");
27702
27675
  state2.doc.body.focus();
27703
27676
  return;
27704
27677
  }
27705
27678
  const hasSelectionChanged = !state2.selection || state2.selection !== newSelection || state2.rangeCount !== newSelection.rangeCount || newSelection.rangeCount > 0 && state2.range && (state2.range.startContainer !== newSelection.getRangeAt(0).startContainer || state2.range.startOffset !== newSelection.getRangeAt(0).startOffset || state2.range.endContainer !== newSelection.getRangeAt(0).endContainer || state2.range.endOffset !== newSelection.getRangeAt(0).endOffset);
27706
- console.log("[updateState.selection] Selection changed:", hasSelectionChanged);
27707
27679
  if (hasSelectionChanged) {
27708
27680
  state2.selection = newSelection;
27709
27681
  state2.rangeCount = newSelection.rangeCount;
27710
27682
  if (newSelection.rangeCount > 0) {
27711
27683
  state2.range = newSelection.getRangeAt(0).cloneRange();
27712
- console.log("[updateState.selection] New range:", {
27713
- startOffset: state2.range.startOffset,
27714
- endOffset: state2.range.endOffset,
27715
- collapsed: state2.range.collapsed
27716
- });
27717
27684
  }
27718
27685
  requestAnimationFrame(() => {
27719
- console.log("[updateState.selection] Updating styles in RAF");
27720
27686
  updateState.styles();
27721
27687
  });
27722
27688
  }
27723
27689
  } catch (e) {
27724
- console.warn("[updateState.selection] Selection error:", e);
27725
27690
  state2.selection = null;
27726
27691
  state2.range = null;
27727
27692
  state2.rangeCount = 0;
@@ -27811,70 +27776,44 @@ function useEditor() {
27811
27776
  }
27812
27777
  };
27813
27778
  function setupEventListeners(doc) {
27814
- console.log("[setupEventListeners] Starting setup");
27815
27779
  if (cleanupListeners) {
27816
- console.log("[setupEventListeners] Cleaning up existing listeners");
27817
27780
  cleanupListeners();
27818
27781
  cleanupListeners = null;
27819
27782
  }
27820
27783
  let isUpdating = false;
27821
27784
  let contentUpdateTimeout = null;
27822
27785
  let selectionUpdateTimeout = null;
27823
- let updateCount = 0;
27824
27786
  const events = {
27825
27787
  input: () => {
27826
- updateCount++;
27827
- console.log(`[input event #${updateCount}] Starting, isUpdating:`, isUpdating);
27828
- if (isUpdating) {
27829
- console.log(`[input event #${updateCount}] Skipped - already updating`);
27830
- return;
27831
- }
27788
+ if (isUpdating) return;
27832
27789
  isUpdating = true;
27833
27790
  if (contentUpdateTimeout) {
27834
- console.log(`[input event #${updateCount}] Clearing previous timeout`);
27835
27791
  window.clearTimeout(contentUpdateTimeout);
27836
27792
  }
27837
27793
  contentUpdateTimeout = window.setTimeout(() => {
27838
- console.log(`[input event #${updateCount}] Timeout fired`);
27839
27794
  const newContent = doc.body.innerHTML;
27840
27795
  if (newContent !== state2.content) {
27841
- console.log(`[input event #${updateCount}] Content changed, updating state`);
27842
27796
  state2.content = newContent;
27843
- } else {
27844
- console.log(`[input event #${updateCount}] Content unchanged`);
27845
27797
  }
27846
27798
  isUpdating = false;
27847
27799
  }, 100);
27848
27800
  },
27849
27801
  selectionchange: () => {
27850
- updateCount++;
27851
- console.log(`[selectionchange #${updateCount}] Starting, isUpdating:`, isUpdating);
27852
- if (isUpdating) {
27853
- console.log(`[selectionchange #${updateCount}] Skipped - already updating`);
27854
- return;
27855
- }
27802
+ if (isUpdating) return;
27856
27803
  if (selectionUpdateTimeout) {
27857
- console.log(`[selectionchange #${updateCount}] Clearing previous timeout`);
27858
27804
  window.clearTimeout(selectionUpdateTimeout);
27859
27805
  }
27860
27806
  selectionUpdateTimeout = window.setTimeout(() => {
27861
- console.log(`[selectionchange #${updateCount}] Timeout fired`);
27862
27807
  if (!isUpdating) {
27863
27808
  updateState.selection();
27864
- } else {
27865
- console.log(`[selectionchange #${updateCount}] Skipped - still updating`);
27866
27809
  }
27867
27810
  }, 150);
27868
27811
  },
27869
27812
  mouseup: () => {
27870
- updateCount++;
27871
- console.log(`[mouseup #${updateCount}] Starting, isUpdating:`, isUpdating);
27872
27813
  if (isUpdating) return;
27873
27814
  updateState.selection();
27874
27815
  },
27875
27816
  keyup: (e) => {
27876
- updateCount++;
27877
- console.log(`[keyup #${updateCount}] Key:`, e.key, "isUpdating:", isUpdating);
27878
27817
  if (isUpdating) return;
27879
27818
  if (["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(e.key)) {
27880
27819
  updateState.selection();
@@ -27883,10 +27822,8 @@ function useEditor() {
27883
27822
  };
27884
27823
  Object.entries(events).forEach(([event, handler]) => {
27885
27824
  doc.addEventListener(event, handler);
27886
- console.log("[setupEventListeners] Added listener for:", event);
27887
27825
  });
27888
27826
  cleanupListeners = () => {
27889
- console.log("[setupEventListeners] Cleaning up event listeners");
27890
27827
  if (contentUpdateTimeout) window.clearTimeout(contentUpdateTimeout);
27891
27828
  if (selectionUpdateTimeout) window.clearTimeout(selectionUpdateTimeout);
27892
27829
  Object.entries(events).forEach(([event, handler]) => {
@@ -27896,9 +27833,7 @@ function useEditor() {
27896
27833
  return cleanupListeners;
27897
27834
  }
27898
27835
  function init(doc) {
27899
- console.log("[init] Starting initialization");
27900
27836
  if (state2.hasInit) {
27901
- console.log("[init] Already initialized, cleaning up first");
27902
27837
  if (cleanupListeners) {
27903
27838
  cleanupListeners();
27904
27839
  cleanupListeners = null;
@@ -28090,9 +28025,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
28090
28025
  });
28091
28026
  async function initEditor() {
28092
28027
  var _a2;
28093
- console.log("[initEditor] Starting, isInitializing:", isInitializing.value, "hasInitialized:", hasInitialized.value);
28094
28028
  if (isInitializing.value || !iframe.value || hasInitialized.value) {
28095
- console.log("[initEditor] Skipped - already initializing/initialized or no iframe");
28096
28029
  return;
28097
28030
  }
28098
28031
  isInitializing.value = true;
@@ -28120,10 +28053,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
28120
28053
  </html>
28121
28054
  `;
28122
28055
  const doc = iframe.value.contentDocument || ((_a2 = iframe.value.contentWindow) == null ? void 0 : _a2.document);
28123
- if (!doc) {
28124
- console.warn("[initEditor] No document found");
28125
- return;
28126
- }
28056
+ if (!doc) return;
28127
28057
  doc.open();
28128
28058
  doc.write(htmlContent);
28129
28059
  doc.close();
@@ -28162,7 +28092,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
28162
28092
  doc.body.focus();
28163
28093
  hasInitialized.value = true;
28164
28094
  } catch (error) {
28165
- console.error("[initEditor] Error during initialization:", error);
28095
+ console.error("Error during editor initialization:", error);
28166
28096
  } finally {
28167
28097
  isInitializing.value = false;
28168
28098
  }
@@ -28170,7 +28100,6 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
28170
28100
  watch(() => props2.modelValue, (newValue, oldValue) => {
28171
28101
  if (newValue !== editor.state.content) {
28172
28102
  if (!oldValue || Math.abs(newValue.length - oldValue.length) > 50) {
28173
- console.log("[watch] Significant content change, resetting initialization state");
28174
28103
  hasInitialized.value = false;
28175
28104
  editor.state.content = newValue;
28176
28105
  editor.updateState.content("html");
@@ -28207,8 +28136,8 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
28207
28136
  ref: iframe,
28208
28137
  class: "editableContent",
28209
28138
  title: "Editor",
28139
+ srcdoc: "",
28210
28140
  sandbox: "allow-same-origin allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-presentation allow-scripts allow-top-navigation allow-top-navigation-by-user-activation",
28211
- src: "about:blank",
28212
28141
  onLoad: initEditor
28213
28142
  }, null, 544)
28214
28143
  ]),
@@ -28266,7 +28195,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
28266
28195
  };
28267
28196
  }
28268
28197
  });
28269
- const RichText = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-b58de58d"]]);
28198
+ const RichText = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-44cb2419"]]);
28270
28199
  const _hoisted_1$r = { class: "flex gap-05" };
28271
28200
  const _hoisted_2$h = ["disabled"];
28272
28201
  const _hoisted_3$d = { key: 1 };
package/dist/style.css CHANGED
@@ -2058,26 +2058,26 @@ input[type="range"][data-v-25d991e5]:active::-webkit-slider-thumb {
2058
2058
  line-height: 1.65;
2059
2059
  }
2060
2060
 
2061
- .rich-text-editor[data-v-b58de58d] {
2061
+ .rich-text-editor[data-v-44cb2419] {
2062
2062
  background: var(--input-bg);
2063
2063
  border: 1px solid var(--border-color);
2064
2064
  transition: all 0.3s ease;
2065
2065
  }
2066
- .editor-container[data-v-b58de58d] {
2066
+ .editor-container[data-v-44cb2419] {
2067
2067
  display: flex;
2068
2068
  gap: 1rem;
2069
2069
  }
2070
- .content-area[data-v-b58de58d],
2071
- .preview-area[data-v-b58de58d] {
2070
+ .content-area[data-v-44cb2419],
2071
+ .preview-area[data-v-44cb2419] {
2072
2072
  flex: 1;
2073
2073
  min-height: 200px;
2074
2074
  background: var(--bgl-richtext-color);
2075
2075
  }
2076
- .split-view[data-v-b58de58d] {
2076
+ .split-view[data-v-44cb2419] {
2077
2077
  display: grid;
2078
2078
  grid-template-columns: 1fr 1fr;
2079
2079
  }
2080
- .editableContent[data-v-b58de58d] {
2080
+ .editableContent[data-v-44cb2419] {
2081
2081
  width: 100%;
2082
2082
  min-height: 240px;
2083
2083
  height: 100%;
@@ -2085,7 +2085,7 @@ line-height: 1.65;
2085
2085
  outline: none;
2086
2086
  background: transparent;
2087
2087
  }
2088
- .html-editor[data-v-b58de58d] {
2088
+ .html-editor[data-v-44cb2419] {
2089
2089
  width: 100%;
2090
2090
  height: 100%;
2091
2091
  min-height: 200px;
@@ -2096,12 +2096,12 @@ line-height: 1.65;
2096
2096
  color: white;
2097
2097
  background-color: var(--bgl-black);
2098
2098
  }
2099
- .preview-area[data-v-b58de58d] {
2099
+ .preview-area[data-v-44cb2419] {
2100
2100
  font-family: monospace;
2101
2101
  white-space: pre-wrap;
2102
2102
  overflow-x: auto;
2103
2103
  }
2104
- .fullscreen-mode[data-v-b58de58d] {
2104
+ .fullscreen-mode[data-v-44cb2419] {
2105
2105
  position: fixed;
2106
2106
  top: 0;
2107
2107
  left: 0;
@@ -2110,18 +2110,18 @@ line-height: 1.65;
2110
2110
  z-index: 9999;
2111
2111
  padding: 2rem;
2112
2112
  }
2113
- .fullscreen-mode .editor-container[data-v-b58de58d] {
2113
+ .fullscreen-mode .editor-container[data-v-44cb2419] {
2114
2114
  height: calc(100vh - 4rem);
2115
2115
  }
2116
- .fullscreen-mode .content-area[data-v-b58de58d],
2117
- .fullscreen-mode .preview-area[data-v-b58de58d] {
2116
+ .fullscreen-mode .content-area[data-v-44cb2419],
2117
+ .fullscreen-mode .preview-area[data-v-44cb2419] {
2118
2118
  height: 100%;
2119
2119
  overflow-y: auto;
2120
2120
  }
2121
- .fullscreen-mode .code-editor[data-v-b58de58d]{
2121
+ .fullscreen-mode .code-editor[data-v-44cb2419]{
2122
2122
  height: 100% !important;
2123
2123
  }
2124
- .debug-controls[data-v-b58de58d] {
2124
+ .debug-controls[data-v-44cb2419] {
2125
2125
  display: flex;
2126
2126
  gap: 0.5rem;
2127
2127
  justify-content: flex-end;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "0.0.1272",
4
+ "version": "0.0.1274",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Neveh Allon",
@@ -9,14 +9,11 @@ export function useCommands(state: EditorState, debug?: { logCommand: (command:
9
9
  execute: (command: string, value?: string) => {
10
10
  if (!state.doc) return
11
11
 
12
- console.log('[useCommands.execute] Starting command execution:', command, value)
13
-
14
12
  // Log command if debug is enabled
15
13
  debug?.logCommand(command, value)
16
14
 
17
15
  // Handle view state commands directly
18
16
  if (['splitView', 'codeView', 'fullScreen'].includes(command)) {
19
- console.log('[useCommands.execute] Handling view state command:', command)
20
17
  switch (command) {
21
18
  case 'splitView':
22
19
  state.isSplitView = !state.isSplitView
@@ -31,34 +28,25 @@ export function useCommands(state: EditorState, debug?: { logCommand: (command:
31
28
  }
32
29
 
33
30
  // Focus the editor before executing command
34
- console.log('[useCommands.execute] Focusing editor')
35
31
  state.doc.body.focus()
36
32
 
37
33
  // Execute the command
38
- console.log('[useCommands.execute] Executing command')
39
34
  executor.execute(command, value)
40
35
 
41
36
  // Update content state only if it has changed
42
37
  const newContent = state.doc.body.innerHTML
43
- console.log('[useCommands.execute] Checking content changes')
44
- console.log('[useCommands.execute] Old content length:', state.content.length)
45
- console.log('[useCommands.execute] New content length:', newContent.length)
46
38
  if (newContent !== state.content) {
47
- console.log('[useCommands.execute] Content changed, updating state')
48
39
  state.content = newContent
49
40
  }
50
41
 
51
42
  // Update selection state if needed
52
- console.log('[useCommands.execute] Checking selection changes')
53
43
  const selection = state.doc.getSelection()
54
44
  if (selection?.rangeCount) {
55
45
  const hasSelectionChanged = !state.selection
56
46
  || state.selection !== selection
57
47
  || state.rangeCount !== selection.rangeCount
58
48
 
59
- console.log('[useCommands.execute] Selection changed:', hasSelectionChanged)
60
49
  if (hasSelectionChanged) {
61
- console.log('[useCommands.execute] Updating selection state')
62
50
  state.selection = selection
63
51
  state.range = selection.getRangeAt(0).cloneRange()
64
52
  state.rangeCount = selection.rangeCount
@@ -58,7 +58,6 @@ export function useEditor() {
58
58
  const updateState = {
59
59
  styles: () => {
60
60
  if (!state.doc) return
61
- console.log('[updateState.styles] Starting style update')
62
61
  const styles = new Set<string>()
63
62
  const styleTypes = [
64
63
  'bold',
@@ -81,19 +80,14 @@ export function useEditor() {
81
80
  styles.add(style)
82
81
  }
83
82
  })
84
- console.log('[updateState.styles] New styles:', Array.from(styles))
85
83
  state.selectedStyles = styles
86
84
  },
87
85
  content: (source: 'html' | 'text') => {
88
86
  if (!state.doc) return
89
- console.log('[updateState.content] Starting content update, source:', source)
90
87
 
91
88
  // Only push to undo stack if content has changed
92
89
  const currentContent = state.doc.body.innerHTML
93
- console.log('[updateState.content] Current content length:', currentContent.length)
94
- console.log('[updateState.content] State content length:', state.content.length)
95
90
  if (currentContent !== state.content) {
96
- console.log('[updateState.content] Content changed, pushing to undo stack')
97
91
  state.undoStack.push(state.content)
98
92
  state.redoStack = []
99
93
  }
@@ -101,18 +95,14 @@ export function useEditor() {
101
95
  // Store current selection
102
96
  const selection = state.doc.getSelection()
103
97
  const range = selection?.rangeCount ? selection.getRangeAt(0).cloneRange() : null
104
- console.log('[updateState.content] Has selection:', !!selection, 'Has range:', !!range)
105
98
 
106
99
  if (source === 'html') {
107
- console.log('[updateState.content] Processing HTML content')
108
100
  // Preserve iframes before setting content
109
101
  const preserved = preserveIframes(state.content)
110
- console.log('[updateState.content] Preserved iframes count:', preserved.iframes.length)
111
102
  state.doc.body.innerHTML = preserved.html
112
103
 
113
104
  // Restore iframes after a short delay to ensure the document is ready
114
105
  setTimeout(() => {
115
- console.log('[updateState.content] Restoring iframes')
116
106
  if (state.doc) {
117
107
  restoreIframes(state.doc, state.content, preserved.iframes)
118
108
 
@@ -121,30 +111,24 @@ export function useEditor() {
121
111
  try {
122
112
  selection.removeAllRanges()
123
113
  selection.addRange(range)
124
- console.log('[updateState.content] Selection restored')
125
114
  } catch (e) {
126
- console.warn('[updateState.content] Could not restore selection:', e)
127
115
  }
128
116
  }
129
117
  }
130
118
  }, 0)
131
119
  } else {
132
- console.log('[updateState.content] Setting text content')
133
120
  state.doc.body.textContent = state.content
134
121
  }
135
122
  },
136
123
  selection: () => {
137
124
  if (!state.doc) return
138
- console.log('[updateState.selection] Starting selection update')
139
125
  const newSelection = state.doc.getSelection()
140
126
  if (!newSelection) {
141
- console.log('[updateState.selection] No selection available')
142
127
  return
143
128
  }
144
129
 
145
130
  try {
146
131
  if (!state.doc.body.contains(newSelection.anchorNode)) {
147
- console.log('[updateState.selection] Selection outside editor body, refocusing')
148
132
  state.doc.body.focus()
149
133
  return
150
134
  }
@@ -160,28 +144,20 @@ export function useEditor() {
160
144
  || state.range.endOffset !== newSelection.getRangeAt(0).endOffset
161
145
  ))
162
146
 
163
- console.log('[updateState.selection] Selection changed:', hasSelectionChanged)
164
147
  if (hasSelectionChanged) {
165
148
  state.selection = newSelection
166
149
  state.rangeCount = newSelection.rangeCount
167
150
 
168
151
  if (newSelection.rangeCount > 0) {
169
152
  state.range = newSelection.getRangeAt(0).cloneRange()
170
- console.log('[updateState.selection] New range:', {
171
- startOffset: state.range.startOffset,
172
- endOffset: state.range.endOffset,
173
- collapsed: state.range.collapsed
174
- })
175
153
  }
176
154
 
177
155
  // Update styles less frequently
178
156
  requestAnimationFrame(() => {
179
- console.log('[updateState.selection] Updating styles in RAF')
180
157
  updateState.styles()
181
158
  })
182
159
  }
183
160
  } catch (e) {
184
- console.warn('[updateState.selection] Selection error:', e)
185
161
  state.selection = null
186
162
  state.range = null
187
163
  state.rangeCount = 0
@@ -275,10 +251,8 @@ export function useEditor() {
275
251
  }
276
252
 
277
253
  function setupEventListeners(doc: Document) {
278
- console.log('[setupEventListeners] Starting setup')
279
254
  // Clean up existing listeners if they exist
280
255
  if (cleanupListeners) {
281
- console.log('[setupEventListeners] Cleaning up existing listeners')
282
256
  cleanupListeners()
283
257
  cleanupListeners = null
284
258
  }
@@ -291,62 +265,43 @@ export function useEditor() {
291
265
  const events = {
292
266
  input: () => {
293
267
  updateCount++
294
- console.log(`[input event #${updateCount}] Starting, isUpdating:`, isUpdating)
295
- if (isUpdating) {
296
- console.log(`[input event #${updateCount}] Skipped - already updating`)
297
- return
298
- }
268
+ if (isUpdating) return
299
269
  isUpdating = true
300
270
 
301
271
  // Clear any pending content updates
302
272
  if (contentUpdateTimeout) {
303
- console.log(`[input event #${updateCount}] Clearing previous timeout`)
304
273
  window.clearTimeout(contentUpdateTimeout)
305
274
  }
306
275
 
307
276
  contentUpdateTimeout = window.setTimeout(() => {
308
- console.log(`[input event #${updateCount}] Timeout fired`)
309
277
  const newContent = doc.body.innerHTML
310
278
  if (newContent !== state.content) {
311
- console.log(`[input event #${updateCount}] Content changed, updating state`)
312
279
  state.content = newContent
313
- } else {
314
- console.log(`[input event #${updateCount}] Content unchanged`)
315
280
  }
316
281
  isUpdating = false
317
282
  }, 100)
318
283
  },
319
284
  selectionchange: () => {
320
285
  updateCount++
321
- console.log(`[selectionchange #${updateCount}] Starting, isUpdating:`, isUpdating)
322
- if (isUpdating) {
323
- console.log(`[selectionchange #${updateCount}] Skipped - already updating`)
324
- return
325
- }
286
+ if (isUpdating) return
326
287
 
327
288
  if (selectionUpdateTimeout) {
328
- console.log(`[selectionchange #${updateCount}] Clearing previous timeout`)
329
289
  window.clearTimeout(selectionUpdateTimeout)
330
290
  }
331
291
 
332
292
  selectionUpdateTimeout = window.setTimeout(() => {
333
- console.log(`[selectionchange #${updateCount}] Timeout fired`)
334
293
  if (!isUpdating) {
335
294
  updateState.selection()
336
- } else {
337
- console.log(`[selectionchange #${updateCount}] Skipped - still updating`)
338
295
  }
339
296
  }, 150)
340
297
  },
341
298
  mouseup: () => {
342
299
  updateCount++
343
- console.log(`[mouseup #${updateCount}] Starting, isUpdating:`, isUpdating)
344
300
  if (isUpdating) return
345
301
  updateState.selection()
346
302
  },
347
303
  keyup: (e: KeyboardEvent) => {
348
304
  updateCount++
349
- console.log(`[keyup #${updateCount}] Key:`, e.key, 'isUpdating:', isUpdating)
350
305
  if (isUpdating) return
351
306
  if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(e.key)) {
352
307
  updateState.selection()
@@ -357,12 +312,10 @@ export function useEditor() {
357
312
  // Only add listeners if they haven't been added yet
358
313
  Object.entries(events).forEach(([event, handler]) => {
359
314
  doc.addEventListener(event, handler as EventListener)
360
- console.log('[setupEventListeners] Added listener for:', event)
361
315
  })
362
316
 
363
317
  // Store cleanup function
364
318
  cleanupListeners = () => {
365
- console.log('[setupEventListeners] Cleaning up event listeners')
366
319
  if (contentUpdateTimeout) window.clearTimeout(contentUpdateTimeout)
367
320
  if (selectionUpdateTimeout) window.clearTimeout(selectionUpdateTimeout)
368
321
  Object.entries(events).forEach(([event, handler]) => {
@@ -374,9 +327,7 @@ export function useEditor() {
374
327
  }
375
328
 
376
329
  function init(doc: Document) {
377
- console.log('[init] Starting initialization')
378
330
  if (state.hasInit) {
379
- console.log('[init] Already initialized, cleaning up first')
380
331
  if (cleanupListeners) {
381
332
  cleanupListeners()
382
333
  cleanupListeners = null
@@ -32,9 +32,7 @@ onUnmounted(() => {
32
32
  })
33
33
 
34
34
  async function initEditor() {
35
- console.log('[initEditor] Starting, isInitializing:', isInitializing.value, 'hasInitialized:', hasInitialized.value)
36
35
  if (isInitializing.value || !iframe.value || hasInitialized.value) {
37
- console.log('[initEditor] Skipped - already initializing/initialized or no iframe')
38
36
  return
39
37
  }
40
38
 
@@ -69,10 +67,7 @@ async function initEditor() {
69
67
 
70
68
  // Write the complete HTML document to the iframe
71
69
  const doc = iframe.value.contentDocument || iframe.value.contentWindow?.document
72
- if (!doc) {
73
- console.warn('[initEditor] No document found')
74
- return
75
- }
70
+ if (!doc) return
76
71
 
77
72
  // First write the content
78
73
  doc.open()
@@ -122,7 +117,8 @@ async function initEditor() {
122
117
  doc.body.focus()
123
118
  hasInitialized.value = true
124
119
  } catch (error) {
125
- console.error('[initEditor] Error during initialization:', error)
120
+ // Keep only this error log for debugging critical issues
121
+ console.error('Error during editor initialization:', error)
126
122
  } finally {
127
123
  isInitializing.value = false
128
124
  }
@@ -133,7 +129,6 @@ watch(() => props.modelValue, (newValue, oldValue) => {
133
129
  if (newValue !== editor.state.content) {
134
130
  // Only reset if content change is significant (not just minor edits)
135
131
  if (!oldValue || Math.abs(newValue.length - oldValue.length) > 50) {
136
- console.log('[watch] Significant content change, resetting initialization state')
137
132
  hasInitialized.value = false
138
133
  editor.state.content = newValue
139
134
  editor.updateState.content('html')
@@ -164,8 +159,8 @@ watch(() => editor.state.content, (newValue) => {
164
159
  ref="iframe"
165
160
  class="editableContent"
166
161
  title="Editor"
162
+ srcdoc=""
167
163
  sandbox="allow-same-origin allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-presentation allow-scripts allow-top-navigation allow-top-navigation-by-user-activation"
168
- src="about:blank"
169
164
  @load="initEditor"
170
165
  />
171
166
  </div>