@tiptap/core 3.4.3 → 3.4.4

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/dist/index.js CHANGED
@@ -2735,7 +2735,6 @@ var insertContentAt = (position, value, options) => ({ tr, dispatch, editor }) =
2735
2735
  ...options
2736
2736
  };
2737
2737
  let content;
2738
- const { selection } = editor.state;
2739
2738
  const emitContentError = (error) => {
2740
2739
  editor.emit("contentError", {
2741
2740
  editor,
@@ -2808,9 +2807,11 @@ var insertContentAt = (position, value, options) => ({ tr, dispatch, editor }) =
2808
2807
  tr.insertText(newContent, from, to);
2809
2808
  } else {
2810
2809
  newContent = content;
2811
- const fromSelectionAtStart = selection.$from.parentOffset === 0;
2812
- const isTextSelection2 = selection.$from.node().isText || selection.$from.node().isTextblock;
2813
- const hasContent = selection.$from.node().content.size > 0;
2810
+ const $from = tr.doc.resolve(from);
2811
+ const $fromNode = $from.node();
2812
+ const fromSelectionAtStart = $from.parentOffset === 0;
2813
+ const isTextSelection2 = $fromNode.isText || $fromNode.isTextblock;
2814
+ const hasContent = $fromNode.content.size > 0;
2814
2815
  if (fromSelectionAtStart && isTextSelection2 && hasContent) {
2815
2816
  from = Math.max(0, from - 1);
2816
2817
  }