@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.js
CHANGED
|
@@ -730,11 +730,11 @@ class PasteRule {
|
|
|
730
730
|
this.handler = config.handler;
|
|
731
731
|
}
|
|
732
732
|
}
|
|
733
|
-
const pasteRuleMatcherHandler = (text, find) => {
|
|
733
|
+
const pasteRuleMatcherHandler = (text, find, event) => {
|
|
734
734
|
if (isRegExp(find)) {
|
|
735
735
|
return [...text.matchAll(find)];
|
|
736
736
|
}
|
|
737
|
-
const matches = find(text);
|
|
737
|
+
const matches = find(text, event);
|
|
738
738
|
if (!matches) {
|
|
739
739
|
return [];
|
|
740
740
|
}
|
|
@@ -766,7 +766,7 @@ function run(config) {
|
|
|
766
766
|
const resolvedFrom = Math.max(from, pos);
|
|
767
767
|
const resolvedTo = Math.min(to, pos + node.content.size);
|
|
768
768
|
const textToMatch = node.textBetween(resolvedFrom - pos, resolvedTo - pos, undefined, '\ufffc');
|
|
769
|
-
const matches = pasteRuleMatcherHandler(textToMatch, rule.find);
|
|
769
|
+
const matches = pasteRuleMatcherHandler(textToMatch, rule.find, pasteEvent);
|
|
770
770
|
matches.forEach(match => {
|
|
771
771
|
if (match.index === undefined) {
|
|
772
772
|
return;
|
|
@@ -2307,6 +2307,9 @@ function getMarksBetween(from, to, doc) {
|
|
|
2307
2307
|
}
|
|
2308
2308
|
else {
|
|
2309
2309
|
doc.nodesBetween(from, to, (node, pos) => {
|
|
2310
|
+
if (!node || node.nodeSize === undefined) {
|
|
2311
|
+
return;
|
|
2312
|
+
}
|
|
2310
2313
|
marks.push(...node.marks.map(mark => ({
|
|
2311
2314
|
from: pos,
|
|
2312
2315
|
to: pos + node.nodeSize,
|