reactjs-tiptap-editor 0.3.27 → 0.3.29
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/lib/{ActionMenuButton-fkh63F_R.cjs → ActionMenuButton-5Y8QcYxD.cjs} +1 -1
- package/lib/{ActionMenuButton-D3nLtawn.js → ActionMenuButton-Cs9DM_16.js} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.d.cts +6 -4
- package/lib/Attachment.d.ts +6 -4
- package/lib/Attachment.js +1 -1
- package/lib/Blockquote.cjs +1 -1
- package/lib/Blockquote.d.cts +6 -4
- package/lib/Blockquote.d.ts +6 -4
- package/lib/Blockquote.js +10 -10
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.d.cts +6 -4
- package/lib/Bold.d.ts +6 -4
- package/lib/Bold.js +10 -10
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.d.cts +6 -4
- package/lib/BulletList.d.ts +6 -4
- package/lib/BulletList.js +10 -10
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.d.cts +6 -4
- package/lib/Clear.d.ts +6 -4
- package/lib/Clear.js +1 -1
- package/lib/Code.cjs +1 -1
- package/lib/Code.d.cts +6 -4
- package/lib/Code.d.ts +6 -4
- package/lib/Code.js +21 -21
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.d.cts +6 -4
- package/lib/CodeBlock.d.ts +6 -4
- package/lib/CodeBlock.js +1 -1
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.d.cts +6 -4
- package/lib/CodeView.d.ts +6 -4
- package/lib/CodeView.js +1 -1
- package/lib/Color.cjs +1 -1
- package/lib/Color.d.cts +6 -4
- package/lib/Color.d.ts +6 -4
- package/lib/Color.js +1 -1
- package/lib/Document.d.cts +4 -4
- package/lib/Document.d.ts +4 -4
- package/lib/{Drawer-BBVUujX4.js → Drawer-BCmNLh31.js} +1 -1
- package/lib/{Drawer-DetzmUvQ.cjs → Drawer-DCAp7eZF.cjs} +1 -1
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.d.cts +6 -4
- package/lib/Drawer.d.ts +6 -4
- package/lib/Drawer.js +2 -2
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.d.cts +4 -4
- package/lib/Emoji.d.ts +4 -4
- package/lib/Emoji.js +1 -1
- package/lib/{Excalidraw-DVnwdz-w.cjs → Excalidraw-BI50RQL-.cjs} +1 -1
- package/lib/{Excalidraw-BVdio4hk.js → Excalidraw-CYPcjYZB.js} +1 -1
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.d.cts +4 -4
- package/lib/Excalidraw.d.ts +4 -4
- package/lib/Excalidraw.js +1 -1
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.d.cts +6 -4
- package/lib/ExportPdf.d.ts +6 -4
- package/lib/ExportPdf.js +1 -1
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.d.cts +6 -4
- package/lib/ExportWord.d.ts +6 -4
- package/lib/ExportWord.js +1 -1
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.d.cts +6 -4
- package/lib/FontFamily.d.ts +6 -4
- package/lib/FontFamily.js +2 -2
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.d.cts +6 -4
- package/lib/FontSize.d.ts +6 -4
- package/lib/FontSize.js +2 -2
- package/lib/FormatPainter.cjs +1 -1
- package/lib/FormatPainter.d.cts +6 -4
- package/lib/FormatPainter.d.ts +6 -4
- package/lib/FormatPainter.js +1 -1
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.d.cts +6 -4
- package/lib/Heading.d.ts +6 -4
- package/lib/Heading.js +71 -68
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.d.cts +10 -4
- package/lib/Highlight.d.ts +10 -4
- package/lib/Highlight.js +14 -13
- package/lib/History.cjs +1 -1
- package/lib/History.d.cts +6 -4
- package/lib/History.d.ts +6 -4
- package/lib/History.js +163 -160
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.d.cts +6 -4
- package/lib/HorizontalRule.d.ts +6 -4
- package/lib/HorizontalRule.js +14 -14
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.d.cts +4 -4
- package/lib/Iframe.d.ts +4 -4
- package/lib/Iframe.js +1 -1
- package/lib/Image.cjs +1 -1
- package/lib/Image.d.cts +6 -4
- package/lib/Image.d.ts +6 -4
- package/lib/Image.js +1 -1
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.d.cts +7 -6
- package/lib/ImageGif.d.ts +7 -6
- package/lib/ImageGif.js +1 -1
- package/lib/ImportWord.cjs +2 -2
- package/lib/ImportWord.d.cts +6 -4
- package/lib/ImportWord.d.ts +6 -4
- package/lib/ImportWord.js +2 -2
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.d.cts +6 -4
- package/lib/Indent.d.ts +6 -4
- package/lib/Indent.js +12 -11
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.d.cts +6 -4
- package/lib/Italic.d.ts +6 -4
- package/lib/Italic.js +13 -13
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.d.cts +4 -4
- package/lib/Katex.d.ts +4 -4
- package/lib/Katex.js +2 -2
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.d.cts +6 -4
- package/lib/LineHeight.d.ts +6 -4
- package/lib/LineHeight.js +1 -1
- package/lib/Link.cjs +1 -1
- package/lib/Link.d.cts +6 -4
- package/lib/Link.d.ts +6 -4
- package/lib/Link.js +1 -1
- package/lib/ListItem.d.cts +4 -4
- package/lib/ListItem.d.ts +4 -4
- package/lib/Mention.d.cts +4 -4
- package/lib/Mention.d.ts +4 -4
- package/lib/Mermaid.cjs +1 -1
- package/lib/Mermaid.d.cts +6 -4
- package/lib/Mermaid.d.ts +6 -4
- package/lib/Mermaid.js +2 -2
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.d.cts +6 -4
- package/lib/MoreMark.d.ts +6 -4
- package/lib/MoreMark.js +46 -45
- package/lib/MultiColumn.cjs +1 -1
- package/lib/MultiColumn.d.cts +4 -4
- package/lib/MultiColumn.d.ts +4 -4
- package/lib/MultiColumn.js +1 -1
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.d.cts +6 -4
- package/lib/OrderedList.d.ts +6 -4
- package/lib/OrderedList.js +9 -9
- package/lib/{RichTextEditor-DoMu_nCj.cjs → RichTextEditor-DsUcQSbm.cjs} +7 -7
- package/lib/{RichTextEditor-BJWhWz4z.js → RichTextEditor-e6q30rbV.js} +1691 -1672
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.d.cts +6 -4
- package/lib/SearchAndReplace.d.ts +6 -4
- package/lib/SearchAndReplace.js +1 -1
- package/lib/Selection.d.cts +4 -4
- package/lib/Selection.d.ts +4 -4
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.d.cts +4 -4
- package/lib/SlashCommand.d.ts +4 -4
- package/lib/SlashCommand.js +1 -1
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.d.cts +6 -4
- package/lib/Strike.d.ts +6 -4
- package/lib/Strike.js +13 -13
- package/lib/SubAndSuperScript.cjs +1 -1
- package/lib/SubAndSuperScript.d.cts +6 -4
- package/lib/SubAndSuperScript.d.ts +6 -4
- package/lib/SubAndSuperScript.js +1 -1
- package/lib/Table.cjs +1 -1
- package/lib/Table.d.cts +6 -4
- package/lib/Table.d.ts +6 -4
- package/lib/Table.js +1 -1
- package/lib/TableOfContent.cjs +1 -1
- package/lib/TableOfContent.d.cts +4 -4
- package/lib/TableOfContent.d.ts +4 -4
- package/lib/TableOfContent.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.d.cts +6 -4
- package/lib/TaskList.d.ts +6 -4
- package/lib/TaskList.js +15 -15
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.d.cts +6 -4
- package/lib/TextAlign.d.ts +6 -4
- package/lib/TextAlign.js +41 -41
- package/lib/TextBubble.cjs +1 -1
- package/lib/TextBubble.d.cts +6 -4
- package/lib/TextBubble.d.ts +6 -4
- package/lib/TextBubble.js +1 -1
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.d.cts +4 -4
- package/lib/TextDirection.d.ts +4 -4
- package/lib/TextDirection.js +1 -1
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.d.cts +6 -4
- package/lib/TextUnderline.d.ts +6 -4
- package/lib/TextUnderline.js +8 -8
- package/lib/TrailingNode.d.cts +4 -4
- package/lib/TrailingNode.d.ts +4 -4
- package/lib/{Twitter--OkCPska.cjs → Twitter-D2Osj8qP.cjs} +1 -1
- package/lib/{Twitter-CXwmqolk.js → Twitter-Wb7cD3M-.js} +1 -1
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.d.cts +4 -4
- package/lib/Twitter.d.ts +4 -4
- package/lib/Twitter.js +1 -1
- package/lib/Video.cjs +1 -1
- package/lib/Video.d.cts +6 -4
- package/lib/Video.d.ts +6 -4
- package/lib/Video.js +1 -1
- package/lib/bubble-extra.cjs +1 -1
- package/lib/bubble-extra.d.cts +4 -4
- package/lib/bubble-extra.d.ts +4 -4
- package/lib/bubble-extra.js +5 -5
- package/lib/index.cjs +1 -1
- package/lib/index.d.cts +23 -17
- package/lib/index.d.ts +23 -17
- package/lib/index.js +2 -2
- package/lib/locale-bundle.d.cts +4 -4
- package/lib/locale-bundle.d.ts +4 -4
- package/lib/{textarea-DkVc2MIQ.cjs → textarea-BVbzd9-k.cjs} +1 -1
- package/lib/{textarea-HW9QlrCS.js → textarea-Csmx5x-_.js} +1 -1
- package/package.json +1 -1
package/lib/History.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { P as j, a as A, r as G, E as L } from "./index-DI9T3iLd.js";
|
|
2
2
|
import { jsxs as x, jsx as I, Fragment as F } from "react/jsx-runtime";
|
|
3
|
-
import { T as S, a as z, r as N, i as U, b as Z, g as $ } from "./RichTextEditor-
|
|
3
|
+
import { T as S, a as z, r as N, i as U, b as Z, g as $ } from "./RichTextEditor-e6q30rbV.js";
|
|
4
4
|
var E = 200, f = function() {
|
|
5
5
|
};
|
|
6
6
|
f.prototype.append = function(e) {
|
|
@@ -24,40 +24,40 @@ f.prototype.forEach = function(e, t, n) {
|
|
|
24
24
|
};
|
|
25
25
|
f.prototype.map = function(e, t, n) {
|
|
26
26
|
t === void 0 && (t = 0), n === void 0 && (n = this.length);
|
|
27
|
-
var
|
|
28
|
-
return this.forEach(function(s,
|
|
29
|
-
return
|
|
30
|
-
}, t, n),
|
|
27
|
+
var i = [];
|
|
28
|
+
return this.forEach(function(s, o) {
|
|
29
|
+
return i.push(e(s, o));
|
|
30
|
+
}, t, n), i;
|
|
31
31
|
};
|
|
32
32
|
f.from = function(e) {
|
|
33
33
|
return e instanceof f ? e : e && e.length ? new H(e) : f.empty;
|
|
34
34
|
};
|
|
35
|
-
var H = /* @__PURE__ */ function(
|
|
35
|
+
var H = /* @__PURE__ */ function(r) {
|
|
36
36
|
function e(n) {
|
|
37
|
-
|
|
37
|
+
r.call(this), this.values = n;
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
r && (e.__proto__ = r), e.prototype = Object.create(r && r.prototype), e.prototype.constructor = e;
|
|
40
40
|
var t = { length: { configurable: !0 }, depth: { configurable: !0 } };
|
|
41
41
|
return e.prototype.flatten = function() {
|
|
42
42
|
return this.values;
|
|
43
|
-
}, e.prototype.sliceInner = function(
|
|
44
|
-
return
|
|
45
|
-
}, e.prototype.getInner = function(
|
|
46
|
-
return this.values[
|
|
47
|
-
}, e.prototype.forEachInner = function(
|
|
48
|
-
for (var p = s; p <
|
|
49
|
-
if (
|
|
43
|
+
}, e.prototype.sliceInner = function(i, s) {
|
|
44
|
+
return i == 0 && s == this.length ? this : new e(this.values.slice(i, s));
|
|
45
|
+
}, e.prototype.getInner = function(i) {
|
|
46
|
+
return this.values[i];
|
|
47
|
+
}, e.prototype.forEachInner = function(i, s, o, l) {
|
|
48
|
+
for (var p = s; p < o; p++)
|
|
49
|
+
if (i(this.values[p], l + p) === !1)
|
|
50
50
|
return !1;
|
|
51
|
-
}, e.prototype.forEachInvertedInner = function(
|
|
52
|
-
for (var p = s - 1; p >=
|
|
53
|
-
if (
|
|
51
|
+
}, e.prototype.forEachInvertedInner = function(i, s, o, l) {
|
|
52
|
+
for (var p = s - 1; p >= o; p--)
|
|
53
|
+
if (i(this.values[p], l + p) === !1)
|
|
54
54
|
return !1;
|
|
55
|
-
}, e.prototype.leafAppend = function(
|
|
56
|
-
if (this.length +
|
|
57
|
-
return new e(this.values.concat(
|
|
58
|
-
}, e.prototype.leafPrepend = function(
|
|
59
|
-
if (this.length +
|
|
60
|
-
return new e(
|
|
55
|
+
}, e.prototype.leafAppend = function(i) {
|
|
56
|
+
if (this.length + i.length <= E)
|
|
57
|
+
return new e(this.values.concat(i.flatten()));
|
|
58
|
+
}, e.prototype.leafPrepend = function(i) {
|
|
59
|
+
if (this.length + i.length <= E)
|
|
60
|
+
return new e(i.flatten().concat(this.values));
|
|
61
61
|
}, t.length.get = function() {
|
|
62
62
|
return this.values.length;
|
|
63
63
|
}, t.depth.get = function() {
|
|
@@ -65,35 +65,35 @@ var H = /* @__PURE__ */ function(i) {
|
|
|
65
65
|
}, Object.defineProperties(e.prototype, t), e;
|
|
66
66
|
}(f);
|
|
67
67
|
f.empty = new H([]);
|
|
68
|
-
var R = /* @__PURE__ */ function(
|
|
68
|
+
var R = /* @__PURE__ */ function(r) {
|
|
69
69
|
function e(t, n) {
|
|
70
|
-
|
|
70
|
+
r.call(this), this.left = t, this.right = n, this.length = t.length + n.length, this.depth = Math.max(t.depth, n.depth) + 1;
|
|
71
71
|
}
|
|
72
|
-
return
|
|
72
|
+
return r && (e.__proto__ = r), e.prototype = Object.create(r && r.prototype), e.prototype.constructor = e, e.prototype.flatten = function() {
|
|
73
73
|
return this.left.flatten().concat(this.right.flatten());
|
|
74
74
|
}, e.prototype.getInner = function(n) {
|
|
75
75
|
return n < this.left.length ? this.left.get(n) : this.right.get(n - this.left.length);
|
|
76
|
-
}, e.prototype.forEachInner = function(n,
|
|
77
|
-
var
|
|
78
|
-
if (
|
|
76
|
+
}, e.prototype.forEachInner = function(n, i, s, o) {
|
|
77
|
+
var l = this.left.length;
|
|
78
|
+
if (i < l && this.left.forEachInner(n, i, Math.min(s, l), o) === !1 || s > l && this.right.forEachInner(n, Math.max(i - l, 0), Math.min(this.length, s) - l, o + l) === !1)
|
|
79
79
|
return !1;
|
|
80
|
-
}, e.prototype.forEachInvertedInner = function(n,
|
|
81
|
-
var
|
|
82
|
-
if (
|
|
80
|
+
}, e.prototype.forEachInvertedInner = function(n, i, s, o) {
|
|
81
|
+
var l = this.left.length;
|
|
82
|
+
if (i > l && this.right.forEachInvertedInner(n, i - l, Math.max(s, l) - l, o + l) === !1 || s < l && this.left.forEachInvertedInner(n, Math.min(i, l), s, o) === !1)
|
|
83
83
|
return !1;
|
|
84
|
-
}, e.prototype.sliceInner = function(n,
|
|
85
|
-
if (n == 0 &&
|
|
84
|
+
}, e.prototype.sliceInner = function(n, i) {
|
|
85
|
+
if (n == 0 && i == this.length)
|
|
86
86
|
return this;
|
|
87
87
|
var s = this.left.length;
|
|
88
|
-
return
|
|
88
|
+
return i <= s ? this.left.slice(n, i) : n >= s ? this.right.slice(n - s, i - s) : this.left.slice(n, s).append(this.right.slice(0, i - s));
|
|
89
89
|
}, e.prototype.leafAppend = function(n) {
|
|
90
|
-
var
|
|
91
|
-
if (
|
|
92
|
-
return new e(this.left,
|
|
90
|
+
var i = this.right.leafAppend(n);
|
|
91
|
+
if (i)
|
|
92
|
+
return new e(this.left, i);
|
|
93
93
|
}, e.prototype.leafPrepend = function(n) {
|
|
94
|
-
var
|
|
95
|
-
if (
|
|
96
|
-
return new e(
|
|
94
|
+
var i = this.left.leafPrepend(n);
|
|
95
|
+
if (i)
|
|
96
|
+
return new e(i, this.right);
|
|
97
97
|
}, e.prototype.appendInner = function(n) {
|
|
98
98
|
return this.left.depth >= Math.max(this.right.depth, n.depth) + 1 ? new e(this.left, new e(this.right, n)) : new e(this, n);
|
|
99
99
|
}, e;
|
|
@@ -114,39 +114,39 @@ class m {
|
|
|
114
114
|
--n;
|
|
115
115
|
break;
|
|
116
116
|
}
|
|
117
|
-
let
|
|
118
|
-
t && (
|
|
119
|
-
let
|
|
117
|
+
let i, s;
|
|
118
|
+
t && (i = this.remapping(n, this.items.length), s = i.maps.length);
|
|
119
|
+
let o = e.tr, l, p, a = [], c = [];
|
|
120
120
|
return this.items.forEach((h, u) => {
|
|
121
121
|
if (!h.step) {
|
|
122
|
-
|
|
122
|
+
i || (i = this.remapping(n, u + 1), s = i.maps.length), s--, c.push(h);
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
|
-
if (
|
|
125
|
+
if (i) {
|
|
126
126
|
c.push(new g(h.map));
|
|
127
|
-
let d = h.step.map(
|
|
128
|
-
d &&
|
|
127
|
+
let d = h.step.map(i.slice(s)), w;
|
|
128
|
+
d && o.maybeStep(d).doc && (w = o.mapping.maps[o.mapping.maps.length - 1], a.push(new g(w, void 0, void 0, a.length + c.length))), s--, w && i.appendMap(w, s);
|
|
129
129
|
} else
|
|
130
|
-
|
|
130
|
+
o.maybeStep(h.step);
|
|
131
131
|
if (h.selection)
|
|
132
|
-
return
|
|
133
|
-
}, this.items.length, 0), { remaining: p, transform:
|
|
132
|
+
return l = i ? h.selection.map(i.slice(s)) : h.selection, p = new m(this.items.slice(0, n).append(c.reverse().concat(a)), this.eventCount - 1), !1;
|
|
133
|
+
}, this.items.length, 0), { remaining: p, transform: o, selection: l };
|
|
134
134
|
}
|
|
135
135
|
// Create a new branch with the given transform added.
|
|
136
|
-
addTransform(e, t, n,
|
|
137
|
-
let s = [],
|
|
136
|
+
addTransform(e, t, n, i) {
|
|
137
|
+
let s = [], o = this.eventCount, l = this.items, p = !i && l.length ? l.get(l.length - 1) : null;
|
|
138
138
|
for (let c = 0; c < e.steps.length; c++) {
|
|
139
139
|
let h = e.steps[c].invert(e.docs[c]), u = new g(e.mapping.maps[c], h, t), d;
|
|
140
|
-
(d = p && p.merge(u)) && (u = d, c ? s.pop() :
|
|
140
|
+
(d = p && p.merge(u)) && (u = d, c ? s.pop() : l = l.slice(0, l.length - 1)), s.push(u), t && (o++, t = void 0), i || (p = u);
|
|
141
141
|
}
|
|
142
|
-
let a =
|
|
143
|
-
return a > B && (
|
|
142
|
+
let a = o - n.depth;
|
|
143
|
+
return a > B && (l = W(l, a), o -= a), new m(l.append(s), o);
|
|
144
144
|
}
|
|
145
145
|
remapping(e, t) {
|
|
146
146
|
let n = new G();
|
|
147
|
-
return this.items.forEach((
|
|
148
|
-
let
|
|
149
|
-
n.appendMap(
|
|
147
|
+
return this.items.forEach((i, s) => {
|
|
148
|
+
let o = i.mirrorOffset != null && s - i.mirrorOffset >= e ? n.maps.length - i.mirrorOffset : void 0;
|
|
149
|
+
n.appendMap(i.map, o);
|
|
150
150
|
}, e, t), n;
|
|
151
151
|
}
|
|
152
152
|
addMaps(e) {
|
|
@@ -159,27 +159,27 @@ class m {
|
|
|
159
159
|
rebased(e, t) {
|
|
160
160
|
if (!this.eventCount)
|
|
161
161
|
return this;
|
|
162
|
-
let n = [],
|
|
162
|
+
let n = [], i = Math.max(0, this.items.length - t), s = e.mapping, o = e.steps.length, l = this.eventCount;
|
|
163
163
|
this.items.forEach((u) => {
|
|
164
|
-
u.selection &&
|
|
165
|
-
},
|
|
164
|
+
u.selection && l--;
|
|
165
|
+
}, i);
|
|
166
166
|
let p = t;
|
|
167
167
|
this.items.forEach((u) => {
|
|
168
168
|
let d = s.getMirror(--p);
|
|
169
169
|
if (d == null)
|
|
170
170
|
return;
|
|
171
|
-
|
|
171
|
+
o = Math.min(o, d);
|
|
172
172
|
let w = s.maps[d];
|
|
173
173
|
if (u.step) {
|
|
174
|
-
let
|
|
175
|
-
P &&
|
|
174
|
+
let k = e.steps[d].invert(e.docs[d]), P = u.selection && u.selection.map(s.slice(p + 1, d));
|
|
175
|
+
P && l++, n.push(new g(w, k, P));
|
|
176
176
|
} else
|
|
177
177
|
n.push(new g(w));
|
|
178
|
-
},
|
|
178
|
+
}, i);
|
|
179
179
|
let a = [];
|
|
180
|
-
for (let u = t; u <
|
|
180
|
+
for (let u = t; u < o; u++)
|
|
181
181
|
a.push(new g(s.maps[u]));
|
|
182
|
-
let c = this.items.slice(0,
|
|
182
|
+
let c = this.items.slice(0, i).append(a).append(n), h = new m(c, l);
|
|
183
183
|
return h.emptyItemCount() > V && (h = h.compress(this.items.length - n.length)), h;
|
|
184
184
|
}
|
|
185
185
|
emptyItemCount() {
|
|
@@ -195,33 +195,33 @@ class m {
|
|
|
195
195
|
// because `rebased` relies on a clean, untouched set of items in
|
|
196
196
|
// order to associate old items with rebased steps.
|
|
197
197
|
compress(e = this.items.length) {
|
|
198
|
-
let t = this.remapping(0, e), n = t.maps.length,
|
|
199
|
-
return this.items.forEach((
|
|
200
|
-
if (
|
|
201
|
-
|
|
202
|
-
else if (
|
|
203
|
-
let p =
|
|
198
|
+
let t = this.remapping(0, e), n = t.maps.length, i = [], s = 0;
|
|
199
|
+
return this.items.forEach((o, l) => {
|
|
200
|
+
if (l >= e)
|
|
201
|
+
i.push(o), o.selection && s++;
|
|
202
|
+
else if (o.step) {
|
|
203
|
+
let p = o.step.map(t.slice(n)), a = p && p.getMap();
|
|
204
204
|
if (n--, a && t.appendMap(a, n), p) {
|
|
205
|
-
let c =
|
|
205
|
+
let c = o.selection && o.selection.map(t.slice(n));
|
|
206
206
|
c && s++;
|
|
207
|
-
let h = new g(a.invert(), p, c), u, d =
|
|
208
|
-
(u =
|
|
207
|
+
let h = new g(a.invert(), p, c), u, d = i.length - 1;
|
|
208
|
+
(u = i.length && i[d].merge(h)) ? i[d] = u : i.push(h);
|
|
209
209
|
}
|
|
210
|
-
} else
|
|
211
|
-
}, this.items.length, 0), new m(f.from(
|
|
210
|
+
} else o.map && n--;
|
|
211
|
+
}, this.items.length, 0), new m(f.from(i.reverse()), s);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
m.empty = new m(f.empty, 0);
|
|
215
|
-
function W(
|
|
215
|
+
function W(r, e) {
|
|
216
216
|
let t;
|
|
217
|
-
return
|
|
217
|
+
return r.forEach((n, i) => {
|
|
218
218
|
if (n.selection && e-- == 0)
|
|
219
|
-
return t =
|
|
220
|
-
}),
|
|
219
|
+
return t = i, !1;
|
|
220
|
+
}), r.slice(t);
|
|
221
221
|
}
|
|
222
222
|
class g {
|
|
223
|
-
constructor(e, t, n,
|
|
224
|
-
this.map = e, this.step = t, this.selection = n, this.mirrorOffset =
|
|
223
|
+
constructor(e, t, n, i) {
|
|
224
|
+
this.map = e, this.step = t, this.selection = n, this.mirrorOffset = i;
|
|
225
225
|
}
|
|
226
226
|
merge(e) {
|
|
227
227
|
if (this.step && e.step && !e.selection) {
|
|
@@ -232,63 +232,63 @@ class g {
|
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
234
|
class v {
|
|
235
|
-
constructor(e, t, n,
|
|
236
|
-
this.done = e, this.undone = t, this.prevRanges = n, this.prevTime =
|
|
235
|
+
constructor(e, t, n, i, s) {
|
|
236
|
+
this.done = e, this.undone = t, this.prevRanges = n, this.prevTime = i, this.prevComposition = s;
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
const B = 20;
|
|
240
|
-
function J(
|
|
241
|
-
let
|
|
242
|
-
if (
|
|
243
|
-
return
|
|
244
|
-
t.getMeta(Y) && (
|
|
245
|
-
let
|
|
240
|
+
function J(r, e, t, n) {
|
|
241
|
+
let i = t.getMeta(y), s;
|
|
242
|
+
if (i)
|
|
243
|
+
return i.historyState;
|
|
244
|
+
t.getMeta(Y) && (r = new v(r.done, r.undone, null, 0, -1));
|
|
245
|
+
let o = t.getMeta("appendedTransaction");
|
|
246
246
|
if (t.steps.length == 0)
|
|
247
|
-
return
|
|
248
|
-
if (
|
|
249
|
-
return
|
|
250
|
-
if (t.getMeta("addToHistory") !== !1 && !(
|
|
251
|
-
let
|
|
252
|
-
return new v(
|
|
253
|
-
} else return (s = t.getMeta("rebased")) ? new v(
|
|
247
|
+
return r;
|
|
248
|
+
if (o && o.getMeta(y))
|
|
249
|
+
return o.getMeta(y).redo ? new v(r.done.addTransform(t, void 0, n, M(e)), r.undone, b(t.mapping.maps), r.prevTime, r.prevComposition) : new v(r.done, r.undone.addTransform(t, void 0, n, M(e)), null, r.prevTime, r.prevComposition);
|
|
250
|
+
if (t.getMeta("addToHistory") !== !1 && !(o && o.getMeta("addToHistory") === !1)) {
|
|
251
|
+
let l = t.getMeta("composition"), p = r.prevTime == 0 || !o && r.prevComposition != l && (r.prevTime < (t.time || 0) - n.newGroupDelay || !Q(t, r.prevRanges)), a = o ? C(r.prevRanges, t.mapping) : b(t.mapping.maps);
|
|
252
|
+
return new v(r.done.addTransform(t, p ? e.selection.getBookmark() : void 0, n, M(e)), m.empty, a, t.time, l ?? r.prevComposition);
|
|
253
|
+
} else return (s = t.getMeta("rebased")) ? new v(r.done.rebased(t, s), r.undone.rebased(t, s), C(r.prevRanges, t.mapping), r.prevTime, r.prevComposition) : new v(r.done.addMaps(t.mapping.maps), r.undone.addMaps(t.mapping.maps), C(r.prevRanges, t.mapping), r.prevTime, r.prevComposition);
|
|
254
254
|
}
|
|
255
|
-
function Q(
|
|
255
|
+
function Q(r, e) {
|
|
256
256
|
if (!e)
|
|
257
257
|
return !1;
|
|
258
|
-
if (!
|
|
258
|
+
if (!r.docChanged)
|
|
259
259
|
return !0;
|
|
260
260
|
let t = !1;
|
|
261
|
-
return
|
|
261
|
+
return r.mapping.maps[0].forEach((n, i) => {
|
|
262
262
|
for (let s = 0; s < e.length; s += 2)
|
|
263
|
-
n <= e[s + 1] &&
|
|
263
|
+
n <= e[s + 1] && i >= e[s] && (t = !0);
|
|
264
264
|
}), t;
|
|
265
265
|
}
|
|
266
|
-
function b(
|
|
266
|
+
function b(r) {
|
|
267
267
|
let e = [];
|
|
268
|
-
for (let t =
|
|
269
|
-
|
|
268
|
+
for (let t = r.length - 1; t >= 0 && e.length == 0; t--)
|
|
269
|
+
r[t].forEach((n, i, s, o) => e.push(s, o));
|
|
270
270
|
return e;
|
|
271
271
|
}
|
|
272
|
-
function C(
|
|
273
|
-
if (!
|
|
272
|
+
function C(r, e) {
|
|
273
|
+
if (!r)
|
|
274
274
|
return null;
|
|
275
275
|
let t = [];
|
|
276
|
-
for (let n = 0; n <
|
|
277
|
-
let
|
|
278
|
-
|
|
276
|
+
for (let n = 0; n < r.length; n += 2) {
|
|
277
|
+
let i = e.map(r[n], 1), s = e.map(r[n + 1], -1);
|
|
278
|
+
i <= s && t.push(i, s);
|
|
279
279
|
}
|
|
280
280
|
return t;
|
|
281
281
|
}
|
|
282
|
-
function X(
|
|
283
|
-
let n = M(e),
|
|
282
|
+
function X(r, e, t) {
|
|
283
|
+
let n = M(e), i = y.get(e).spec.config, s = (t ? r.undone : r.done).popEvent(e, n);
|
|
284
284
|
if (!s)
|
|
285
285
|
return null;
|
|
286
|
-
let
|
|
287
|
-
return s.transform.setSelection(
|
|
286
|
+
let o = s.selection.resolve(s.transform.doc), l = (t ? r.done : r.undone).addTransform(s.transform, e.selection.getBookmark(), i, n), p = new v(t ? l : s.remaining, t ? s.remaining : l, null, 0, -1);
|
|
287
|
+
return s.transform.setSelection(o).setMeta(y, { redo: t, historyState: p });
|
|
288
288
|
}
|
|
289
289
|
let T = !1, O = null;
|
|
290
|
-
function M(
|
|
291
|
-
let e =
|
|
290
|
+
function M(r) {
|
|
291
|
+
let e = r.plugins;
|
|
292
292
|
if (O != e) {
|
|
293
293
|
T = !1, O = e;
|
|
294
294
|
for (let t = 0; t < e.length; t++)
|
|
@@ -300,10 +300,10 @@ function M(i) {
|
|
|
300
300
|
return T;
|
|
301
301
|
}
|
|
302
302
|
const y = new A("history"), Y = new A("closeHistory");
|
|
303
|
-
function q(
|
|
304
|
-
return
|
|
305
|
-
depth:
|
|
306
|
-
newGroupDelay:
|
|
303
|
+
function q(r = {}) {
|
|
304
|
+
return r = {
|
|
305
|
+
depth: r.depth || 100,
|
|
306
|
+
newGroupDelay: r.newGroupDelay || 500
|
|
307
307
|
}, new j({
|
|
308
308
|
key: y,
|
|
309
309
|
state: {
|
|
@@ -311,33 +311,33 @@ function q(i = {}) {
|
|
|
311
311
|
return new v(m.empty, m.empty, null, 0, -1);
|
|
312
312
|
},
|
|
313
313
|
apply(e, t, n) {
|
|
314
|
-
return J(t, n, e,
|
|
314
|
+
return J(t, n, e, r);
|
|
315
315
|
}
|
|
316
316
|
},
|
|
317
|
-
config:
|
|
317
|
+
config: r,
|
|
318
318
|
props: {
|
|
319
319
|
handleDOMEvents: {
|
|
320
320
|
beforeinput(e, t) {
|
|
321
|
-
let n = t.inputType,
|
|
322
|
-
return
|
|
321
|
+
let n = t.inputType, i = n == "historyUndo" ? D : n == "historyRedo" ? _ : null;
|
|
322
|
+
return i ? (t.preventDefault(), i(e.state, e.dispatch)) : !1;
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
});
|
|
327
327
|
}
|
|
328
|
-
function
|
|
328
|
+
function K(r, e) {
|
|
329
329
|
return (t, n) => {
|
|
330
|
-
let
|
|
331
|
-
if (!
|
|
330
|
+
let i = y.getState(t);
|
|
331
|
+
if (!i || (r ? i.undone : i.done).eventCount == 0)
|
|
332
332
|
return !1;
|
|
333
333
|
if (n) {
|
|
334
|
-
let s = X(
|
|
334
|
+
let s = X(i, t, r);
|
|
335
335
|
s && n(e ? s.scrollIntoView() : s);
|
|
336
336
|
}
|
|
337
337
|
return !0;
|
|
338
338
|
};
|
|
339
339
|
}
|
|
340
|
-
const
|
|
340
|
+
const D = K(!1, !0), _ = K(!0, !0), ee = L.create({
|
|
341
341
|
name: "history",
|
|
342
342
|
addOptions() {
|
|
343
343
|
return {
|
|
@@ -347,8 +347,8 @@ const _ = D(!1, !0), k = D(!0, !0), ee = L.create({
|
|
|
347
347
|
},
|
|
348
348
|
addCommands() {
|
|
349
349
|
return {
|
|
350
|
-
undo: () => ({ state:
|
|
351
|
-
redo: () => ({ state:
|
|
350
|
+
undo: () => ({ state: r, dispatch: e }) => D(r, e),
|
|
351
|
+
redo: () => ({ state: r, dispatch: e }) => _(r, e)
|
|
352
352
|
};
|
|
353
353
|
},
|
|
354
354
|
addProseMirrorPlugins() {
|
|
@@ -367,7 +367,7 @@ const _ = D(!1, !0), k = D(!0, !0), ee = L.create({
|
|
|
367
367
|
};
|
|
368
368
|
}
|
|
369
369
|
});
|
|
370
|
-
function te(
|
|
370
|
+
function te(r) {
|
|
371
371
|
var a;
|
|
372
372
|
const {
|
|
373
373
|
icon: e = void 0,
|
|
@@ -378,54 +378,57 @@ function te(i) {
|
|
|
378
378
|
// color = undefined,
|
|
379
379
|
// loading = false,
|
|
380
380
|
// shortcutKeys = undefined,
|
|
381
|
-
tooltipOptions:
|
|
381
|
+
tooltipOptions: i = {},
|
|
382
382
|
action: s = void 0,
|
|
383
|
-
isActive:
|
|
384
|
-
children:
|
|
385
|
-
} =
|
|
383
|
+
isActive: o = void 0,
|
|
384
|
+
children: l
|
|
385
|
+
} = r, p = U[e];
|
|
386
386
|
return /* @__PURE__ */ x(S, { children: [
|
|
387
387
|
/* @__PURE__ */ I(z, { asChild: !0, children: /* @__PURE__ */ x(
|
|
388
388
|
N,
|
|
389
389
|
{
|
|
390
390
|
size: "sm",
|
|
391
391
|
className: `richtext-w-[32px] richtext-h-[32px] ${n}`,
|
|
392
|
-
disabled:
|
|
392
|
+
disabled: o == null ? void 0 : o(),
|
|
393
393
|
onClick: s,
|
|
394
394
|
children: [
|
|
395
395
|
p && /* @__PURE__ */ I(p, { className: "richtext-w-4 richtext-h-4" }),
|
|
396
|
-
|
|
396
|
+
l && /* @__PURE__ */ I(F, { children: l })
|
|
397
397
|
]
|
|
398
398
|
}
|
|
399
399
|
) }),
|
|
400
|
-
t && /* @__PURE__ */ I(Z, { ...
|
|
400
|
+
t && /* @__PURE__ */ I(Z, { ...i, children: /* @__PURE__ */ x("div", { className: "richtext-flex richtext-flex-col richtext-items-center richtext-text-center richtext-max-w-24", children: [
|
|
401
401
|
/* @__PURE__ */ I("div", { children: t }),
|
|
402
|
-
!!((a =
|
|
402
|
+
!!((a = r == null ? void 0 : r.shortcutKeys) != null && a.length) && /* @__PURE__ */ I("span", { children: $(r == null ? void 0 : r.shortcutKeys) })
|
|
403
403
|
] }) })
|
|
404
404
|
] });
|
|
405
405
|
}
|
|
406
|
-
const ne = ["undo", "redo"],
|
|
406
|
+
const ne = ["undo", "redo"], oe = /* @__PURE__ */ ee.extend({
|
|
407
407
|
addOptions() {
|
|
408
|
-
var
|
|
408
|
+
var r;
|
|
409
409
|
return {
|
|
410
|
-
...(
|
|
410
|
+
...(r = this.parent) == null ? void 0 : r.call(this),
|
|
411
411
|
depth: 100,
|
|
412
412
|
newGroupDelay: 500,
|
|
413
|
-
button: ({ editor: e, t }) => ne.map((
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
413
|
+
button: ({ editor: e, t, extension: n }) => ne.map((i) => {
|
|
414
|
+
var s, o;
|
|
415
|
+
return {
|
|
416
|
+
component: te,
|
|
417
|
+
componentProps: {
|
|
418
|
+
action: () => {
|
|
419
|
+
i === "undo" && e.chain().focus().undo().run(), i === "redo" && e.chain().focus().redo().run();
|
|
420
|
+
},
|
|
421
|
+
shortcutKeys: i === "undo" ? ((s = n.options.shortcutKeys) == null ? void 0 : s[0]) ?? ["mod", "Z"] : ((o = n.options.shortcutKeys) == null ? void 0 : o[1]) ?? ["shift", "mod", "Z"],
|
|
422
|
+
disabled: i === "undo" ? !e.can().undo() : !e.can().redo(),
|
|
423
|
+
isActive: () => i === "undo" ? !e.can().undo() : !e.can().redo(),
|
|
424
|
+
icon: i === "undo" ? "Undo2" : "Redo2",
|
|
425
|
+
tooltip: t(`editor.${i}.tooltip`)
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
})
|
|
426
429
|
};
|
|
427
430
|
}
|
|
428
431
|
});
|
|
429
432
|
export {
|
|
430
|
-
|
|
433
|
+
oe as History
|
|
431
434
|
};
|
package/lib/HorizontalRule.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-ByRfqzMr.cjs"),m=require("./RichTextEditor-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-ByRfqzMr.cjs"),m=require("./RichTextEditor-DsUcQSbm.cjs"),h=t.Node.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",t.mergeAttributes(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:r})=>{if(!t.canInsertNode(r,r.schema.nodes[this.name]))return!1;const{selection:s}=r,{$from:i,$to:a}=s,c=n();return i.parentOffset===0?c.insertContentAt({from:Math.max(i.pos-1,0),to:a.pos},{type:this.name}):t.isNodeSelection(s)?c.insertContentAt(a.pos,{type:this.name}):c.insertContent({type:this.name}),c.command(({tr:e,dispatch:p})=>{var l;if(p){const{$to:o}=e.selection,d=o.end();if(o.nodeAfter)o.nodeAfter.isTextblock?e.setSelection(t.TextSelection.create(e.doc,o.pos+1)):o.nodeAfter.isBlock?e.setSelection(t.NodeSelection.create(e.doc,o.pos)):e.setSelection(t.TextSelection.create(e.doc,o.pos));else{const u=(l=o.parent.type.contentMatch.defaultType)===null||l===void 0?void 0:l.create();u&&(e.insert(d,u),e.setSelection(t.TextSelection.create(e.doc,d+1)))}e.scrollIntoView()}return!0}).run()}}},addInputRules(){return[t.nodeInputRule({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),f=h.extend({renderHTML(){return["div",t.mergeAttributes(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]},addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),button:({editor:r,t:s,extension:i})=>({component:m.ActionButton,componentProps:{action:()=>r.commands.setHorizontalRule(),disabled:!r.can().setHorizontalRule(),icon:"Minus",shortcutKeys:i.options.shortcutKeys??["mod","alt","S"],tooltip:s("editor.horizontalrule.tooltip")}})}},addKeyboardShortcuts(){return{"Mod-Alt-s":()=>this.editor.commands.setHorizontalRule()}}});exports.HorizontalRule=f;
|
package/lib/HorizontalRule.d.cts
CHANGED
|
@@ -68,6 +68,8 @@ declare interface GeneralOptions<T> {
|
|
|
68
68
|
button: ButtonView<T>;
|
|
69
69
|
/** Show on Toolbar */
|
|
70
70
|
toolbar?: boolean;
|
|
71
|
+
/** Shortcut keys override */
|
|
72
|
+
shortcutKeys?: string[] | string[][];
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
export declare const HorizontalRule: Node_2<HorizontalRuleOptions, any>;
|
|
@@ -132,8 +134,8 @@ declare module '@tiptap/core' {
|
|
|
132
134
|
|
|
133
135
|
declare module '@tiptap/core' {
|
|
134
136
|
interface Commands<ReturnType> {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
+
exportPdf: {
|
|
138
|
+
exportToPdf: () => ReturnType;
|
|
137
139
|
};
|
|
138
140
|
}
|
|
139
141
|
}
|
|
@@ -141,8 +143,8 @@ declare module '@tiptap/core' {
|
|
|
141
143
|
|
|
142
144
|
declare module '@tiptap/core' {
|
|
143
145
|
interface Commands<ReturnType> {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
+
excalidraw: {
|
|
147
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
146
148
|
};
|
|
147
149
|
}
|
|
148
150
|
}
|
package/lib/HorizontalRule.d.ts
CHANGED
|
@@ -68,6 +68,8 @@ declare interface GeneralOptions<T> {
|
|
|
68
68
|
button: ButtonView<T>;
|
|
69
69
|
/** Show on Toolbar */
|
|
70
70
|
toolbar?: boolean;
|
|
71
|
+
/** Shortcut keys override */
|
|
72
|
+
shortcutKeys?: string[] | string[][];
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
export declare const HorizontalRule: Node_2<HorizontalRuleOptions, any>;
|
|
@@ -132,8 +134,8 @@ declare module '@tiptap/core' {
|
|
|
132
134
|
|
|
133
135
|
declare module '@tiptap/core' {
|
|
134
136
|
interface Commands<ReturnType> {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
+
exportPdf: {
|
|
138
|
+
exportToPdf: () => ReturnType;
|
|
137
139
|
};
|
|
138
140
|
}
|
|
139
141
|
}
|
|
@@ -141,8 +143,8 @@ declare module '@tiptap/core' {
|
|
|
141
143
|
|
|
142
144
|
declare module '@tiptap/core' {
|
|
143
145
|
interface Commands<ReturnType> {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
+
excalidraw: {
|
|
147
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
146
148
|
};
|
|
147
149
|
}
|
|
148
150
|
}
|