@tiptap/core 3.4.3 → 3.4.5

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.cjs CHANGED
@@ -2262,7 +2262,7 @@ var ExtensionManager = class {
2262
2262
  get plugins() {
2263
2263
  const { editor } = this;
2264
2264
  const extensions = sortExtensions([...this.extensions].reverse());
2265
- const allPlugins = extensions.map((extension) => {
2265
+ const allPlugins = extensions.flatMap((extension) => {
2266
2266
  const context = {
2267
2267
  name: extension.name,
2268
2268
  options: extension.options,
@@ -2320,7 +2320,7 @@ var ExtensionManager = class {
2320
2320
  plugins.push(...proseMirrorPlugins);
2321
2321
  }
2322
2322
  return plugins;
2323
- }).flat();
2323
+ });
2324
2324
  return allPlugins;
2325
2325
  }
2326
2326
  /**
@@ -2856,7 +2856,6 @@ var insertContentAt = (position, value, options) => ({ tr, dispatch, editor }) =
2856
2856
  ...options
2857
2857
  };
2858
2858
  let content;
2859
- const { selection } = editor.state;
2860
2859
  const emitContentError = (error) => {
2861
2860
  editor.emit("contentError", {
2862
2861
  editor,
@@ -2929,9 +2928,11 @@ var insertContentAt = (position, value, options) => ({ tr, dispatch, editor }) =
2929
2928
  tr.insertText(newContent, from, to);
2930
2929
  } else {
2931
2930
  newContent = content;
2932
- const fromSelectionAtStart = selection.$from.parentOffset === 0;
2933
- const isTextSelection2 = selection.$from.node().isText || selection.$from.node().isTextblock;
2934
- const hasContent = selection.$from.node().content.size > 0;
2931
+ const $from = tr.doc.resolve(from);
2932
+ const $fromNode = $from.node();
2933
+ const fromSelectionAtStart = $from.parentOffset === 0;
2934
+ const isTextSelection2 = $fromNode.isText || $fromNode.isTextblock;
2935
+ const hasContent = $fromNode.content.size > 0;
2935
2936
  if (fromSelectionAtStart && isTextSelection2 && hasContent) {
2936
2937
  from = Math.max(0, from - 1);
2937
2938
  }
@@ -4485,6 +4486,9 @@ var Editor = class extends EventEmitter {
4485
4486
  }
4486
4487
  this.createView(el);
4487
4488
  this.emit("mount", { editor: this });
4489
+ if (this.css && !document.head.contains(this.css)) {
4490
+ document.head.appendChild(this.css);
4491
+ }
4488
4492
  window.setTimeout(() => {
4489
4493
  if (this.isDestroyed) {
4490
4494
  return;