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