@tiptap/core 2.5.9 → 3.0.0-next.0
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 +12 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -25
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +12 -25
- package/dist/index.umd.js.map +1 -1
- package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +4 -10
- package/dist/packages/core/src/style.d.ts +1 -1
- package/package.json +3 -3
- package/src/helpers/getMarksBetween.ts +1 -1
- package/src/helpers/isNodeEmpty.ts +12 -33
- package/src/style.ts +0 -4
package/dist/index.js
CHANGED
|
@@ -2634,7 +2634,7 @@ function getMarksBetween(from, to, doc) {
|
|
|
2634
2634
|
.resolve(from)
|
|
2635
2635
|
.marks()
|
|
2636
2636
|
.forEach(mark => {
|
|
2637
|
-
const $pos = doc.resolve(from);
|
|
2637
|
+
const $pos = doc.resolve(from - 1);
|
|
2638
2638
|
const range = getMarkRange($pos, mark.type);
|
|
2639
2639
|
if (!range) {
|
|
2640
2640
|
return;
|
|
@@ -2827,40 +2827,31 @@ function isList(name, extensions) {
|
|
|
2827
2827
|
}
|
|
2828
2828
|
|
|
2829
2829
|
/**
|
|
2830
|
-
* Returns true if the given
|
|
2830
|
+
* Returns true if the given node is empty.
|
|
2831
|
+
* When `checkChildren` is true (default), it will also check if all children are empty.
|
|
2831
2832
|
*/
|
|
2832
|
-
function isNodeEmpty(node, { checkChildren
|
|
2833
|
-
var _a;
|
|
2834
|
-
if (ignoreWhitespace) {
|
|
2835
|
-
if (node.type.name === 'hardBreak') {
|
|
2836
|
-
// Hard breaks are considered empty
|
|
2837
|
-
return true;
|
|
2838
|
-
}
|
|
2839
|
-
if (node.isText) {
|
|
2840
|
-
return /^\s*$/m.test((_a = node.text) !== null && _a !== void 0 ? _a : '');
|
|
2841
|
-
}
|
|
2842
|
-
}
|
|
2833
|
+
function isNodeEmpty(node, { checkChildren } = { checkChildren: true }) {
|
|
2843
2834
|
if (node.isText) {
|
|
2844
2835
|
return !node.text;
|
|
2845
2836
|
}
|
|
2846
|
-
if (node.isAtom || node.isLeaf) {
|
|
2847
|
-
return false;
|
|
2848
|
-
}
|
|
2849
2837
|
if (node.content.childCount === 0) {
|
|
2850
2838
|
return true;
|
|
2851
2839
|
}
|
|
2840
|
+
if (node.isLeaf) {
|
|
2841
|
+
return false;
|
|
2842
|
+
}
|
|
2852
2843
|
if (checkChildren) {
|
|
2853
|
-
let
|
|
2844
|
+
let hasSameContent = true;
|
|
2854
2845
|
node.content.forEach(childNode => {
|
|
2855
|
-
if (
|
|
2846
|
+
if (hasSameContent === false) {
|
|
2856
2847
|
// Exit early for perf
|
|
2857
2848
|
return;
|
|
2858
2849
|
}
|
|
2859
|
-
if (!isNodeEmpty(childNode
|
|
2860
|
-
|
|
2850
|
+
if (!isNodeEmpty(childNode)) {
|
|
2851
|
+
hasSameContent = false;
|
|
2861
2852
|
}
|
|
2862
2853
|
});
|
|
2863
|
-
return
|
|
2854
|
+
return hasSameContent;
|
|
2864
2855
|
}
|
|
2865
2856
|
return false;
|
|
2866
2857
|
}
|
|
@@ -3944,10 +3935,6 @@ img.ProseMirror-separator {
|
|
|
3944
3935
|
|
|
3945
3936
|
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
3946
3937
|
display: block;
|
|
3947
|
-
}
|
|
3948
|
-
|
|
3949
|
-
.tippy-box[data-animation=fade][data-state=hidden] {
|
|
3950
|
-
opacity: 0
|
|
3951
3938
|
}`;
|
|
3952
3939
|
|
|
3953
3940
|
function createStyleTag(style, nonce, suffix) {
|