@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 CHANGED
@@ -4487,7 +4487,6 @@ var Editor = class extends EventEmitter {
4487
4487
  * Remove the editor from the DOM, but still allow remounting at a different point in time
4488
4488
  */
4489
4489
  unmount() {
4490
- var _a;
4491
4490
  if (this.editorView) {
4492
4491
  const dom = this.editorView.dom;
4493
4492
  if (dom == null ? void 0 : dom.editor) {
@@ -4497,7 +4496,17 @@ var Editor = class extends EventEmitter {
4497
4496
  }
4498
4497
  this.editorView = null;
4499
4498
  this.isInitialized = false;
4500
- (_a = this.css) == null ? void 0 : _a.remove();
4499
+ if (this.css) {
4500
+ try {
4501
+ if (typeof this.css.remove === "function") {
4502
+ this.css.remove();
4503
+ } else if (this.css.parentNode) {
4504
+ this.css.parentNode.removeChild(this.css);
4505
+ }
4506
+ } catch (error) {
4507
+ console.warn("Failed to remove CSS element:", error);
4508
+ }
4509
+ }
4501
4510
  this.css = null;
4502
4511
  }
4503
4512
  /**
@@ -5267,7 +5276,34 @@ var NodeView = class {
5267
5276
  y = handleBox.y - domBox.y + offsetY;
5268
5277
  }
5269
5278
  const clonedNode = this.dom.cloneNode(true);
5270
- (_g = event.dataTransfer) == null ? void 0 : _g.setDragImage(clonedNode, x, y);
5279
+ try {
5280
+ const domBox = this.dom.getBoundingClientRect();
5281
+ clonedNode.style.width = `${Math.round(domBox.width)}px`;
5282
+ clonedNode.style.height = `${Math.round(domBox.height)}px`;
5283
+ clonedNode.style.boxSizing = "border-box";
5284
+ clonedNode.style.pointerEvents = "none";
5285
+ } catch {
5286
+ }
5287
+ let dragImageWrapper = null;
5288
+ try {
5289
+ dragImageWrapper = document.createElement("div");
5290
+ dragImageWrapper.style.position = "absolute";
5291
+ dragImageWrapper.style.top = "-9999px";
5292
+ dragImageWrapper.style.left = "-9999px";
5293
+ dragImageWrapper.style.pointerEvents = "none";
5294
+ dragImageWrapper.appendChild(clonedNode);
5295
+ document.body.appendChild(dragImageWrapper);
5296
+ (_g = event.dataTransfer) == null ? void 0 : _g.setDragImage(clonedNode, x, y);
5297
+ } finally {
5298
+ if (dragImageWrapper) {
5299
+ setTimeout(() => {
5300
+ try {
5301
+ dragImageWrapper == null ? void 0 : dragImageWrapper.remove();
5302
+ } catch {
5303
+ }
5304
+ }, 0);
5305
+ }
5306
+ }
5271
5307
  const pos = this.getPos();
5272
5308
  if (typeof pos !== "number") {
5273
5309
  return;