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