@tiptap/core 2.1.13 → 2.1.14
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 +6 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +6 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/packages/core/src/PasteRule.d.ts +1 -1
- package/package.json +2 -2
- package/src/PasteRule.ts +4 -3
- package/src/helpers/getMarksBetween.ts +4 -0
package/dist/index.cjs
CHANGED
|
@@ -734,11 +734,11 @@ class PasteRule {
|
|
|
734
734
|
this.handler = config.handler;
|
|
735
735
|
}
|
|
736
736
|
}
|
|
737
|
-
const pasteRuleMatcherHandler = (text, find) => {
|
|
737
|
+
const pasteRuleMatcherHandler = (text, find, event) => {
|
|
738
738
|
if (isRegExp(find)) {
|
|
739
739
|
return [...text.matchAll(find)];
|
|
740
740
|
}
|
|
741
|
-
const matches = find(text);
|
|
741
|
+
const matches = find(text, event);
|
|
742
742
|
if (!matches) {
|
|
743
743
|
return [];
|
|
744
744
|
}
|
|
@@ -770,7 +770,7 @@ function run(config) {
|
|
|
770
770
|
const resolvedFrom = Math.max(from, pos);
|
|
771
771
|
const resolvedTo = Math.min(to, pos + node.content.size);
|
|
772
772
|
const textToMatch = node.textBetween(resolvedFrom - pos, resolvedTo - pos, undefined, '\ufffc');
|
|
773
|
-
const matches = pasteRuleMatcherHandler(textToMatch, rule.find);
|
|
773
|
+
const matches = pasteRuleMatcherHandler(textToMatch, rule.find, pasteEvent);
|
|
774
774
|
matches.forEach(match => {
|
|
775
775
|
if (match.index === undefined) {
|
|
776
776
|
return;
|
|
@@ -2311,6 +2311,9 @@ function getMarksBetween(from, to, doc) {
|
|
|
2311
2311
|
}
|
|
2312
2312
|
else {
|
|
2313
2313
|
doc.nodesBetween(from, to, (node, pos) => {
|
|
2314
|
+
if (!node || node.nodeSize === undefined) {
|
|
2315
|
+
return;
|
|
2316
|
+
}
|
|
2314
2317
|
marks.push(...node.marks.map(mark => ({
|
|
2315
2318
|
from: pos,
|
|
2316
2319
|
to: pos + node.nodeSize,
|