@tiptap/core 3.22.0 → 3.22.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 +45 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +43 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/NodeView.ts +10 -1
- package/src/utilities/index.ts +1 -0
- package/src/utilities/nodeViewPositionRegistry.ts +70 -0
package/dist/index.cjs
CHANGED
|
@@ -38,6 +38,7 @@ __export(index_exports, {
|
|
|
38
38
|
Tracker: () => Tracker,
|
|
39
39
|
callOrReturn: () => callOrReturn,
|
|
40
40
|
canInsertNode: () => canInsertNode,
|
|
41
|
+
cancelPositionCheck: () => cancelPositionCheck,
|
|
41
42
|
combineTransactionSteps: () => combineTransactionSteps,
|
|
42
43
|
commands: () => commands_exports,
|
|
43
44
|
createAtomBlockMarkdownSpec: () => createAtomBlockMarkdownSpec,
|
|
@@ -132,6 +133,7 @@ __export(index_exports, {
|
|
|
132
133
|
resolveExtensions: () => resolveExtensions,
|
|
133
134
|
resolveFocusPosition: () => resolveFocusPosition,
|
|
134
135
|
rewriteUnknownContent: () => rewriteUnknownContent,
|
|
136
|
+
schedulePositionCheck: () => schedulePositionCheck,
|
|
135
137
|
selectionToInsertionEnd: () => selectionToInsertionEnd,
|
|
136
138
|
serializeAttributes: () => serializeAttributes,
|
|
137
139
|
sortExtensions: () => sortExtensions,
|
|
@@ -6592,6 +6594,45 @@ ${indentedChild}`;
|
|
|
6592
6594
|
return output;
|
|
6593
6595
|
}
|
|
6594
6596
|
|
|
6597
|
+
// src/utilities/nodeViewPositionRegistry.ts
|
|
6598
|
+
var positionUpdateRegistries = /* @__PURE__ */ new WeakMap();
|
|
6599
|
+
function schedulePositionCheck(editor, callback) {
|
|
6600
|
+
let registry = positionUpdateRegistries.get(editor);
|
|
6601
|
+
if (!registry) {
|
|
6602
|
+
const newRegistry = {
|
|
6603
|
+
callbacks: /* @__PURE__ */ new Set(),
|
|
6604
|
+
rafId: null,
|
|
6605
|
+
handler: () => {
|
|
6606
|
+
if (newRegistry.rafId !== null) {
|
|
6607
|
+
cancelAnimationFrame(newRegistry.rafId);
|
|
6608
|
+
}
|
|
6609
|
+
newRegistry.rafId = requestAnimationFrame(() => {
|
|
6610
|
+
newRegistry.rafId = null;
|
|
6611
|
+
newRegistry.callbacks.forEach((cb) => cb());
|
|
6612
|
+
});
|
|
6613
|
+
}
|
|
6614
|
+
};
|
|
6615
|
+
positionUpdateRegistries.set(editor, newRegistry);
|
|
6616
|
+
editor.on("update", newRegistry.handler);
|
|
6617
|
+
registry = newRegistry;
|
|
6618
|
+
}
|
|
6619
|
+
registry.callbacks.add(callback);
|
|
6620
|
+
}
|
|
6621
|
+
function cancelPositionCheck(editor, callback) {
|
|
6622
|
+
const registry = positionUpdateRegistries.get(editor);
|
|
6623
|
+
if (!registry) {
|
|
6624
|
+
return;
|
|
6625
|
+
}
|
|
6626
|
+
registry.callbacks.delete(callback);
|
|
6627
|
+
if (registry.callbacks.size === 0) {
|
|
6628
|
+
if (registry.rafId !== null) {
|
|
6629
|
+
cancelAnimationFrame(registry.rafId);
|
|
6630
|
+
}
|
|
6631
|
+
editor.off("update", registry.handler);
|
|
6632
|
+
positionUpdateRegistries.delete(editor);
|
|
6633
|
+
}
|
|
6634
|
+
}
|
|
6635
|
+
|
|
6595
6636
|
// src/MarkView.ts
|
|
6596
6637
|
function updateMarkViewAttributes(checkMark, editor, attrs = {}) {
|
|
6597
6638
|
const { state } = editor;
|
|
@@ -6798,6 +6839,7 @@ var NodeView = class {
|
|
|
6798
6839
|
return false;
|
|
6799
6840
|
}
|
|
6800
6841
|
const isDragEvent = event.type.startsWith("drag");
|
|
6842
|
+
const isDragOverEnterEvent = event.type === "dragover" || event.type === "dragenter";
|
|
6801
6843
|
const isDropEvent = event.type === "drop";
|
|
6802
6844
|
const isInput = ["INPUT", "BUTTON", "SELECT", "TEXTAREA"].includes(target.tagName) || target.isContentEditable;
|
|
6803
6845
|
if (isInput && !isDropEvent && !isDragEvent) {
|
|
@@ -6846,7 +6888,7 @@ var NodeView = class {
|
|
|
6846
6888
|
);
|
|
6847
6889
|
}
|
|
6848
6890
|
}
|
|
6849
|
-
if (isDragging || isDropEvent || isCopyEvent || isPasteEvent || isCutEvent || isClickEvent && isSelectable) {
|
|
6891
|
+
if (isDragging || isDragOverEnterEvent || isDropEvent || isCopyEvent || isPasteEvent || isCutEvent || isClickEvent && isSelectable) {
|
|
6850
6892
|
return false;
|
|
6851
6893
|
}
|
|
6852
6894
|
return true;
|
|
@@ -7035,6 +7077,7 @@ var Tracker = class {
|
|
|
7035
7077
|
Tracker,
|
|
7036
7078
|
callOrReturn,
|
|
7037
7079
|
canInsertNode,
|
|
7080
|
+
cancelPositionCheck,
|
|
7038
7081
|
combineTransactionSteps,
|
|
7039
7082
|
commands,
|
|
7040
7083
|
createAtomBlockMarkdownSpec,
|
|
@@ -7129,6 +7172,7 @@ var Tracker = class {
|
|
|
7129
7172
|
resolveExtensions,
|
|
7130
7173
|
resolveFocusPosition,
|
|
7131
7174
|
rewriteUnknownContent,
|
|
7175
|
+
schedulePositionCheck,
|
|
7132
7176
|
selectionToInsertionEnd,
|
|
7133
7177
|
serializeAttributes,
|
|
7134
7178
|
sortExtensions,
|