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