@dooherceg/tiptap-controlled-editor-with-table 0.0.6 → 0.0.8

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.
Files changed (112) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +8 -0
  2. package/dist/_virtual/index.js +7 -0
  3. package/dist/assets/components/tiptap-node/blockquote-node/blockquote-node.css +1 -0
  4. package/dist/assets/components/tiptap-node/code-block-node/code-block-node.css +1 -0
  5. package/dist/assets/components/tiptap-node/heading-node/heading-node.css +1 -0
  6. package/dist/assets/components/tiptap-node/horizontal-rule-node/horizontal-rule-node.css +1 -0
  7. package/dist/assets/components/tiptap-node/image-node/image-node.css +1 -0
  8. package/dist/assets/components/tiptap-node/list-node/list-node.css +1 -0
  9. package/dist/assets/components/tiptap-node/paragraph-node/paragraph-node.css +1 -0
  10. package/dist/assets/components/tiptap-templates/simple/simple-editor.css +1 -0
  11. package/dist/assets/{badge.css → components/tiptap-ui-primitive/badge/badge-colors.css} +1 -1
  12. package/dist/assets/components/tiptap-ui-primitive/badge/badge-group.css +1 -0
  13. package/dist/assets/components/tiptap-ui-primitive/badge/badge.css +1 -0
  14. package/dist/assets/{button.css → components/tiptap-ui-primitive/button/button-colors.css} +1 -1
  15. package/dist/assets/components/tiptap-ui-primitive/button/button-group.css +1 -0
  16. package/dist/assets/components/tiptap-ui-primitive/button/button.css +1 -0
  17. package/dist/assets/styles/_keyframe-animations.css +1 -0
  18. package/dist/assets/styles/_variables.css +1 -0
  19. package/dist/components/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.js +6 -58
  20. package/dist/components/tiptap-node/image-upload-node/image-upload-node.js +4 -3
  21. package/dist/components/tiptap-templates/simple/simple-editor.js +160 -1899
  22. package/dist/components/tiptap-ui/color-highlight-button/color-highlight-button.js +6 -5
  23. package/dist/components/tiptap-ui/color-highlight-button/use-color-highlight.js +1 -1
  24. package/dist/components/tiptap-ui/image-upload-button/use-image-upload.js +16 -16
  25. package/dist/components/tiptap-ui-primitive/badge/badge.js +19 -16
  26. package/dist/components/tiptap-ui-primitive/button/button.js +18 -15
  27. package/dist/components/tiptap-ui-primitive/card/card.js +13 -12
  28. package/dist/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.js +39 -1012
  29. package/dist/components/tiptap-ui-primitive/input/input.js +7 -6
  30. package/dist/components/tiptap-ui-primitive/popover/popover.js +24 -233
  31. package/dist/components/tiptap-ui-primitive/separator/separator.js +9 -8
  32. package/dist/components/tiptap-ui-primitive/toolbar/toolbar.js +2 -1
  33. package/dist/components/tiptap-ui-primitive/tooltip/tooltip.js +84 -1330
  34. package/dist/hooks/use-throttled-callback.js +13 -108
  35. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +527 -0
  36. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +402 -0
  37. package/dist/node_modules/@floating-ui/react/dist/floating-ui.react.js +932 -0
  38. package/dist/node_modules/@floating-ui/react/dist/floating-ui.react.utils.js +185 -0
  39. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +208 -0
  40. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +136 -0
  41. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +130 -0
  42. package/dist/node_modules/@radix-ui/primitive/dist/index.js +9 -0
  43. package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +24 -0
  44. package/dist/node_modules/@radix-ui/react-collection/dist/index.js +48 -0
  45. package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +29 -0
  46. package/dist/node_modules/@radix-ui/react-context/dist/index.js +53 -0
  47. package/dist/node_modules/@radix-ui/react-direction/dist/index.js +10 -0
  48. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +127 -0
  49. package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +221 -0
  50. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +17 -0
  51. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +136 -0
  52. package/dist/node_modules/@radix-ui/react-id/dist/index.js +13 -0
  53. package/dist/node_modules/@radix-ui/react-menu/dist/index.js +636 -0
  54. package/dist/node_modules/@radix-ui/react-popover/dist/index.js +239 -0
  55. package/dist/node_modules/@radix-ui/react-popper/dist/index.js +219 -0
  56. package/dist/node_modules/@radix-ui/react-portal/dist/index.js +15 -0
  57. package/dist/node_modules/@radix-ui/react-presence/dist/index.js +70 -0
  58. package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +36 -0
  59. package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +183 -0
  60. package/dist/node_modules/@radix-ui/react-slot/dist/index.js +49 -0
  61. package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +10 -0
  62. package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +52 -0
  63. package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +14 -0
  64. package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +6 -0
  65. package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +27 -0
  66. package/dist/node_modules/@tiptap/extension-highlight/dist/index.js +84 -0
  67. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +57 -0
  68. package/dist/node_modules/@tiptap/extension-image/dist/index.js +128 -0
  69. package/dist/node_modules/@tiptap/extension-list/dist/index.js +713 -0
  70. package/dist/node_modules/@tiptap/extension-subscript/dist/index.js +40 -0
  71. package/dist/node_modules/@tiptap/extension-superscript/dist/index.js +40 -0
  72. package/dist/node_modules/@tiptap/extension-table/dist/index.js +380 -0
  73. package/dist/node_modules/@tiptap/extension-text-align/dist/index.js +46 -0
  74. package/dist/node_modules/@tiptap/extension-typography/dist/index.js +125 -0
  75. package/dist/node_modules/@tiptap/extensions/dist/index.js +288 -0
  76. package/dist/node_modules/aria-hidden/dist/es2015/index.js +52 -0
  77. package/dist/node_modules/get-nonce/dist/es2015/index.js +7 -0
  78. package/dist/node_modules/lodash.throttle/index.js +95 -0
  79. package/dist/{index-Bqw9S4qP.js → node_modules/react-hotkeys-hook/packages/react-hotkeys-hook/dist/index.js} +57 -55
  80. package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +11 -0
  81. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +112 -0
  82. package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +31 -0
  83. package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +16 -0
  84. package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +68 -0
  85. package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +5 -0
  86. package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +7 -0
  87. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +71 -0
  88. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +7 -0
  89. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +25 -0
  90. package/dist/node_modules/react-style-singleton/dist/es2015/component.js +11 -0
  91. package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +15 -0
  92. package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +30 -0
  93. package/dist/node_modules/tabbable/dist/index.esm.js +197 -0
  94. package/dist/node_modules/tslib/tslib.es6.js +27 -0
  95. package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +6 -0
  96. package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +26 -0
  97. package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +25 -0
  98. package/dist/node_modules/use-sidecar/dist/es2015/exports.js +18 -0
  99. package/dist/node_modules/use-sidecar/dist/es2015/medium.js +67 -0
  100. package/package.json +1 -1
  101. package/dist/Combination-CO0ZtURs.js +0 -1333
  102. package/dist/assets/simple-editor.css +0 -1
  103. package/dist/floating-ui.react-dom-DgOuULHo.js +0 -1334
  104. /package/dist/assets/{image-upload-node.css → components/tiptap-node/image-upload-node/image-upload-node.css} +0 -0
  105. /package/dist/assets/{color-highlight-button.css → components/tiptap-ui/color-highlight-button/color-highlight-button.css} +0 -0
  106. /package/dist/assets/{card.css → components/tiptap-ui-primitive/card/card.css} +0 -0
  107. /package/dist/assets/{dropdown-menu.css → components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.css} +0 -0
  108. /package/dist/assets/{input.css → components/tiptap-ui-primitive/input/input.css} +0 -0
  109. /package/dist/assets/{popover.css → components/tiptap-ui-primitive/popover/popover.css} +0 -0
  110. /package/dist/assets/{separator.css → components/tiptap-ui-primitive/separator/separator.css} +0 -0
  111. /package/dist/assets/{toolbar.css → components/tiptap-ui-primitive/toolbar/toolbar.css} +0 -0
  112. /package/dist/assets/{tooltip.css → components/tiptap-ui-primitive/tooltip/tooltip.css} +0 -0
@@ -0,0 +1,40 @@
1
+ import { Mark as r, mergeAttributes as e } from "@tiptap/core";
2
+ var u = r.create({
3
+ name: "subscript",
4
+ addOptions() {
5
+ return {
6
+ HTMLAttributes: {}
7
+ };
8
+ },
9
+ parseHTML() {
10
+ return [
11
+ {
12
+ tag: "sub"
13
+ },
14
+ {
15
+ style: "vertical-align",
16
+ getAttrs(t) {
17
+ return t !== "sub" ? !1 : null;
18
+ }
19
+ }
20
+ ];
21
+ },
22
+ renderHTML({ HTMLAttributes: t }) {
23
+ return ["sub", e(this.options.HTMLAttributes, t), 0];
24
+ },
25
+ addCommands() {
26
+ return {
27
+ setSubscript: () => ({ commands: t }) => t.setMark(this.name),
28
+ toggleSubscript: () => ({ commands: t }) => t.toggleMark(this.name),
29
+ unsetSubscript: () => ({ commands: t }) => t.unsetMark(this.name)
30
+ };
31
+ },
32
+ addKeyboardShortcuts() {
33
+ return {
34
+ "Mod-,": () => this.editor.commands.toggleSubscript()
35
+ };
36
+ }
37
+ });
38
+ export {
39
+ u as Subscript
40
+ };
@@ -0,0 +1,40 @@
1
+ import { Mark as t, mergeAttributes as e } from "@tiptap/core";
2
+ var u = t.create({
3
+ name: "superscript",
4
+ addOptions() {
5
+ return {
6
+ HTMLAttributes: {}
7
+ };
8
+ },
9
+ parseHTML() {
10
+ return [
11
+ {
12
+ tag: "sup"
13
+ },
14
+ {
15
+ style: "vertical-align",
16
+ getAttrs(r) {
17
+ return r !== "super" ? !1 : null;
18
+ }
19
+ }
20
+ ];
21
+ },
22
+ renderHTML({ HTMLAttributes: r }) {
23
+ return ["sup", e(this.options.HTMLAttributes, r), 0];
24
+ },
25
+ addCommands() {
26
+ return {
27
+ setSuperscript: () => ({ commands: r }) => r.setMark(this.name),
28
+ toggleSuperscript: () => ({ commands: r }) => r.toggleMark(this.name),
29
+ unsetSuperscript: () => ({ commands: r }) => r.unsetMark(this.name)
30
+ };
31
+ },
32
+ addKeyboardShortcuts() {
33
+ return {
34
+ "Mod-.": () => this.editor.commands.toggleSuperscript()
35
+ };
36
+ }
37
+ });
38
+ export {
39
+ u as Superscript
40
+ };
@@ -0,0 +1,380 @@
1
+ import { Node as x, mergeAttributes as M, callOrReturn as $, getExtensionField as _, Extension as O, findParentNodeClosestToPos as k } from "@tiptap/core";
2
+ import { TextSelection as I } from "prosemirror-state";
3
+ import { columnResizing as P, tableEditing as z, CellSelection as N, fixTables as D, goToNextCell as H, setCellAttr as j, mergeCells as W, splitCell as v, toggleHeaderCell as V, toggleHeader as S, deleteTable as B, deleteRow as K, addRowAfter as F, addRowBefore as U, deleteColumn as q, addColumnAfter as G, addColumnBefore as J } from "prosemirror-tables";
4
+ var Q = x.create({
5
+ name: "tableCell",
6
+ addOptions() {
7
+ return {
8
+ HTMLAttributes: {}
9
+ };
10
+ },
11
+ content: "block+",
12
+ addAttributes() {
13
+ return {
14
+ colspan: {
15
+ default: 1
16
+ },
17
+ rowspan: {
18
+ default: 1
19
+ },
20
+ colwidth: {
21
+ default: null,
22
+ parseHTML: (e) => {
23
+ var t, n;
24
+ const l = e.getAttribute("colwidth"), u = l ? l.split(",").map((r) => parseInt(r, 10)) : null;
25
+ if (!u) {
26
+ const r = (t = e.closest("table")) == null ? void 0 : t.querySelectorAll("colgroup > col"), i = Array.from(((n = e.parentElement) == null ? void 0 : n.children) || []).indexOf(e);
27
+ if (i && i > -1 && r && r[i]) {
28
+ const a = r[i].getAttribute("width");
29
+ return a ? [parseInt(a, 10)] : null;
30
+ }
31
+ }
32
+ return u;
33
+ }
34
+ }
35
+ };
36
+ },
37
+ tableRole: "cell",
38
+ isolating: !0,
39
+ parseHTML() {
40
+ return [{ tag: "td" }];
41
+ },
42
+ renderHTML({ HTMLAttributes: e }) {
43
+ return ["td", M(this.options.HTMLAttributes, e), 0];
44
+ }
45
+ }), X = x.create({
46
+ name: "tableHeader",
47
+ addOptions() {
48
+ return {
49
+ HTMLAttributes: {}
50
+ };
51
+ },
52
+ content: "block+",
53
+ addAttributes() {
54
+ return {
55
+ colspan: {
56
+ default: 1
57
+ },
58
+ rowspan: {
59
+ default: 1
60
+ },
61
+ colwidth: {
62
+ default: null,
63
+ parseHTML: (e) => {
64
+ const t = e.getAttribute("colwidth");
65
+ return t ? t.split(",").map((l) => parseInt(l, 10)) : null;
66
+ }
67
+ }
68
+ };
69
+ },
70
+ tableRole: "header_cell",
71
+ isolating: !0,
72
+ parseHTML() {
73
+ return [{ tag: "th" }];
74
+ },
75
+ renderHTML({ HTMLAttributes: e }) {
76
+ return ["th", M(this.options.HTMLAttributes, e), 0];
77
+ }
78
+ }), Y = x.create({
79
+ name: "tableRow",
80
+ addOptions() {
81
+ return {
82
+ HTMLAttributes: {}
83
+ };
84
+ },
85
+ content: "(tableCell | tableHeader)*",
86
+ tableRole: "row",
87
+ parseHTML() {
88
+ return [{ tag: "tr" }];
89
+ },
90
+ renderHTML({ HTMLAttributes: e }) {
91
+ return ["tr", M(this.options.HTMLAttributes, e), 0];
92
+ }
93
+ });
94
+ function R(e, t) {
95
+ return t ? ["width", `${Math.max(t, e)}px`] : ["min-width", `${e}px`];
96
+ }
97
+ function E(e, t, n, l, u, r) {
98
+ var i;
99
+ let a = 0, f = !0, c = t.firstChild;
100
+ const b = e.firstChild;
101
+ if (b !== null)
102
+ for (let m = 0, y = 0; m < b.childCount; m += 1) {
103
+ const { colspan: s, colwidth: d } = b.child(m).attrs;
104
+ for (let o = 0; o < s; o += 1, y += 1) {
105
+ const h = u === y ? r : d && d[o], C = h ? `${h}px` : "";
106
+ if (a += h || l, h || (f = !1), c) {
107
+ if (c.style.width !== C) {
108
+ const [g, w] = R(l, h);
109
+ c.style.setProperty(g, w);
110
+ }
111
+ c = c.nextSibling;
112
+ } else {
113
+ const g = document.createElement("col"), [w, A] = R(l, h);
114
+ g.style.setProperty(w, A), t.appendChild(g);
115
+ }
116
+ }
117
+ }
118
+ for (; c; ) {
119
+ const m = c.nextSibling;
120
+ (i = c.parentNode) == null || i.removeChild(c), c = m;
121
+ }
122
+ const p = e.attrs.style && typeof e.attrs.style == "string" && /\bwidth\s*:/i.test(e.attrs.style);
123
+ f && !p ? (n.style.width = `${a}px`, n.style.minWidth = "") : (n.style.width = "", n.style.minWidth = `${a}px`);
124
+ }
125
+ var Z = class {
126
+ constructor(e, t) {
127
+ this.node = e, this.cellMinWidth = t, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), e.attrs.style && (this.table.style.cssText = e.attrs.style), this.colgroup = this.table.appendChild(document.createElement("colgroup")), E(e, this.colgroup, this.table, t), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
128
+ }
129
+ update(e) {
130
+ return e.type !== this.node.type ? !1 : (this.node = e, E(e, this.colgroup, this.table, this.cellMinWidth), !0);
131
+ }
132
+ ignoreMutation(e) {
133
+ const t = e.target, n = this.dom.contains(t), l = this.contentDOM.contains(t);
134
+ return !!(n && !l && (e.type === "attributes" || e.type === "childList" || e.type === "characterData"));
135
+ }
136
+ };
137
+ function ee(e, t, n, l) {
138
+ let u = 0, r = !0;
139
+ const i = [], a = e.firstChild;
140
+ if (!a)
141
+ return {};
142
+ for (let p = 0, m = 0; p < a.childCount; p += 1) {
143
+ const { colspan: y, colwidth: s } = a.child(p).attrs;
144
+ for (let d = 0; d < y; d += 1, m += 1) {
145
+ const o = n === m ? l : s && s[d];
146
+ u += o || t, o || (r = !1);
147
+ const [h, C] = R(t, o);
148
+ i.push(["col", { style: `${h}: ${C}` }]);
149
+ }
150
+ }
151
+ const f = r ? `${u}px` : "", c = r ? "" : `${u}px`;
152
+ return { colgroup: ["colgroup", {}, ...i], tableWidth: f, tableMinWidth: c };
153
+ }
154
+ function L(e, t) {
155
+ return e.createAndFill();
156
+ }
157
+ function te(e) {
158
+ if (e.cached.tableNodeTypes)
159
+ return e.cached.tableNodeTypes;
160
+ const t = {};
161
+ return Object.keys(e.nodes).forEach((n) => {
162
+ const l = e.nodes[n];
163
+ l.spec.tableRole && (t[l.spec.tableRole] = l);
164
+ }), e.cached.tableNodeTypes = t, t;
165
+ }
166
+ function le(e, t, n, l, u) {
167
+ const r = te(e), i = [], a = [];
168
+ for (let c = 0; c < n; c += 1) {
169
+ const b = L(r.cell);
170
+ if (b && a.push(b), l) {
171
+ const p = L(r.header_cell);
172
+ p && i.push(p);
173
+ }
174
+ }
175
+ const f = [];
176
+ for (let c = 0; c < t; c += 1)
177
+ f.push(r.row.createChecked(null, l && c === 0 ? i : a));
178
+ return r.table.createChecked(null, f);
179
+ }
180
+ function re(e) {
181
+ return e instanceof N;
182
+ }
183
+ var T = ({ editor: e }) => {
184
+ const { selection: t } = e.state;
185
+ if (!re(t))
186
+ return !1;
187
+ let n = 0;
188
+ const l = k(t.ranges[0].$from, (r) => r.type.name === "table");
189
+ return l?.node.descendants((r) => {
190
+ if (r.type.name === "table")
191
+ return !1;
192
+ ["tableCell", "tableHeader"].includes(r.type.name) && (n += 1);
193
+ }), n === t.ranges.length ? (e.commands.deleteTable(), !0) : !1;
194
+ }, ne = "";
195
+ function oe(e) {
196
+ return (e || "").replace(/\s+/g, " ").trim();
197
+ }
198
+ function ae(e, t, n = {}) {
199
+ var l;
200
+ const u = (l = n.cellLineSeparator) != null ? l : ne;
201
+ if (!e || !e.content || e.content.length === 0)
202
+ return "";
203
+ const r = [];
204
+ e.content.forEach((s) => {
205
+ const d = [];
206
+ s.content && s.content.forEach((o) => {
207
+ let h = "";
208
+ o.content && Array.isArray(o.content) && o.content.length > 1 ? h = o.content.map((A) => t.renderChildren(A)).join(u) : h = o.content ? t.renderChildren(o.content) : "";
209
+ const C = oe(h), g = o.type === "tableHeader";
210
+ d.push({ text: C, isHeader: g });
211
+ }), r.push(d);
212
+ });
213
+ const i = r.reduce((s, d) => Math.max(s, d.length), 0);
214
+ if (i === 0)
215
+ return "";
216
+ const a = new Array(i).fill(0);
217
+ r.forEach((s) => {
218
+ var d;
219
+ for (let o = 0; o < i; o += 1) {
220
+ const C = (((d = s[o]) == null ? void 0 : d.text) || "").length;
221
+ C > a[o] && (a[o] = C), a[o] < 3 && (a[o] = 3);
222
+ }
223
+ });
224
+ const f = (s, d) => s + " ".repeat(Math.max(0, d - s.length)), c = r[0], b = c.some((s) => s.isHeader);
225
+ let p = `
226
+ `;
227
+ const m = new Array(i).fill(0).map((s, d) => b && c[d] && c[d].text || "");
228
+ return p += `| ${m.map((s, d) => f(s, a[d])).join(" | ")} |
229
+ `, p += `| ${a.map((s) => "-".repeat(Math.max(3, s))).join(" | ")} |
230
+ `, (b ? r.slice(1) : r).forEach((s) => {
231
+ p += `| ${new Array(i).fill(0).map((d, o) => f(s[o] && s[o].text || "", a[o])).join(" | ")} |
232
+ `;
233
+ }), p;
234
+ }
235
+ var se = ae, ie = x.create({
236
+ name: "table",
237
+ // @ts-ignore
238
+ addOptions() {
239
+ return {
240
+ HTMLAttributes: {},
241
+ resizable: !1,
242
+ renderWrapper: !1,
243
+ handleWidth: 5,
244
+ cellMinWidth: 25,
245
+ // TODO: fix
246
+ View: Z,
247
+ lastColumnResizable: !0,
248
+ allowTableNodeSelection: !1
249
+ };
250
+ },
251
+ content: "tableRow+",
252
+ tableRole: "table",
253
+ isolating: !0,
254
+ group: "block",
255
+ parseHTML() {
256
+ return [{ tag: "table" }];
257
+ },
258
+ renderHTML({ node: e, HTMLAttributes: t }) {
259
+ const { colgroup: n, tableWidth: l, tableMinWidth: u } = ee(e, this.options.cellMinWidth), r = t.style;
260
+ function i() {
261
+ return r || (l ? `width: ${l}` : `min-width: ${u}`);
262
+ }
263
+ const a = [
264
+ "table",
265
+ M(this.options.HTMLAttributes, t, {
266
+ style: i()
267
+ }),
268
+ n,
269
+ ["tbody", 0]
270
+ ];
271
+ return this.options.renderWrapper ? ["div", { class: "tableWrapper" }, a] : a;
272
+ },
273
+ parseMarkdown: (e, t) => {
274
+ const n = [];
275
+ if (e.header) {
276
+ const l = [];
277
+ e.header.forEach((u) => {
278
+ l.push(t.createNode("tableHeader", {}, [{ type: "paragraph", content: t.parseInline(u.tokens) }]));
279
+ }), n.push(t.createNode("tableRow", {}, l));
280
+ }
281
+ return e.rows && e.rows.forEach((l) => {
282
+ const u = [];
283
+ l.forEach((r) => {
284
+ u.push(t.createNode("tableCell", {}, [{ type: "paragraph", content: t.parseInline(r.tokens) }]));
285
+ }), n.push(t.createNode("tableRow", {}, u));
286
+ }), t.createNode("table", void 0, n);
287
+ },
288
+ renderMarkdown: (e, t) => se(e, t),
289
+ addCommands() {
290
+ return {
291
+ insertTable: ({ rows: e = 3, cols: t = 3, withHeaderRow: n = !0 } = {}) => ({ tr: l, dispatch: u, editor: r }) => {
292
+ const i = le(r.schema, e, t, n);
293
+ if (u) {
294
+ const a = l.selection.from + 1;
295
+ l.replaceSelectionWith(i).scrollIntoView().setSelection(I.near(l.doc.resolve(a)));
296
+ }
297
+ return !0;
298
+ },
299
+ addColumnBefore: () => ({ state: e, dispatch: t }) => J(e, t),
300
+ addColumnAfter: () => ({ state: e, dispatch: t }) => G(e, t),
301
+ deleteColumn: () => ({ state: e, dispatch: t }) => q(e, t),
302
+ addRowBefore: () => ({ state: e, dispatch: t }) => U(e, t),
303
+ addRowAfter: () => ({ state: e, dispatch: t }) => F(e, t),
304
+ deleteRow: () => ({ state: e, dispatch: t }) => K(e, t),
305
+ deleteTable: () => ({ state: e, dispatch: t }) => B(e, t),
306
+ mergeCells: () => ({ state: e, dispatch: t }) => W(e, t),
307
+ splitCell: () => ({ state: e, dispatch: t }) => v(e, t),
308
+ toggleHeaderColumn: () => ({ state: e, dispatch: t }) => S("column")(e, t),
309
+ toggleHeaderRow: () => ({ state: e, dispatch: t }) => S("row")(e, t),
310
+ toggleHeaderCell: () => ({ state: e, dispatch: t }) => V(e, t),
311
+ mergeOrSplit: () => ({ state: e, dispatch: t }) => W(e, t) ? !0 : v(e, t),
312
+ setCellAttribute: (e, t) => ({ state: n, dispatch: l }) => j(e, t)(n, l),
313
+ goToNextCell: () => ({ state: e, dispatch: t }) => H(1)(e, t),
314
+ goToPreviousCell: () => ({ state: e, dispatch: t }) => H(-1)(e, t),
315
+ fixTables: () => ({ state: e, dispatch: t }) => (t && D(e), !0),
316
+ setCellSelection: (e) => ({ tr: t, dispatch: n }) => {
317
+ if (n) {
318
+ const l = N.create(t.doc, e.anchorCell, e.headCell);
319
+ t.setSelection(l);
320
+ }
321
+ return !0;
322
+ }
323
+ };
324
+ },
325
+ addKeyboardShortcuts() {
326
+ return {
327
+ Tab: () => this.editor.commands.goToNextCell() ? !0 : this.editor.can().addRowAfter() ? this.editor.chain().addRowAfter().goToNextCell().run() : !1,
328
+ "Shift-Tab": () => this.editor.commands.goToPreviousCell(),
329
+ Backspace: T,
330
+ "Mod-Backspace": T,
331
+ Delete: T,
332
+ "Mod-Delete": T
333
+ };
334
+ },
335
+ addProseMirrorPlugins() {
336
+ return [
337
+ ...this.options.resizable && this.editor.isEditable ? [
338
+ P({
339
+ handleWidth: this.options.handleWidth,
340
+ cellMinWidth: this.options.cellMinWidth,
341
+ defaultCellMinWidth: this.options.cellMinWidth,
342
+ View: this.options.View,
343
+ lastColumnResizable: this.options.lastColumnResizable
344
+ })
345
+ ] : [],
346
+ z({
347
+ allowTableNodeSelection: this.options.allowTableNodeSelection
348
+ })
349
+ ];
350
+ },
351
+ extendNodeSchema(e) {
352
+ const t = {
353
+ name: e.name,
354
+ options: e.options,
355
+ storage: e.storage
356
+ };
357
+ return {
358
+ tableRole: $(_(e, "tableRole", t))
359
+ };
360
+ }
361
+ }), pe = O.create({
362
+ name: "tableKit",
363
+ addExtensions() {
364
+ const e = [];
365
+ return this.options.table !== !1 && e.push(ie.configure(this.options.table)), this.options.tableCell !== !1 && e.push(Q.configure(this.options.tableCell)), this.options.tableHeader !== !1 && e.push(X.configure(this.options.tableHeader)), this.options.tableRow !== !1 && e.push(Y.configure(this.options.tableRow)), e;
366
+ }
367
+ });
368
+ export {
369
+ ne as DEFAULT_CELL_LINE_SEPARATOR,
370
+ ie as Table,
371
+ Q as TableCell,
372
+ X as TableHeader,
373
+ pe as TableKit,
374
+ Y as TableRow,
375
+ Z as TableView,
376
+ ee as createColGroup,
377
+ le as createTable,
378
+ ae as renderTableToMarkdown,
379
+ E as updateColumns
380
+ };
@@ -0,0 +1,46 @@
1
+ import { Extension as n } from "@tiptap/core";
2
+ var r = n.create({
3
+ name: "textAlign",
4
+ addOptions() {
5
+ return {
6
+ types: [],
7
+ alignments: ["left", "center", "right", "justify"],
8
+ defaultAlignment: null
9
+ };
10
+ },
11
+ addGlobalAttributes() {
12
+ return [
13
+ {
14
+ types: this.options.types,
15
+ attributes: {
16
+ textAlign: {
17
+ default: this.options.defaultAlignment,
18
+ parseHTML: (t) => {
19
+ const e = t.style.textAlign;
20
+ return this.options.alignments.includes(e) ? e : this.options.defaultAlignment;
21
+ },
22
+ renderHTML: (t) => t.textAlign ? { style: `text-align: ${t.textAlign}` } : {}
23
+ }
24
+ }
25
+ }
26
+ ];
27
+ },
28
+ addCommands() {
29
+ return {
30
+ setTextAlign: (t) => ({ commands: e }) => this.options.alignments.includes(t) ? this.options.types.map((i) => e.updateAttributes(i, { textAlign: t })).every((i) => i) : !1,
31
+ unsetTextAlign: () => ({ commands: t }) => this.options.types.map((e) => t.resetAttributes(e, "textAlign")).every((e) => e),
32
+ toggleTextAlign: (t) => ({ editor: e, commands: i }) => this.options.alignments.includes(t) ? e.isActive({ textAlign: t }) ? i.unsetTextAlign() : i.setTextAlign(t) : !1
33
+ };
34
+ },
35
+ addKeyboardShortcuts() {
36
+ return {
37
+ "Mod-Shift-l": () => this.editor.commands.setTextAlign("left"),
38
+ "Mod-Shift-e": () => this.editor.commands.setTextAlign("center"),
39
+ "Mod-Shift-r": () => this.editor.commands.setTextAlign("right"),
40
+ "Mod-Shift-j": () => this.editor.commands.setTextAlign("justify")
41
+ };
42
+ }
43
+ });
44
+ export {
45
+ r as TextAlign
46
+ };
@@ -0,0 +1,125 @@
1
+ import { Extension as i, textInputRule as t } from "@tiptap/core";
2
+ var e = (s) => t({
3
+ find: /--$/,
4
+ replace: s ?? "—"
5
+ }), o = (s) => t({
6
+ find: /\.\.\.$/,
7
+ replace: s ?? "…"
8
+ }), l = (s) => t({
9
+ find: /(?:^|[\s{[(<'"\u2018\u201C])(")$/,
10
+ replace: s ?? "“"
11
+ }), u = (s) => t({
12
+ find: /"$/,
13
+ replace: s ?? "”"
14
+ }), p = (s) => t({
15
+ find: /(?:^|[\s{[(<'"\u2018\u201C])(')$/,
16
+ replace: s ?? "‘"
17
+ }), n = (s) => t({
18
+ find: /'$/,
19
+ replace: s ?? "’"
20
+ }), a = (s) => t({
21
+ find: /<-$/,
22
+ replace: s ?? "←"
23
+ }), r = (s) => t({
24
+ find: /->$/,
25
+ replace: s ?? "→"
26
+ }), h = (s) => t({
27
+ find: /\(c\)$/,
28
+ replace: s ?? "©"
29
+ }), f = (s) => t({
30
+ find: /\(tm\)$/,
31
+ replace: s ?? "™"
32
+ }), c = (s) => t({
33
+ find: /\(sm\)$/,
34
+ replace: s ?? "℠"
35
+ }), x = (s) => t({
36
+ find: /\(r\)$/,
37
+ replace: s ?? "®"
38
+ }), m = (s) => t({
39
+ find: /(?:^|\s)(1\/2)\s$/,
40
+ replace: s ?? "½"
41
+ }), Q = (s) => t({
42
+ find: /\+\/-$/,
43
+ replace: s ?? "±"
44
+ }), g = (s) => t({
45
+ find: /!=$/,
46
+ replace: s ?? "≠"
47
+ }), $ = (s) => t({
48
+ find: /<<$/,
49
+ replace: s ?? "«"
50
+ }), d = (s) => t({
51
+ find: />>$/,
52
+ replace: s ?? "»"
53
+ }), B = (s) => t({
54
+ find: /\d+\s?([*x])\s?\d+$/,
55
+ replace: s ?? "×"
56
+ }), D = (s) => t({
57
+ find: /\^2$/,
58
+ replace: s ?? "²"
59
+ }), A = (s) => t({
60
+ find: /\^3$/,
61
+ replace: s ?? "³"
62
+ }), T = (s) => t({
63
+ find: /(?:^|\s)(1\/4)\s$/,
64
+ replace: s ?? "¼"
65
+ }), k = (s) => t({
66
+ find: /(?:^|\s)(3\/4)\s$/,
67
+ replace: s ?? "¾"
68
+ }), w = i.create({
69
+ name: "typography",
70
+ addOptions() {
71
+ return {
72
+ closeDoubleQuote: "”",
73
+ closeSingleQuote: "’",
74
+ copyright: "©",
75
+ ellipsis: "…",
76
+ emDash: "—",
77
+ laquo: "«",
78
+ leftArrow: "←",
79
+ multiplication: "×",
80
+ notEqual: "≠",
81
+ oneHalf: "½",
82
+ oneQuarter: "¼",
83
+ openDoubleQuote: "“",
84
+ openSingleQuote: "‘",
85
+ plusMinus: "±",
86
+ raquo: "»",
87
+ registeredTrademark: "®",
88
+ rightArrow: "→",
89
+ servicemark: "℠",
90
+ superscriptThree: "³",
91
+ superscriptTwo: "²",
92
+ threeQuarters: "¾",
93
+ trademark: "™"
94
+ };
95
+ },
96
+ addInputRules() {
97
+ const s = [];
98
+ return this.options.emDash !== !1 && s.push(e(this.options.emDash)), this.options.ellipsis !== !1 && s.push(o(this.options.ellipsis)), this.options.openDoubleQuote !== !1 && s.push(l(this.options.openDoubleQuote)), this.options.closeDoubleQuote !== !1 && s.push(u(this.options.closeDoubleQuote)), this.options.openSingleQuote !== !1 && s.push(p(this.options.openSingleQuote)), this.options.closeSingleQuote !== !1 && s.push(n(this.options.closeSingleQuote)), this.options.leftArrow !== !1 && s.push(a(this.options.leftArrow)), this.options.rightArrow !== !1 && s.push(r(this.options.rightArrow)), this.options.copyright !== !1 && s.push(h(this.options.copyright)), this.options.trademark !== !1 && s.push(f(this.options.trademark)), this.options.servicemark !== !1 && s.push(c(this.options.servicemark)), this.options.registeredTrademark !== !1 && s.push(x(this.options.registeredTrademark)), this.options.oneHalf !== !1 && s.push(m(this.options.oneHalf)), this.options.plusMinus !== !1 && s.push(Q(this.options.plusMinus)), this.options.notEqual !== !1 && s.push(g(this.options.notEqual)), this.options.laquo !== !1 && s.push($(this.options.laquo)), this.options.raquo !== !1 && s.push(d(this.options.raquo)), this.options.multiplication !== !1 && s.push(B(this.options.multiplication)), this.options.superscriptTwo !== !1 && s.push(D(this.options.superscriptTwo)), this.options.superscriptThree !== !1 && s.push(A(this.options.superscriptThree)), this.options.oneQuarter !== !1 && s.push(T(this.options.oneQuarter)), this.options.threeQuarters !== !1 && s.push(k(this.options.threeQuarters)), s;
99
+ }
100
+ });
101
+ export {
102
+ w as Typography,
103
+ u as closeDoubleQuote,
104
+ n as closeSingleQuote,
105
+ h as copyright,
106
+ o as ellipsis,
107
+ e as emDash,
108
+ $ as laquo,
109
+ a as leftArrow,
110
+ B as multiplication,
111
+ g as notEqual,
112
+ m as oneHalf,
113
+ T as oneQuarter,
114
+ l as openDoubleQuote,
115
+ p as openSingleQuote,
116
+ Q as plusMinus,
117
+ d as raquo,
118
+ x as registeredTrademark,
119
+ r as rightArrow,
120
+ c as servicemark,
121
+ A as superscriptThree,
122
+ D as superscriptTwo,
123
+ k as threeQuarters,
124
+ f as trademark
125
+ };