@tiptap/core 3.1.0 → 3.2.1
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 +39 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +39 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/Editor.ts +14 -1
- package/src/NodeView.ts +41 -1
package/dist/index.js
CHANGED
|
@@ -4371,7 +4371,6 @@ var Editor = class extends EventEmitter {
|
|
|
4371
4371
|
* Remove the editor from the DOM, but still allow remounting at a different point in time
|
|
4372
4372
|
*/
|
|
4373
4373
|
unmount() {
|
|
4374
|
-
var _a;
|
|
4375
4374
|
if (this.editorView) {
|
|
4376
4375
|
const dom = this.editorView.dom;
|
|
4377
4376
|
if (dom == null ? void 0 : dom.editor) {
|
|
@@ -4381,7 +4380,17 @@ var Editor = class extends EventEmitter {
|
|
|
4381
4380
|
}
|
|
4382
4381
|
this.editorView = null;
|
|
4383
4382
|
this.isInitialized = false;
|
|
4384
|
-
(
|
|
4383
|
+
if (this.css) {
|
|
4384
|
+
try {
|
|
4385
|
+
if (typeof this.css.remove === "function") {
|
|
4386
|
+
this.css.remove();
|
|
4387
|
+
} else if (this.css.parentNode) {
|
|
4388
|
+
this.css.parentNode.removeChild(this.css);
|
|
4389
|
+
}
|
|
4390
|
+
} catch (error) {
|
|
4391
|
+
console.warn("Failed to remove CSS element:", error);
|
|
4392
|
+
}
|
|
4393
|
+
}
|
|
4385
4394
|
this.css = null;
|
|
4386
4395
|
}
|
|
4387
4396
|
/**
|
|
@@ -5151,7 +5160,34 @@ var NodeView = class {
|
|
|
5151
5160
|
y = handleBox.y - domBox.y + offsetY;
|
|
5152
5161
|
}
|
|
5153
5162
|
const clonedNode = this.dom.cloneNode(true);
|
|
5154
|
-
|
|
5163
|
+
try {
|
|
5164
|
+
const domBox = this.dom.getBoundingClientRect();
|
|
5165
|
+
clonedNode.style.width = `${Math.round(domBox.width)}px`;
|
|
5166
|
+
clonedNode.style.height = `${Math.round(domBox.height)}px`;
|
|
5167
|
+
clonedNode.style.boxSizing = "border-box";
|
|
5168
|
+
clonedNode.style.pointerEvents = "none";
|
|
5169
|
+
} catch {
|
|
5170
|
+
}
|
|
5171
|
+
let dragImageWrapper = null;
|
|
5172
|
+
try {
|
|
5173
|
+
dragImageWrapper = document.createElement("div");
|
|
5174
|
+
dragImageWrapper.style.position = "absolute";
|
|
5175
|
+
dragImageWrapper.style.top = "-9999px";
|
|
5176
|
+
dragImageWrapper.style.left = "-9999px";
|
|
5177
|
+
dragImageWrapper.style.pointerEvents = "none";
|
|
5178
|
+
dragImageWrapper.appendChild(clonedNode);
|
|
5179
|
+
document.body.appendChild(dragImageWrapper);
|
|
5180
|
+
(_g = event.dataTransfer) == null ? void 0 : _g.setDragImage(clonedNode, x, y);
|
|
5181
|
+
} finally {
|
|
5182
|
+
if (dragImageWrapper) {
|
|
5183
|
+
setTimeout(() => {
|
|
5184
|
+
try {
|
|
5185
|
+
dragImageWrapper == null ? void 0 : dragImageWrapper.remove();
|
|
5186
|
+
} catch {
|
|
5187
|
+
}
|
|
5188
|
+
}, 0);
|
|
5189
|
+
}
|
|
5190
|
+
}
|
|
5155
5191
|
const pos = this.getPos();
|
|
5156
5192
|
if (typeof pos !== "number") {
|
|
5157
5193
|
return;
|