@tiptap/core 2.1.13 → 2.1.15
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 +7 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +7 -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/createNodeFromContent.ts +1 -0
- package/src/helpers/getMarksBetween.ts +4 -0
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;
|
|
@@ -1607,6 +1607,7 @@
|
|
|
1607
1607
|
}
|
|
1608
1608
|
}
|
|
1609
1609
|
if (typeof content === 'string') {
|
|
1610
|
+
content = content.split('\n').map(part => part.trim()).join(''); // we need to remove new lines since the parser will add breaks
|
|
1610
1611
|
const parser = model.DOMParser.fromSchema(schema);
|
|
1611
1612
|
return options.slice
|
|
1612
1613
|
? parser.parseSlice(elementFromString(content), options.parseOptions).content
|
|
@@ -2305,6 +2306,9 @@
|
|
|
2305
2306
|
}
|
|
2306
2307
|
else {
|
|
2307
2308
|
doc.nodesBetween(from, to, (node, pos) => {
|
|
2309
|
+
if (!node || node.nodeSize === undefined) {
|
|
2310
|
+
return;
|
|
2311
|
+
}
|
|
2308
2312
|
marks.push(...node.marks.map(mark => ({
|
|
2309
2313
|
from: pos,
|
|
2310
2314
|
to: pos + node.nodeSize,
|