@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 +10 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/Editor.ts +4 -0
- package/src/ExtensionManager.ts +58 -60
- package/src/commands/insertContentAt.ts +5 -4
package/dist/index.js
CHANGED
|
@@ -2141,7 +2141,7 @@ var ExtensionManager = class {
|
|
|
2141
2141
|
get plugins() {
|
|
2142
2142
|
const { editor } = this;
|
|
2143
2143
|
const extensions = sortExtensions([...this.extensions].reverse());
|
|
2144
|
-
const allPlugins = extensions.
|
|
2144
|
+
const allPlugins = extensions.flatMap((extension) => {
|
|
2145
2145
|
const context = {
|
|
2146
2146
|
name: extension.name,
|
|
2147
2147
|
options: extension.options,
|
|
@@ -2199,7 +2199,7 @@ var ExtensionManager = class {
|
|
|
2199
2199
|
plugins.push(...proseMirrorPlugins);
|
|
2200
2200
|
}
|
|
2201
2201
|
return plugins;
|
|
2202
|
-
})
|
|
2202
|
+
});
|
|
2203
2203
|
return allPlugins;
|
|
2204
2204
|
}
|
|
2205
2205
|
/**
|
|
@@ -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
|
|
2812
|
-
const
|
|
2813
|
-
const
|
|
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
|
}
|
|
@@ -4369,6 +4370,9 @@ var Editor = class extends EventEmitter {
|
|
|
4369
4370
|
}
|
|
4370
4371
|
this.createView(el);
|
|
4371
4372
|
this.emit("mount", { editor: this });
|
|
4373
|
+
if (this.css && !document.head.contains(this.css)) {
|
|
4374
|
+
document.head.appendChild(this.css);
|
|
4375
|
+
}
|
|
4372
4376
|
window.setTimeout(() => {
|
|
4373
4377
|
if (this.isDestroyed) {
|
|
4374
4378
|
return;
|