@dooherceg/tiptap-controlled-editor-with-table 0.0.4 → 0.0.6
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.
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { EditorOptions } from '@tiptap/react';
|
|
2
|
-
|
|
1
|
+
import { Editor, EditorOptions } from '@tiptap/react';
|
|
2
|
+
import { Ref } from 'react';
|
|
3
|
+
export interface SimpleEditorProps extends Omit<Partial<EditorOptions>, "content"> {
|
|
3
4
|
themeMode: "dark" | "light";
|
|
4
5
|
content?: string;
|
|
5
6
|
onContentChange?: (content: string) => void;
|
|
6
7
|
placeholder?: string;
|
|
8
|
+
ref?: Ref<SimpleEditorRef>;
|
|
7
9
|
}
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
+
export interface SimpleEditorRef {
|
|
11
|
+
getEditor: () => Editor | null;
|
|
12
|
+
}
|
|
13
|
+
export declare function SimpleEditor({ themeMode, content, onContentChange, placeholder, ref, }: SimpleEditorProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
import { jsx as p, jsxs as w, Fragment as at } from "react/jsx-runtime";
|
|
2
2
|
import { useEditor as Ct, EditorContext as Lt, EditorContent as wt } from "@tiptap/react";
|
|
3
|
-
import { useState as vt, useRef as q, useEffect as D } from "react";
|
|
4
|
-
import { Mark as Q, markPasteRule as
|
|
5
|
-
import { Plugin as H, PluginKey as E, TextSelection as
|
|
6
|
-
import { dropCursor as
|
|
3
|
+
import { useState as vt, useRef as q, useEffect as D, useImperativeHandle as Mt } from "react";
|
|
4
|
+
import { Mark as Q, markPasteRule as xt, markInputRule as At, mergeAttributes as k, Node as L, nodeInputRule as It, ResizableNodeView as St, wrappingInputRule as S, renderNestedMarkdownContent as lt, Extension as C, parseIndentedBlocks as F, isNodeActive as _, isAtStartOfNode as Ht, isAtEndOfNode as Et, getNodeType as ut, getNodeAtPosition as $t, textInputRule as y, callOrReturn as dt, getExtensionField as ct, isNodeEmpty as Nt, isNodeSelection as Rt, findParentNodeClosestToPos as Pt } from "@tiptap/core";
|
|
5
|
+
import { Plugin as H, PluginKey as E, TextSelection as Bt } from "prosemirror-state";
|
|
6
|
+
import { dropCursor as Ot } from "prosemirror-dropcursor";
|
|
7
7
|
import { DecorationSet as B, Decoration as K } from "prosemirror-view";
|
|
8
|
-
import { gapCursor as
|
|
9
|
-
import { history as
|
|
10
|
-
import { StarterKit as
|
|
11
|
-
import { HorizontalRule as
|
|
12
|
-
import { ImageUploadNode as
|
|
13
|
-
import { ArrowLeftIcon as
|
|
14
|
-
import { HighlighterIcon as
|
|
15
|
-
import { LinkIcon as
|
|
16
|
-
import { useCursorVisibility as
|
|
17
|
-
import { useIsMobile as
|
|
18
|
-
import { useWindowSize as
|
|
19
|
-
import { handleImageUpload as
|
|
20
|
-
import { InsertTableButton as
|
|
21
|
-
import
|
|
22
|
-
import { useTiptapEditor as
|
|
23
|
-
import { columnResizing as
|
|
24
|
-
import { Toolbar as
|
|
8
|
+
import { gapCursor as Dt } from "prosemirror-gapcursor";
|
|
9
|
+
import { history as _t, redo as zt, undo as Wt } from "prosemirror-history";
|
|
10
|
+
import { StarterKit as jt } from "@tiptap/starter-kit";
|
|
11
|
+
import { HorizontalRule as Qt } from "../../tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.js";
|
|
12
|
+
import { ImageUploadNode as Kt } from "../../tiptap-node/image-upload-node/image-upload-node-extension.js";
|
|
13
|
+
import { ArrowLeftIcon as Vt } from "../../tiptap-icons/arrow-left-icon.js";
|
|
14
|
+
import { HighlighterIcon as qt } from "../../tiptap-icons/highlighter-icon.js";
|
|
15
|
+
import { LinkIcon as Ft } from "../../tiptap-icons/link-icon.js";
|
|
16
|
+
import { useCursorVisibility as Ut } from "../../../hooks/use-cursor-visibility.js";
|
|
17
|
+
import { useIsMobile as Gt } from "../../../hooks/use-mobile.js";
|
|
18
|
+
import { useWindowSize as Xt } from "../../../hooks/use-window-size.js";
|
|
19
|
+
import { handleImageUpload as Yt, MAX_FILE_SIZE as Zt } from "../../../lib/tiptap-utils.js";
|
|
20
|
+
import { InsertTableButton as Jt } from "../../tiptap-ui/insert-table-button/insert-table-button.js";
|
|
21
|
+
import te from "../../tiptap-ui/table-actions-toolbar/table-actions-toolbar.js";
|
|
22
|
+
import { useTiptapEditor as ee } from "../../../hooks/use-tiptap-editor.js";
|
|
23
|
+
import { columnResizing as re, tableEditing as ne, CellSelection as pt, fixTables as se, goToNextCell as U, setCellAttr as ie, mergeCells as G, splitCell as X, toggleHeaderCell as oe, toggleHeader as Y, deleteTable as ae, deleteRow as le, addRowAfter as ue, addRowBefore as de, deleteColumn as ce, addColumnAfter as pe, addColumnBefore as he } from "prosemirror-tables";
|
|
24
|
+
import { Toolbar as fe, ToolbarGroup as x, ToolbarSeparator as A } from "../../tiptap-ui-primitive/toolbar/toolbar.js";
|
|
25
25
|
import { UndoRedoButton as Z } from "../../tiptap-ui/undo-redo-button/undo-redo-button.js";
|
|
26
|
-
import { HeadingDropdownMenu as
|
|
27
|
-
import { ListDropdownMenu as
|
|
28
|
-
import { BlockquoteButton as
|
|
29
|
-
import { CodeBlockButton as
|
|
26
|
+
import { HeadingDropdownMenu as me } from "../../tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.js";
|
|
27
|
+
import { ListDropdownMenu as ge } from "../../tiptap-ui/list-dropdown-menu/list-dropdown-menu.js";
|
|
28
|
+
import { BlockquoteButton as be } from "../../tiptap-ui/blockquote-button/blockquote-button.js";
|
|
29
|
+
import { CodeBlockButton as ye } from "../../tiptap-ui/code-block-button/code-block-button.js";
|
|
30
30
|
import { MarkButton as M } from "../../tiptap-ui/mark-button/mark-button.js";
|
|
31
|
-
import { ColorHighlightPopover as
|
|
32
|
-
import { LinkPopover as
|
|
31
|
+
import { ColorHighlightPopover as ke, ColorHighlightPopoverButton as Te, ColorHighlightPopoverContent as Ce } from "../../tiptap-ui/color-highlight-popover/color-highlight-popover.js";
|
|
32
|
+
import { LinkPopover as Le, LinkButton as we, LinkContent as ve } from "../../tiptap-ui/link-popover/link-popover.js";
|
|
33
33
|
import { TextAlignButton as R } from "../../tiptap-ui/text-align-button/text-align-button.js";
|
|
34
|
-
import { Button as
|
|
35
|
-
import '../../../assets/simple-editor.css';var
|
|
34
|
+
import { Button as Me } from "../../tiptap-ui-primitive/button/button.js";
|
|
35
|
+
import '../../../assets/simple-editor.css';var xe = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, Ae = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, Ie = Q.create({
|
|
36
36
|
name: "highlight",
|
|
37
37
|
addOptions() {
|
|
38
38
|
return {
|
|
@@ -95,21 +95,21 @@ import '../../../assets/simple-editor.css';var Me = /(?:^|\s)(==(?!\s+==)((?:[^=
|
|
|
95
95
|
},
|
|
96
96
|
addInputRules() {
|
|
97
97
|
return [
|
|
98
|
-
|
|
99
|
-
find:
|
|
98
|
+
At({
|
|
99
|
+
find: xe,
|
|
100
100
|
type: this.type
|
|
101
101
|
})
|
|
102
102
|
];
|
|
103
103
|
},
|
|
104
104
|
addPasteRules() {
|
|
105
105
|
return [
|
|
106
|
-
|
|
107
|
-
find:
|
|
106
|
+
xt({
|
|
107
|
+
find: Ae,
|
|
108
108
|
type: this.type
|
|
109
109
|
})
|
|
110
110
|
];
|
|
111
111
|
}
|
|
112
|
-
}),
|
|
112
|
+
}), Se = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, He = L.create({
|
|
113
113
|
name: "image",
|
|
114
114
|
addOptions() {
|
|
115
115
|
return {
|
|
@@ -171,32 +171,32 @@ import '../../../assets/simple-editor.css';var Me = /(?:^|\s)(==(?!\s+==)((?:[^=
|
|
|
171
171
|
const { directions: t, minWidth: e, minHeight: r, alwaysPreserveAspectRatio: n } = this.options.resize;
|
|
172
172
|
return ({ node: s, getPos: i, HTMLAttributes: a }) => {
|
|
173
173
|
const o = document.createElement("img");
|
|
174
|
-
Object.entries(a).forEach(([
|
|
175
|
-
if (
|
|
176
|
-
switch (
|
|
174
|
+
Object.entries(a).forEach(([d, u]) => {
|
|
175
|
+
if (u != null)
|
|
176
|
+
switch (d) {
|
|
177
177
|
case "width":
|
|
178
178
|
case "height":
|
|
179
179
|
break;
|
|
180
180
|
default:
|
|
181
|
-
o.setAttribute(
|
|
181
|
+
o.setAttribute(d, u);
|
|
182
182
|
break;
|
|
183
183
|
}
|
|
184
184
|
}), o.src = a.src;
|
|
185
|
-
const c = new
|
|
185
|
+
const c = new St({
|
|
186
186
|
element: o,
|
|
187
187
|
node: s,
|
|
188
188
|
getPos: i,
|
|
189
|
-
onResize: (
|
|
190
|
-
o.style.width = `${
|
|
189
|
+
onResize: (d, u) => {
|
|
190
|
+
o.style.width = `${d}px`, o.style.height = `${u}px`;
|
|
191
191
|
},
|
|
192
|
-
onCommit: (
|
|
192
|
+
onCommit: (d, u) => {
|
|
193
193
|
const h = i();
|
|
194
194
|
h !== void 0 && this.editor.chain().setNodeSelection(h).updateAttributes(this.name, {
|
|
195
|
-
width:
|
|
196
|
-
height:
|
|
195
|
+
width: d,
|
|
196
|
+
height: u
|
|
197
197
|
}).run();
|
|
198
198
|
},
|
|
199
|
-
onUpdate: (
|
|
199
|
+
onUpdate: (d, u, h) => d.type === s.type,
|
|
200
200
|
options: {
|
|
201
201
|
directions: t,
|
|
202
202
|
min: {
|
|
@@ -221,8 +221,8 @@ import '../../../assets/simple-editor.css';var Me = /(?:^|\s)(==(?!\s+==)((?:[^=
|
|
|
221
221
|
},
|
|
222
222
|
addInputRules() {
|
|
223
223
|
return [
|
|
224
|
-
|
|
225
|
-
find:
|
|
224
|
+
It({
|
|
225
|
+
find: Se,
|
|
226
226
|
type: this.type,
|
|
227
227
|
getAttributes: (t) => {
|
|
228
228
|
const [, , e, r, n] = t;
|
|
@@ -231,10 +231,10 @@ import '../../../assets/simple-editor.css';var Me = /(?:^|\s)(==(?!\s+==)((?:[^=
|
|
|
231
231
|
})
|
|
232
232
|
];
|
|
233
233
|
}
|
|
234
|
-
}),
|
|
234
|
+
}), Ee = Object.defineProperty, $e = (t, e) => {
|
|
235
235
|
for (var r in e)
|
|
236
|
-
|
|
237
|
-
},
|
|
236
|
+
Ee(t, r, { get: e[r], enumerable: !0 });
|
|
237
|
+
}, Ne = "listItem", J = "textStyle", tt = /^\s*([-+*])\s$/, Re = L.create({
|
|
238
238
|
name: "bulletList",
|
|
239
239
|
addOptions() {
|
|
240
240
|
return {
|
|
@@ -266,7 +266,7 @@ import '../../../assets/simple-editor.css';var Me = /(?:^|\s)(==(?!\s+==)((?:[^=
|
|
|
266
266
|
},
|
|
267
267
|
addCommands() {
|
|
268
268
|
return {
|
|
269
|
-
toggleBulletList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(
|
|
269
|
+
toggleBulletList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Ne, this.editor.getAttributes(J)).run() : t.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
270
270
|
};
|
|
271
271
|
},
|
|
272
272
|
addKeyboardShortcuts() {
|
|
@@ -288,7 +288,7 @@ import '../../../assets/simple-editor.css';var Me = /(?:^|\s)(==(?!\s+==)((?:[^=
|
|
|
288
288
|
editor: this.editor
|
|
289
289
|
})), [t];
|
|
290
290
|
}
|
|
291
|
-
}),
|
|
291
|
+
}), Pe = L.create({
|
|
292
292
|
name: "listItem",
|
|
293
293
|
addOptions() {
|
|
294
294
|
return {
|
|
@@ -355,14 +355,14 @@ import '../../../assets/simple-editor.css';var Me = /(?:^|\s)(==(?!\s+==)((?:[^=
|
|
|
355
355
|
"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
|
|
356
356
|
};
|
|
357
357
|
}
|
|
358
|
-
}),
|
|
359
|
-
|
|
358
|
+
}), Be = {};
|
|
359
|
+
$e(Be, {
|
|
360
360
|
findListItemPos: () => $,
|
|
361
361
|
getNextListDepth: () => V,
|
|
362
362
|
handleBackspace: () => z,
|
|
363
363
|
handleDelete: () => W,
|
|
364
364
|
hasListBefore: () => ht,
|
|
365
|
-
hasListItemAfter: () =>
|
|
365
|
+
hasListItemAfter: () => Oe,
|
|
366
366
|
hasListItemBefore: () => ft,
|
|
367
367
|
listItemHasSubList: () => mt,
|
|
368
368
|
nextListIsDeeper: () => gt,
|
|
@@ -378,7 +378,7 @@ var $ = (t, e) => {
|
|
|
378
378
|
const r = $(t, e);
|
|
379
379
|
if (!r)
|
|
380
380
|
return !1;
|
|
381
|
-
const [, n] =
|
|
381
|
+
const [, n] = $t(e, t, r.$pos.pos + 4);
|
|
382
382
|
return n;
|
|
383
383
|
}, ht = (t, e, r) => {
|
|
384
384
|
const { $anchor: n } = t.selection, s = Math.max(0, n.pos - 2), i = t.doc.resolve(s).node();
|
|
@@ -402,16 +402,16 @@ var $ = (t, e) => {
|
|
|
402
402
|
return !1;
|
|
403
403
|
if (!_(t.state, e) && ht(t.state, e, r)) {
|
|
404
404
|
const { $anchor: o } = t.state.selection, c = t.state.doc.resolve(o.before() - 1), l = [];
|
|
405
|
-
c.node().descendants((h,
|
|
406
|
-
h.type.name === e && l.push({ node: h, pos:
|
|
405
|
+
c.node().descendants((h, m) => {
|
|
406
|
+
h.type.name === e && l.push({ node: h, pos: m });
|
|
407
407
|
});
|
|
408
|
-
const
|
|
409
|
-
if (!
|
|
408
|
+
const d = l.at(-1);
|
|
409
|
+
if (!d)
|
|
410
410
|
return !1;
|
|
411
|
-
const
|
|
412
|
-
return t.chain().cut({ from: o.start() - 1, to: o.end() + 1 },
|
|
411
|
+
const u = t.state.doc.resolve(c.start() + d.pos + 1);
|
|
412
|
+
return t.chain().cut({ from: o.start() - 1, to: o.end() + 1 }, u.end()).joinForward().run();
|
|
413
413
|
}
|
|
414
|
-
if (!_(t.state, e) || !
|
|
414
|
+
if (!_(t.state, e) || !Ht(t.state))
|
|
415
415
|
return !1;
|
|
416
416
|
const n = $(e, t.state);
|
|
417
417
|
if (!n)
|
|
@@ -425,15 +425,15 @@ var $ = (t, e) => {
|
|
|
425
425
|
const r = V(t, e), n = $(t, e);
|
|
426
426
|
return !n || !r ? !1 : r < n.depth;
|
|
427
427
|
}, W = (t, e) => {
|
|
428
|
-
if (!_(t.state, e) || !
|
|
428
|
+
if (!_(t.state, e) || !Et(t.state, e))
|
|
429
429
|
return !1;
|
|
430
430
|
const { selection: r } = t.state, { $from: n, $to: s } = r;
|
|
431
431
|
return !r.empty && n.sameParent(s) ? !1 : gt(e, t.state) ? t.chain().focus(t.state.selection.from + 4).lift(e).joinBackward().run() : bt(e, t.state) ? t.chain().joinForward().joinBackward().run() : t.commands.joinItemForward();
|
|
432
|
-
},
|
|
432
|
+
}, Oe = (t, e) => {
|
|
433
433
|
var r;
|
|
434
434
|
const { $anchor: n } = e.selection, s = e.doc.resolve(n.pos - n.parentOffset - 2);
|
|
435
435
|
return !(s.index() === s.parent.childCount - 1 || ((r = s.nodeAfter) == null ? void 0 : r.type.name) !== t);
|
|
436
|
-
},
|
|
436
|
+
}, De = C.create({
|
|
437
437
|
name: "listKeymap",
|
|
438
438
|
addOptions() {
|
|
439
439
|
return {
|
|
@@ -477,8 +477,8 @@ var $ = (t, e) => {
|
|
|
477
477
|
}
|
|
478
478
|
};
|
|
479
479
|
}
|
|
480
|
-
}), et = /^(\s*)(\d+)\.\s+(.*)$/,
|
|
481
|
-
function
|
|
480
|
+
}), et = /^(\s*)(\d+)\.\s+(.*)$/, _e = /^\s/;
|
|
481
|
+
function ze(t) {
|
|
482
482
|
const e = [];
|
|
483
483
|
let r = 0, n = 0;
|
|
484
484
|
for (; r < t.length; ) {
|
|
@@ -486,28 +486,28 @@ function _e(t) {
|
|
|
486
486
|
if (!i)
|
|
487
487
|
break;
|
|
488
488
|
const [, a, o, c] = i, l = a.length;
|
|
489
|
-
let
|
|
489
|
+
let d = c, u = r + 1;
|
|
490
490
|
const h = [s];
|
|
491
|
-
for (;
|
|
492
|
-
const
|
|
493
|
-
if (
|
|
491
|
+
for (; u < t.length; ) {
|
|
492
|
+
const m = t[u];
|
|
493
|
+
if (m.match(et))
|
|
494
494
|
break;
|
|
495
|
-
if (
|
|
496
|
-
h.push(
|
|
497
|
-
`,
|
|
498
|
-
else if (
|
|
499
|
-
h.push(
|
|
500
|
-
${
|
|
495
|
+
if (m.trim() === "")
|
|
496
|
+
h.push(m), d += `
|
|
497
|
+
`, u += 1;
|
|
498
|
+
else if (m.match(_e))
|
|
499
|
+
h.push(m), d += `
|
|
500
|
+
${m.slice(l + 2)}`, u += 1;
|
|
501
501
|
else
|
|
502
502
|
break;
|
|
503
503
|
}
|
|
504
504
|
e.push({
|
|
505
505
|
indent: l,
|
|
506
506
|
number: parseInt(o, 10),
|
|
507
|
-
content:
|
|
507
|
+
content: d.trim(),
|
|
508
508
|
raw: h.join(`
|
|
509
509
|
`)
|
|
510
|
-
}), n =
|
|
510
|
+
}), n = u, r = u;
|
|
511
511
|
}
|
|
512
512
|
return [e, n];
|
|
513
513
|
}
|
|
@@ -525,24 +525,24 @@ function yt(t, e, r) {
|
|
|
525
525
|
raw: c,
|
|
526
526
|
tokens: r.inlineTokens(c)
|
|
527
527
|
});
|
|
528
|
-
const
|
|
528
|
+
const d = o.slice(1).join(`
|
|
529
529
|
`).trim();
|
|
530
|
-
if (
|
|
531
|
-
const
|
|
532
|
-
l.push(...
|
|
530
|
+
if (d) {
|
|
531
|
+
const m = r.blockTokens(d);
|
|
532
|
+
l.push(...m);
|
|
533
533
|
}
|
|
534
|
-
let
|
|
534
|
+
let u = i + 1;
|
|
535
535
|
const h = [];
|
|
536
|
-
for (;
|
|
537
|
-
h.push(t[
|
|
536
|
+
for (; u < t.length && t[u].indent > e; )
|
|
537
|
+
h.push(t[u]), u += 1;
|
|
538
538
|
if (h.length > 0) {
|
|
539
|
-
const
|
|
539
|
+
const m = Math.min(...h.map((b) => b.indent)), f = yt(h, m, r);
|
|
540
540
|
l.push({
|
|
541
541
|
type: "list",
|
|
542
542
|
ordered: !0,
|
|
543
543
|
start: h[0].number,
|
|
544
544
|
items: f,
|
|
545
|
-
raw: h.map((
|
|
545
|
+
raw: h.map((b) => b.raw).join(`
|
|
546
546
|
`)
|
|
547
547
|
});
|
|
548
548
|
}
|
|
@@ -550,13 +550,13 @@ function yt(t, e, r) {
|
|
|
550
550
|
type: "list_item",
|
|
551
551
|
raw: a.raw,
|
|
552
552
|
tokens: l
|
|
553
|
-
}), i =
|
|
553
|
+
}), i = u;
|
|
554
554
|
} else
|
|
555
555
|
i += 1;
|
|
556
556
|
}
|
|
557
557
|
return s;
|
|
558
558
|
}
|
|
559
|
-
function
|
|
559
|
+
function We(t, e) {
|
|
560
560
|
return t.map((r) => {
|
|
561
561
|
if (r.type !== "list_item")
|
|
562
562
|
return e.parseChildren([r])[0];
|
|
@@ -580,7 +580,7 @@ function ze(t, e) {
|
|
|
580
580
|
};
|
|
581
581
|
});
|
|
582
582
|
}
|
|
583
|
-
var
|
|
583
|
+
var je = "listItem", rt = "textStyle", nt = /^(\d+)\.\s$/, Qe = L.create({
|
|
584
584
|
name: "orderedList",
|
|
585
585
|
addOptions() {
|
|
586
586
|
return {
|
|
@@ -621,7 +621,7 @@ var We = "listItem", rt = "textStyle", nt = /^(\d+)\.\s$/, je = L.create({
|
|
|
621
621
|
parseMarkdown: (t, e) => {
|
|
622
622
|
if (t.type !== "list" || !t.ordered)
|
|
623
623
|
return [];
|
|
624
|
-
const r = t.start || 1, n = t.items ?
|
|
624
|
+
const r = t.start || 1, n = t.items ? We(t.items, e) : [];
|
|
625
625
|
return r !== 1 ? {
|
|
626
626
|
type: "orderedList",
|
|
627
627
|
attrs: { start: r },
|
|
@@ -643,7 +643,7 @@ var We = "listItem", rt = "textStyle", nt = /^(\d+)\.\s$/, je = L.create({
|
|
|
643
643
|
tokenize: (t, e, r) => {
|
|
644
644
|
var n;
|
|
645
645
|
const s = t.split(`
|
|
646
|
-
`), [i, a] =
|
|
646
|
+
`), [i, a] = ze(s);
|
|
647
647
|
if (i.length === 0)
|
|
648
648
|
return;
|
|
649
649
|
const o = yt(i, 0, r);
|
|
@@ -662,7 +662,7 @@ var We = "listItem", rt = "textStyle", nt = /^(\d+)\.\s$/, je = L.create({
|
|
|
662
662
|
},
|
|
663
663
|
addCommands() {
|
|
664
664
|
return {
|
|
665
|
-
toggleOrderedList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(
|
|
665
|
+
toggleOrderedList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(je, this.editor.getAttributes(rt)).run() : t.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
666
666
|
};
|
|
667
667
|
},
|
|
668
668
|
addKeyboardShortcuts() {
|
|
@@ -687,7 +687,7 @@ var We = "listItem", rt = "textStyle", nt = /^(\d+)\.\s$/, je = L.create({
|
|
|
687
687
|
editor: this.editor
|
|
688
688
|
})), [t];
|
|
689
689
|
}
|
|
690
|
-
}),
|
|
690
|
+
}), Ke = /^\s*(\[([( |x])?\])\s$/, kt = L.create({
|
|
691
691
|
name: "taskItem",
|
|
692
692
|
addOptions() {
|
|
693
693
|
return {
|
|
@@ -769,41 +769,41 @@ var We = "listItem", rt = "textStyle", nt = /^(\d+)\.\s$/, je = L.create({
|
|
|
769
769
|
},
|
|
770
770
|
addNodeView() {
|
|
771
771
|
return ({ node: t, HTMLAttributes: e, getPos: r, editor: n }) => {
|
|
772
|
-
const s = document.createElement("li"), i = document.createElement("label"), a = document.createElement("span"), o = document.createElement("input"), c = document.createElement("div"), l = (
|
|
773
|
-
var
|
|
774
|
-
o.ariaLabel = ((h = (
|
|
772
|
+
const s = document.createElement("li"), i = document.createElement("label"), a = document.createElement("span"), o = document.createElement("input"), c = document.createElement("div"), l = (d) => {
|
|
773
|
+
var u, h;
|
|
774
|
+
o.ariaLabel = ((h = (u = this.options.a11y) == null ? void 0 : u.checkboxLabel) == null ? void 0 : h.call(u, d, o.checked)) || `Task item checkbox for ${d.textContent || "empty task item"}`;
|
|
775
775
|
};
|
|
776
|
-
return l(t), i.contentEditable = "false", o.type = "checkbox", o.addEventListener("mousedown", (
|
|
776
|
+
return l(t), i.contentEditable = "false", o.type = "checkbox", o.addEventListener("mousedown", (d) => d.preventDefault()), o.addEventListener("change", (d) => {
|
|
777
777
|
if (!n.isEditable && !this.options.onReadOnlyChecked) {
|
|
778
778
|
o.checked = !o.checked;
|
|
779
779
|
return;
|
|
780
780
|
}
|
|
781
|
-
const { checked:
|
|
781
|
+
const { checked: u } = d.target;
|
|
782
782
|
n.isEditable && typeof r == "function" && n.chain().focus(void 0, { scrollIntoView: !1 }).command(({ tr: h }) => {
|
|
783
|
-
const
|
|
784
|
-
if (typeof
|
|
783
|
+
const m = r();
|
|
784
|
+
if (typeof m != "number")
|
|
785
785
|
return !1;
|
|
786
|
-
const f = h.doc.nodeAt(
|
|
787
|
-
return h.setNodeMarkup(
|
|
786
|
+
const f = h.doc.nodeAt(m);
|
|
787
|
+
return h.setNodeMarkup(m, void 0, {
|
|
788
788
|
...f?.attrs,
|
|
789
|
-
checked:
|
|
789
|
+
checked: u
|
|
790
790
|
}), !0;
|
|
791
|
-
}).run(), !n.isEditable && this.options.onReadOnlyChecked && (this.options.onReadOnlyChecked(t,
|
|
792
|
-
}), Object.entries(this.options.HTMLAttributes).forEach(([
|
|
793
|
-
s.setAttribute(
|
|
794
|
-
}), s.dataset.checked = t.attrs.checked, o.checked = t.attrs.checked, i.append(o, a), s.append(i, c), Object.entries(e).forEach(([
|
|
795
|
-
s.setAttribute(
|
|
791
|
+
}).run(), !n.isEditable && this.options.onReadOnlyChecked && (this.options.onReadOnlyChecked(t, u) || (o.checked = !o.checked));
|
|
792
|
+
}), Object.entries(this.options.HTMLAttributes).forEach(([d, u]) => {
|
|
793
|
+
s.setAttribute(d, u);
|
|
794
|
+
}), s.dataset.checked = t.attrs.checked, o.checked = t.attrs.checked, i.append(o, a), s.append(i, c), Object.entries(e).forEach(([d, u]) => {
|
|
795
|
+
s.setAttribute(d, u);
|
|
796
796
|
}), {
|
|
797
797
|
dom: s,
|
|
798
798
|
contentDOM: c,
|
|
799
|
-
update: (
|
|
799
|
+
update: (d) => d.type !== this.type ? !1 : (s.dataset.checked = d.attrs.checked, o.checked = d.attrs.checked, l(d), !0)
|
|
800
800
|
};
|
|
801
801
|
};
|
|
802
802
|
},
|
|
803
803
|
addInputRules() {
|
|
804
804
|
return [
|
|
805
805
|
S({
|
|
806
|
-
find:
|
|
806
|
+
find: Ke,
|
|
807
807
|
type: this.type,
|
|
808
808
|
getAttributes: (t) => ({
|
|
809
809
|
checked: t[t.length - 1] === "x"
|
|
@@ -928,10 +928,10 @@ C.create({
|
|
|
928
928
|
name: "listKit",
|
|
929
929
|
addExtensions() {
|
|
930
930
|
const t = [];
|
|
931
|
-
return this.options.bulletList !== !1 && t.push(
|
|
931
|
+
return this.options.bulletList !== !1 && t.push(Re.configure(this.options.bulletList)), this.options.listItem !== !1 && t.push(Pe.configure(this.options.listItem)), this.options.listKeymap !== !1 && t.push(De.configure(this.options.listKeymap)), this.options.orderedList !== !1 && t.push(Qe.configure(this.options.orderedList)), this.options.taskItem !== !1 && t.push(kt.configure(this.options.taskItem)), this.options.taskList !== !1 && t.push(Tt.configure(this.options.taskList)), t;
|
|
932
932
|
}
|
|
933
933
|
});
|
|
934
|
-
var
|
|
934
|
+
var Ve = Q.create({
|
|
935
935
|
name: "subscript",
|
|
936
936
|
addOptions() {
|
|
937
937
|
return {
|
|
@@ -966,7 +966,7 @@ var Ke = Q.create({
|
|
|
966
966
|
"Mod-,": () => this.editor.commands.toggleSubscript()
|
|
967
967
|
};
|
|
968
968
|
}
|
|
969
|
-
}),
|
|
969
|
+
}), qe = Q.create({
|
|
970
970
|
name: "superscript",
|
|
971
971
|
addOptions() {
|
|
972
972
|
return {
|
|
@@ -1001,7 +1001,7 @@ var Ke = Q.create({
|
|
|
1001
1001
|
"Mod-.": () => this.editor.commands.toggleSuperscript()
|
|
1002
1002
|
};
|
|
1003
1003
|
}
|
|
1004
|
-
}),
|
|
1004
|
+
}), Fe = C.create({
|
|
1005
1005
|
name: "textAlign",
|
|
1006
1006
|
addOptions() {
|
|
1007
1007
|
return {
|
|
@@ -1042,73 +1042,73 @@ var Ke = Q.create({
|
|
|
1042
1042
|
"Mod-Shift-j": () => this.editor.commands.setTextAlign("justify")
|
|
1043
1043
|
};
|
|
1044
1044
|
}
|
|
1045
|
-
}),
|
|
1045
|
+
}), Ue = (t) => y({
|
|
1046
1046
|
find: /--$/,
|
|
1047
1047
|
replace: t ?? "—"
|
|
1048
|
-
}),
|
|
1048
|
+
}), Ge = (t) => y({
|
|
1049
1049
|
find: /\.\.\.$/,
|
|
1050
1050
|
replace: t ?? "…"
|
|
1051
|
-
}),
|
|
1051
|
+
}), Xe = (t) => y({
|
|
1052
1052
|
find: /(?:^|[\s{[(<'"\u2018\u201C])(")$/,
|
|
1053
1053
|
replace: t ?? "“"
|
|
1054
|
-
}),
|
|
1054
|
+
}), Ye = (t) => y({
|
|
1055
1055
|
find: /"$/,
|
|
1056
1056
|
replace: t ?? "”"
|
|
1057
|
-
}),
|
|
1057
|
+
}), Ze = (t) => y({
|
|
1058
1058
|
find: /(?:^|[\s{[(<'"\u2018\u201C])(')$/,
|
|
1059
1059
|
replace: t ?? "‘"
|
|
1060
|
-
}),
|
|
1060
|
+
}), Je = (t) => y({
|
|
1061
1061
|
find: /'$/,
|
|
1062
1062
|
replace: t ?? "’"
|
|
1063
|
-
}),
|
|
1063
|
+
}), tr = (t) => y({
|
|
1064
1064
|
find: /<-$/,
|
|
1065
1065
|
replace: t ?? "←"
|
|
1066
|
-
}),
|
|
1066
|
+
}), er = (t) => y({
|
|
1067
1067
|
find: /->$/,
|
|
1068
1068
|
replace: t ?? "→"
|
|
1069
|
-
}),
|
|
1069
|
+
}), rr = (t) => y({
|
|
1070
1070
|
find: /\(c\)$/,
|
|
1071
1071
|
replace: t ?? "©"
|
|
1072
|
-
}),
|
|
1072
|
+
}), nr = (t) => y({
|
|
1073
1073
|
find: /\(tm\)$/,
|
|
1074
1074
|
replace: t ?? "™"
|
|
1075
|
-
}),
|
|
1075
|
+
}), sr = (t) => y({
|
|
1076
1076
|
find: /\(sm\)$/,
|
|
1077
1077
|
replace: t ?? "℠"
|
|
1078
|
-
}),
|
|
1078
|
+
}), ir = (t) => y({
|
|
1079
1079
|
find: /\(r\)$/,
|
|
1080
1080
|
replace: t ?? "®"
|
|
1081
|
-
}),
|
|
1081
|
+
}), or = (t) => y({
|
|
1082
1082
|
find: /(?:^|\s)(1\/2)\s$/,
|
|
1083
1083
|
replace: t ?? "½"
|
|
1084
|
-
}),
|
|
1084
|
+
}), ar = (t) => y({
|
|
1085
1085
|
find: /\+\/-$/,
|
|
1086
1086
|
replace: t ?? "±"
|
|
1087
|
-
}),
|
|
1087
|
+
}), lr = (t) => y({
|
|
1088
1088
|
find: /!=$/,
|
|
1089
1089
|
replace: t ?? "≠"
|
|
1090
|
-
}),
|
|
1090
|
+
}), ur = (t) => y({
|
|
1091
1091
|
find: /<<$/,
|
|
1092
1092
|
replace: t ?? "«"
|
|
1093
|
-
}),
|
|
1093
|
+
}), dr = (t) => y({
|
|
1094
1094
|
find: />>$/,
|
|
1095
1095
|
replace: t ?? "»"
|
|
1096
|
-
}),
|
|
1096
|
+
}), cr = (t) => y({
|
|
1097
1097
|
find: /\d+\s?([*x])\s?\d+$/,
|
|
1098
1098
|
replace: t ?? "×"
|
|
1099
|
-
}),
|
|
1099
|
+
}), pr = (t) => y({
|
|
1100
1100
|
find: /\^2$/,
|
|
1101
1101
|
replace: t ?? "²"
|
|
1102
|
-
}),
|
|
1102
|
+
}), hr = (t) => y({
|
|
1103
1103
|
find: /\^3$/,
|
|
1104
1104
|
replace: t ?? "³"
|
|
1105
|
-
}),
|
|
1105
|
+
}), fr = (t) => y({
|
|
1106
1106
|
find: /(?:^|\s)(1\/4)\s$/,
|
|
1107
1107
|
replace: t ?? "¼"
|
|
1108
|
-
}),
|
|
1108
|
+
}), mr = (t) => y({
|
|
1109
1109
|
find: /(?:^|\s)(3\/4)\s$/,
|
|
1110
1110
|
replace: t ?? "¾"
|
|
1111
|
-
}),
|
|
1111
|
+
}), gr = C.create({
|
|
1112
1112
|
name: "typography",
|
|
1113
1113
|
addOptions() {
|
|
1114
1114
|
return {
|
|
@@ -1138,7 +1138,7 @@ var Ke = Q.create({
|
|
|
1138
1138
|
},
|
|
1139
1139
|
addInputRules() {
|
|
1140
1140
|
const t = [];
|
|
1141
|
-
return this.options.emDash !== !1 && t.push(
|
|
1141
|
+
return this.options.emDash !== !1 && t.push(Ue(this.options.emDash)), this.options.ellipsis !== !1 && t.push(Ge(this.options.ellipsis)), this.options.openDoubleQuote !== !1 && t.push(Xe(this.options.openDoubleQuote)), this.options.closeDoubleQuote !== !1 && t.push(Ye(this.options.closeDoubleQuote)), this.options.openSingleQuote !== !1 && t.push(Ze(this.options.openSingleQuote)), this.options.closeSingleQuote !== !1 && t.push(Je(this.options.closeSingleQuote)), this.options.leftArrow !== !1 && t.push(tr(this.options.leftArrow)), this.options.rightArrow !== !1 && t.push(er(this.options.rightArrow)), this.options.copyright !== !1 && t.push(rr(this.options.copyright)), this.options.trademark !== !1 && t.push(nr(this.options.trademark)), this.options.servicemark !== !1 && t.push(sr(this.options.servicemark)), this.options.registeredTrademark !== !1 && t.push(ir(this.options.registeredTrademark)), this.options.oneHalf !== !1 && t.push(or(this.options.oneHalf)), this.options.plusMinus !== !1 && t.push(ar(this.options.plusMinus)), this.options.notEqual !== !1 && t.push(lr(this.options.notEqual)), this.options.laquo !== !1 && t.push(ur(this.options.laquo)), this.options.raquo !== !1 && t.push(dr(this.options.raquo)), this.options.multiplication !== !1 && t.push(cr(this.options.multiplication)), this.options.superscriptTwo !== !1 && t.push(pr(this.options.superscriptTwo)), this.options.superscriptThree !== !1 && t.push(hr(this.options.superscriptThree)), this.options.oneQuarter !== !1 && t.push(fr(this.options.oneQuarter)), this.options.threeQuarters !== !1 && t.push(mr(this.options.threeQuarters)), t;
|
|
1142
1142
|
}
|
|
1143
1143
|
});
|
|
1144
1144
|
C.create({
|
|
@@ -1203,8 +1203,8 @@ C.create({
|
|
|
1203
1203
|
return !0;
|
|
1204
1204
|
if (s > n && i > n && i > s || !e.getMeta("paste"))
|
|
1205
1205
|
return !1;
|
|
1206
|
-
const o = e.selection.$head.pos, c = i - n, l = o - c,
|
|
1207
|
-
return e.deleteRange(l,
|
|
1206
|
+
const o = e.selection.$head.pos, c = i - n, l = o - c, d = o;
|
|
1207
|
+
return e.deleteRange(l, d), !(this.storage.characters({ node: e.doc }) > n);
|
|
1208
1208
|
}
|
|
1209
1209
|
})
|
|
1210
1210
|
];
|
|
@@ -1220,7 +1220,7 @@ C.create({
|
|
|
1220
1220
|
};
|
|
1221
1221
|
},
|
|
1222
1222
|
addProseMirrorPlugins() {
|
|
1223
|
-
return [
|
|
1223
|
+
return [Ot(this.options)];
|
|
1224
1224
|
}
|
|
1225
1225
|
});
|
|
1226
1226
|
C.create({
|
|
@@ -1269,7 +1269,7 @@ C.create({
|
|
|
1269
1269
|
C.create({
|
|
1270
1270
|
name: "gapCursor",
|
|
1271
1271
|
addProseMirrorPlugins() {
|
|
1272
|
-
return [
|
|
1272
|
+
return [Dt()];
|
|
1273
1273
|
},
|
|
1274
1274
|
extendNodeSchema(t) {
|
|
1275
1275
|
var e;
|
|
@@ -1283,7 +1283,7 @@ C.create({
|
|
|
1283
1283
|
};
|
|
1284
1284
|
}
|
|
1285
1285
|
});
|
|
1286
|
-
var
|
|
1286
|
+
var br = C.create({
|
|
1287
1287
|
name: "placeholder",
|
|
1288
1288
|
addOptions() {
|
|
1289
1289
|
return {
|
|
@@ -1306,12 +1306,12 @@ var gr = C.create({
|
|
|
1306
1306
|
return null;
|
|
1307
1307
|
const i = this.editor.isEmpty;
|
|
1308
1308
|
return t.descendants((a, o) => {
|
|
1309
|
-
const c = n >= o && n <= o + a.nodeSize, l = !a.isLeaf &&
|
|
1309
|
+
const c = n >= o && n <= o + a.nodeSize, l = !a.isLeaf && Nt(a);
|
|
1310
1310
|
if ((c || !this.options.showOnlyCurrent) && l) {
|
|
1311
|
-
const
|
|
1312
|
-
i &&
|
|
1313
|
-
const
|
|
1314
|
-
class:
|
|
1311
|
+
const d = [this.options.emptyNodeClass];
|
|
1312
|
+
i && d.push(this.options.emptyEditorClass);
|
|
1313
|
+
const u = K.node(o, o + a.nodeSize, {
|
|
1314
|
+
class: d.join(" "),
|
|
1315
1315
|
"data-placeholder": typeof this.options.placeholder == "function" ? this.options.placeholder({
|
|
1316
1316
|
editor: this.editor,
|
|
1317
1317
|
node: a,
|
|
@@ -1319,7 +1319,7 @@ var gr = C.create({
|
|
|
1319
1319
|
hasAnchor: c
|
|
1320
1320
|
}) : this.options.placeholder
|
|
1321
1321
|
});
|
|
1322
|
-
s.push(
|
|
1322
|
+
s.push(u);
|
|
1323
1323
|
}
|
|
1324
1324
|
return this.options.includeChildren;
|
|
1325
1325
|
}), B.create(t, s);
|
|
@@ -1328,7 +1328,7 @@ var gr = C.create({
|
|
|
1328
1328
|
})
|
|
1329
1329
|
];
|
|
1330
1330
|
}
|
|
1331
|
-
}),
|
|
1331
|
+
}), yr = C.create({
|
|
1332
1332
|
name: "selection",
|
|
1333
1333
|
addOptions() {
|
|
1334
1334
|
return {
|
|
@@ -1342,7 +1342,7 @@ var gr = C.create({
|
|
|
1342
1342
|
key: new E("selection"),
|
|
1343
1343
|
props: {
|
|
1344
1344
|
decorations(r) {
|
|
1345
|
-
return r.selection.empty || t.isFocused || !t.isEditable ||
|
|
1345
|
+
return r.selection.empty || t.isFocused || !t.isEditable || Rt(r.selection) || t.view.dragging ? null : B.create(r.doc, [
|
|
1346
1346
|
K.inline(r.selection.from, r.selection.to, {
|
|
1347
1347
|
class: e.className
|
|
1348
1348
|
})
|
|
@@ -1371,9 +1371,9 @@ C.create({
|
|
|
1371
1371
|
new H({
|
|
1372
1372
|
key: e,
|
|
1373
1373
|
appendTransaction: (s, i, a) => {
|
|
1374
|
-
const { doc: o, tr: c, schema: l } = a,
|
|
1375
|
-
if (
|
|
1376
|
-
return c.insert(
|
|
1374
|
+
const { doc: o, tr: c, schema: l } = a, d = e.getState(a), u = o.content.size, h = l.nodes[r];
|
|
1375
|
+
if (d)
|
|
1376
|
+
return c.insert(u, h.create());
|
|
1377
1377
|
},
|
|
1378
1378
|
state: {
|
|
1379
1379
|
init: (s, i) => {
|
|
@@ -1401,12 +1401,12 @@ C.create({
|
|
|
1401
1401
|
},
|
|
1402
1402
|
addCommands() {
|
|
1403
1403
|
return {
|
|
1404
|
-
undo: () => ({ state: t, dispatch: e }) =>
|
|
1405
|
-
redo: () => ({ state: t, dispatch: e }) =>
|
|
1404
|
+
undo: () => ({ state: t, dispatch: e }) => Wt(t, e),
|
|
1405
|
+
redo: () => ({ state: t, dispatch: e }) => zt(t, e)
|
|
1406
1406
|
};
|
|
1407
1407
|
},
|
|
1408
1408
|
addProseMirrorPlugins() {
|
|
1409
|
-
return [
|
|
1409
|
+
return [_t(this.options)];
|
|
1410
1410
|
},
|
|
1411
1411
|
addKeyboardShortcuts() {
|
|
1412
1412
|
return {
|
|
@@ -1419,7 +1419,7 @@ C.create({
|
|
|
1419
1419
|
};
|
|
1420
1420
|
}
|
|
1421
1421
|
});
|
|
1422
|
-
var
|
|
1422
|
+
var kr = L.create({
|
|
1423
1423
|
name: "tableCell",
|
|
1424
1424
|
addOptions() {
|
|
1425
1425
|
return {
|
|
@@ -1460,7 +1460,7 @@ var yr = L.create({
|
|
|
1460
1460
|
renderHTML({ HTMLAttributes: t }) {
|
|
1461
1461
|
return ["td", k(this.options.HTMLAttributes, t), 0];
|
|
1462
1462
|
}
|
|
1463
|
-
}),
|
|
1463
|
+
}), Tr = L.create({
|
|
1464
1464
|
name: "tableHeader",
|
|
1465
1465
|
addOptions() {
|
|
1466
1466
|
return {
|
|
@@ -1493,7 +1493,7 @@ var yr = L.create({
|
|
|
1493
1493
|
renderHTML({ HTMLAttributes: t }) {
|
|
1494
1494
|
return ["th", k(this.options.HTMLAttributes, t), 0];
|
|
1495
1495
|
}
|
|
1496
|
-
}),
|
|
1496
|
+
}), Cr = L.create({
|
|
1497
1497
|
name: "tableRow",
|
|
1498
1498
|
addOptions() {
|
|
1499
1499
|
return {
|
|
@@ -1515,12 +1515,12 @@ function j(t, e) {
|
|
|
1515
1515
|
function it(t, e, r, n, s, i) {
|
|
1516
1516
|
var a;
|
|
1517
1517
|
let o = 0, c = !0, l = e.firstChild;
|
|
1518
|
-
const
|
|
1519
|
-
if (
|
|
1520
|
-
for (let h = 0,
|
|
1521
|
-
const { colspan: f, colwidth:
|
|
1522
|
-
for (let
|
|
1523
|
-
const T = s ===
|
|
1518
|
+
const d = t.firstChild;
|
|
1519
|
+
if (d !== null)
|
|
1520
|
+
for (let h = 0, m = 0; h < d.childCount; h += 1) {
|
|
1521
|
+
const { colspan: f, colwidth: b } = d.child(h).attrs;
|
|
1522
|
+
for (let g = 0; g < f; g += 1, m += 1) {
|
|
1523
|
+
const T = s === m ? i : b && b[g], v = T ? `${T}px` : "";
|
|
1524
1524
|
if (o += T || n, T || (c = !1), l) {
|
|
1525
1525
|
if (l.style.width !== v) {
|
|
1526
1526
|
const [I, N] = j(n, T);
|
|
@@ -1537,10 +1537,10 @@ function it(t, e, r, n, s, i) {
|
|
|
1537
1537
|
const h = l.nextSibling;
|
|
1538
1538
|
(a = l.parentNode) == null || a.removeChild(l), l = h;
|
|
1539
1539
|
}
|
|
1540
|
-
const
|
|
1541
|
-
c && !
|
|
1540
|
+
const u = t.attrs.style && typeof t.attrs.style == "string" && /\bwidth\s*:/i.test(t.attrs.style);
|
|
1541
|
+
c && !u ? (r.style.width = `${o}px`, r.style.minWidth = "") : (r.style.width = "", r.style.minWidth = `${o}px`);
|
|
1542
1542
|
}
|
|
1543
|
-
var
|
|
1543
|
+
var Lr = class {
|
|
1544
1544
|
constructor(t, e) {
|
|
1545
1545
|
this.node = t, this.cellMinWidth = e, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), t.attrs.style && (this.table.style.cssText = t.attrs.style), this.colgroup = this.table.appendChild(document.createElement("colgroup")), it(t, this.colgroup, this.table, e), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
|
|
1546
1546
|
}
|
|
@@ -1552,17 +1552,17 @@ var Cr = class {
|
|
|
1552
1552
|
return !!(r && !n && (t.type === "attributes" || t.type === "childList" || t.type === "characterData"));
|
|
1553
1553
|
}
|
|
1554
1554
|
};
|
|
1555
|
-
function
|
|
1555
|
+
function wr(t, e, r, n) {
|
|
1556
1556
|
let s = 0, i = !0;
|
|
1557
1557
|
const a = [], o = t.firstChild;
|
|
1558
1558
|
if (!o)
|
|
1559
1559
|
return {};
|
|
1560
|
-
for (let
|
|
1561
|
-
const { colspan:
|
|
1562
|
-
for (let
|
|
1563
|
-
const
|
|
1564
|
-
s +=
|
|
1565
|
-
const [T, v] = j(e,
|
|
1560
|
+
for (let u = 0, h = 0; u < o.childCount; u += 1) {
|
|
1561
|
+
const { colspan: m, colwidth: f } = o.child(u).attrs;
|
|
1562
|
+
for (let b = 0; b < m; b += 1, h += 1) {
|
|
1563
|
+
const g = r === h ? n : f && f[b];
|
|
1564
|
+
s += g || e, g || (i = !1);
|
|
1565
|
+
const [T, v] = j(e, g);
|
|
1566
1566
|
a.push(["col", { style: `${T}: ${v}` }]);
|
|
1567
1567
|
}
|
|
1568
1568
|
}
|
|
@@ -1572,7 +1572,7 @@ function Lr(t, e, r, n) {
|
|
|
1572
1572
|
function ot(t, e) {
|
|
1573
1573
|
return t.createAndFill();
|
|
1574
1574
|
}
|
|
1575
|
-
function
|
|
1575
|
+
function vr(t) {
|
|
1576
1576
|
if (t.cached.tableNodeTypes)
|
|
1577
1577
|
return t.cached.tableNodeTypes;
|
|
1578
1578
|
const e = {};
|
|
@@ -1581,13 +1581,13 @@ function wr(t) {
|
|
|
1581
1581
|
n.spec.tableRole && (e[n.spec.tableRole] = n);
|
|
1582
1582
|
}), t.cached.tableNodeTypes = e, e;
|
|
1583
1583
|
}
|
|
1584
|
-
function
|
|
1585
|
-
const i =
|
|
1584
|
+
function Mr(t, e, r, n, s) {
|
|
1585
|
+
const i = vr(t), a = [], o = [];
|
|
1586
1586
|
for (let l = 0; l < r; l += 1) {
|
|
1587
|
-
const
|
|
1588
|
-
if (
|
|
1589
|
-
const
|
|
1590
|
-
|
|
1587
|
+
const d = ot(i.cell);
|
|
1588
|
+
if (d && o.push(d), n) {
|
|
1589
|
+
const u = ot(i.header_cell);
|
|
1590
|
+
u && a.push(u);
|
|
1591
1591
|
}
|
|
1592
1592
|
}
|
|
1593
1593
|
const c = [];
|
|
@@ -1595,62 +1595,62 @@ function vr(t, e, r, n, s) {
|
|
|
1595
1595
|
c.push(i.row.createChecked(null, n && l === 0 ? a : o));
|
|
1596
1596
|
return i.table.createChecked(null, c);
|
|
1597
1597
|
}
|
|
1598
|
-
function
|
|
1598
|
+
function xr(t) {
|
|
1599
1599
|
return t instanceof pt;
|
|
1600
1600
|
}
|
|
1601
1601
|
var P = ({ editor: t }) => {
|
|
1602
1602
|
const { selection: e } = t.state;
|
|
1603
|
-
if (!
|
|
1603
|
+
if (!xr(e))
|
|
1604
1604
|
return !1;
|
|
1605
1605
|
let r = 0;
|
|
1606
|
-
const n =
|
|
1606
|
+
const n = Pt(e.ranges[0].$from, (i) => i.type.name === "table");
|
|
1607
1607
|
return n?.node.descendants((i) => {
|
|
1608
1608
|
if (i.type.name === "table")
|
|
1609
1609
|
return !1;
|
|
1610
1610
|
["tableCell", "tableHeader"].includes(i.type.name) && (r += 1);
|
|
1611
1611
|
}), r === e.ranges.length ? (t.commands.deleteTable(), !0) : !1;
|
|
1612
|
-
},
|
|
1613
|
-
function
|
|
1612
|
+
}, Ar = "";
|
|
1613
|
+
function Ir(t) {
|
|
1614
1614
|
return (t || "").replace(/\s+/g, " ").trim();
|
|
1615
1615
|
}
|
|
1616
|
-
function
|
|
1616
|
+
function Sr(t, e, r = {}) {
|
|
1617
1617
|
var n;
|
|
1618
|
-
const s = (n = r.cellLineSeparator) != null ? n :
|
|
1618
|
+
const s = (n = r.cellLineSeparator) != null ? n : Ar;
|
|
1619
1619
|
if (!t || !t.content || t.content.length === 0)
|
|
1620
1620
|
return "";
|
|
1621
1621
|
const i = [];
|
|
1622
1622
|
t.content.forEach((f) => {
|
|
1623
|
-
const
|
|
1624
|
-
f.content && f.content.forEach((
|
|
1623
|
+
const b = [];
|
|
1624
|
+
f.content && f.content.forEach((g) => {
|
|
1625
1625
|
let T = "";
|
|
1626
|
-
|
|
1627
|
-
const v =
|
|
1628
|
-
|
|
1629
|
-
}), i.push(
|
|
1626
|
+
g.content && Array.isArray(g.content) && g.content.length > 1 ? T = g.content.map((O) => e.renderChildren(O)).join(s) : T = g.content ? e.renderChildren(g.content) : "";
|
|
1627
|
+
const v = Ir(T), I = g.type === "tableHeader";
|
|
1628
|
+
b.push({ text: v, isHeader: I });
|
|
1629
|
+
}), i.push(b);
|
|
1630
1630
|
});
|
|
1631
|
-
const a = i.reduce((f,
|
|
1631
|
+
const a = i.reduce((f, b) => Math.max(f, b.length), 0);
|
|
1632
1632
|
if (a === 0)
|
|
1633
1633
|
return "";
|
|
1634
1634
|
const o = new Array(a).fill(0);
|
|
1635
1635
|
i.forEach((f) => {
|
|
1636
|
-
var
|
|
1637
|
-
for (let
|
|
1638
|
-
const v = (((
|
|
1639
|
-
v > o[
|
|
1636
|
+
var b;
|
|
1637
|
+
for (let g = 0; g < a; g += 1) {
|
|
1638
|
+
const v = (((b = f[g]) == null ? void 0 : b.text) || "").length;
|
|
1639
|
+
v > o[g] && (o[g] = v), o[g] < 3 && (o[g] = 3);
|
|
1640
1640
|
}
|
|
1641
1641
|
});
|
|
1642
|
-
const c = (f,
|
|
1643
|
-
let
|
|
1642
|
+
const c = (f, b) => f + " ".repeat(Math.max(0, b - f.length)), l = i[0], d = l.some((f) => f.isHeader);
|
|
1643
|
+
let u = `
|
|
1644
1644
|
`;
|
|
1645
|
-
const h = new Array(a).fill(0).map((f,
|
|
1646
|
-
return
|
|
1647
|
-
`,
|
|
1648
|
-
`, (
|
|
1649
|
-
|
|
1645
|
+
const h = new Array(a).fill(0).map((f, b) => d && l[b] && l[b].text || "");
|
|
1646
|
+
return u += `| ${h.map((f, b) => c(f, o[b])).join(" | ")} |
|
|
1647
|
+
`, u += `| ${o.map((f) => "-".repeat(Math.max(3, f))).join(" | ")} |
|
|
1648
|
+
`, (d ? i.slice(1) : i).forEach((f) => {
|
|
1649
|
+
u += `| ${new Array(a).fill(0).map((b, g) => c(f[g] && f[g].text || "", o[g])).join(" | ")} |
|
|
1650
1650
|
`;
|
|
1651
|
-
}),
|
|
1651
|
+
}), u;
|
|
1652
1652
|
}
|
|
1653
|
-
var
|
|
1653
|
+
var Hr = Sr, Er = L.create({
|
|
1654
1654
|
name: "table",
|
|
1655
1655
|
// @ts-ignore
|
|
1656
1656
|
addOptions() {
|
|
@@ -1661,7 +1661,7 @@ var Sr = Ir, Hr = L.create({
|
|
|
1661
1661
|
handleWidth: 5,
|
|
1662
1662
|
cellMinWidth: 25,
|
|
1663
1663
|
// TODO: fix
|
|
1664
|
-
View:
|
|
1664
|
+
View: Lr,
|
|
1665
1665
|
lastColumnResizable: !0,
|
|
1666
1666
|
allowTableNodeSelection: !1
|
|
1667
1667
|
};
|
|
@@ -1674,7 +1674,7 @@ var Sr = Ir, Hr = L.create({
|
|
|
1674
1674
|
return [{ tag: "table" }];
|
|
1675
1675
|
},
|
|
1676
1676
|
renderHTML({ node: t, HTMLAttributes: e }) {
|
|
1677
|
-
const { colgroup: r, tableWidth: n, tableMinWidth: s } =
|
|
1677
|
+
const { colgroup: r, tableWidth: n, tableMinWidth: s } = wr(t, this.options.cellMinWidth), i = e.style;
|
|
1678
1678
|
function a() {
|
|
1679
1679
|
return i || (n ? `width: ${n}` : `min-width: ${s}`);
|
|
1680
1680
|
}
|
|
@@ -1703,34 +1703,34 @@ var Sr = Ir, Hr = L.create({
|
|
|
1703
1703
|
}), r.push(e.createNode("tableRow", {}, s));
|
|
1704
1704
|
}), e.createNode("table", void 0, r);
|
|
1705
1705
|
},
|
|
1706
|
-
renderMarkdown: (t, e) =>
|
|
1706
|
+
renderMarkdown: (t, e) => Hr(t, e),
|
|
1707
1707
|
addCommands() {
|
|
1708
1708
|
return {
|
|
1709
1709
|
insertTable: ({ rows: t = 3, cols: e = 3, withHeaderRow: r = !0 } = {}) => ({ tr: n, dispatch: s, editor: i }) => {
|
|
1710
|
-
const a =
|
|
1710
|
+
const a = Mr(i.schema, t, e, r);
|
|
1711
1711
|
if (s) {
|
|
1712
1712
|
const o = n.selection.from + 1;
|
|
1713
|
-
n.replaceSelectionWith(a).scrollIntoView().setSelection(
|
|
1713
|
+
n.replaceSelectionWith(a).scrollIntoView().setSelection(Bt.near(n.doc.resolve(o)));
|
|
1714
1714
|
}
|
|
1715
1715
|
return !0;
|
|
1716
1716
|
},
|
|
1717
|
-
addColumnBefore: () => ({ state: t, dispatch: e }) =>
|
|
1718
|
-
addColumnAfter: () => ({ state: t, dispatch: e }) =>
|
|
1719
|
-
deleteColumn: () => ({ state: t, dispatch: e }) =>
|
|
1720
|
-
addRowBefore: () => ({ state: t, dispatch: e }) =>
|
|
1721
|
-
addRowAfter: () => ({ state: t, dispatch: e }) =>
|
|
1722
|
-
deleteRow: () => ({ state: t, dispatch: e }) =>
|
|
1723
|
-
deleteTable: () => ({ state: t, dispatch: e }) =>
|
|
1717
|
+
addColumnBefore: () => ({ state: t, dispatch: e }) => he(t, e),
|
|
1718
|
+
addColumnAfter: () => ({ state: t, dispatch: e }) => pe(t, e),
|
|
1719
|
+
deleteColumn: () => ({ state: t, dispatch: e }) => ce(t, e),
|
|
1720
|
+
addRowBefore: () => ({ state: t, dispatch: e }) => de(t, e),
|
|
1721
|
+
addRowAfter: () => ({ state: t, dispatch: e }) => ue(t, e),
|
|
1722
|
+
deleteRow: () => ({ state: t, dispatch: e }) => le(t, e),
|
|
1723
|
+
deleteTable: () => ({ state: t, dispatch: e }) => ae(t, e),
|
|
1724
1724
|
mergeCells: () => ({ state: t, dispatch: e }) => G(t, e),
|
|
1725
1725
|
splitCell: () => ({ state: t, dispatch: e }) => X(t, e),
|
|
1726
1726
|
toggleHeaderColumn: () => ({ state: t, dispatch: e }) => Y("column")(t, e),
|
|
1727
1727
|
toggleHeaderRow: () => ({ state: t, dispatch: e }) => Y("row")(t, e),
|
|
1728
|
-
toggleHeaderCell: () => ({ state: t, dispatch: e }) =>
|
|
1728
|
+
toggleHeaderCell: () => ({ state: t, dispatch: e }) => oe(t, e),
|
|
1729
1729
|
mergeOrSplit: () => ({ state: t, dispatch: e }) => G(t, e) ? !0 : X(t, e),
|
|
1730
|
-
setCellAttribute: (t, e) => ({ state: r, dispatch: n }) =>
|
|
1730
|
+
setCellAttribute: (t, e) => ({ state: r, dispatch: n }) => ie(t, e)(r, n),
|
|
1731
1731
|
goToNextCell: () => ({ state: t, dispatch: e }) => U(1)(t, e),
|
|
1732
1732
|
goToPreviousCell: () => ({ state: t, dispatch: e }) => U(-1)(t, e),
|
|
1733
|
-
fixTables: () => ({ state: t, dispatch: e }) => (e &&
|
|
1733
|
+
fixTables: () => ({ state: t, dispatch: e }) => (e && se(t), !0),
|
|
1734
1734
|
setCellSelection: (t) => ({ tr: e, dispatch: r }) => {
|
|
1735
1735
|
if (r) {
|
|
1736
1736
|
const n = pt.create(e.doc, t.anchorCell, t.headCell);
|
|
@@ -1753,7 +1753,7 @@ var Sr = Ir, Hr = L.create({
|
|
|
1753
1753
|
addProseMirrorPlugins() {
|
|
1754
1754
|
return [
|
|
1755
1755
|
...this.options.resizable && this.editor.isEditable ? [
|
|
1756
|
-
|
|
1756
|
+
re({
|
|
1757
1757
|
handleWidth: this.options.handleWidth,
|
|
1758
1758
|
cellMinWidth: this.options.cellMinWidth,
|
|
1759
1759
|
defaultCellMinWidth: this.options.cellMinWidth,
|
|
@@ -1761,7 +1761,7 @@ var Sr = Ir, Hr = L.create({
|
|
|
1761
1761
|
lastColumnResizable: this.options.lastColumnResizable
|
|
1762
1762
|
})
|
|
1763
1763
|
] : [],
|
|
1764
|
-
|
|
1764
|
+
ne({
|
|
1765
1765
|
allowTableNodeSelection: this.options.allowTableNodeSelection
|
|
1766
1766
|
})
|
|
1767
1767
|
];
|
|
@@ -1776,19 +1776,19 @@ var Sr = Ir, Hr = L.create({
|
|
|
1776
1776
|
tableRole: dt(ct(t, "tableRole", e))
|
|
1777
1777
|
};
|
|
1778
1778
|
}
|
|
1779
|
-
}),
|
|
1779
|
+
}), $r = C.create({
|
|
1780
1780
|
name: "tableKit",
|
|
1781
1781
|
addExtensions() {
|
|
1782
1782
|
const t = [];
|
|
1783
|
-
return this.options.table !== !1 && t.push(
|
|
1783
|
+
return this.options.table !== !1 && t.push(Er.configure(this.options.table)), this.options.tableCell !== !1 && t.push(kr.configure(this.options.tableCell)), this.options.tableHeader !== !1 && t.push(Tr.configure(this.options.tableHeader)), this.options.tableRow !== !1 && t.push(Cr.configure(this.options.tableRow)), t;
|
|
1784
1784
|
}
|
|
1785
1785
|
});
|
|
1786
|
-
const
|
|
1786
|
+
const Nr = ({
|
|
1787
1787
|
onHighlighterClick: t,
|
|
1788
1788
|
onLinkClick: e,
|
|
1789
1789
|
isMobile: r
|
|
1790
1790
|
}) => {
|
|
1791
|
-
const { editor: n } =
|
|
1791
|
+
const { editor: n } = ee();
|
|
1792
1792
|
return /* @__PURE__ */ w(at, { children: [
|
|
1793
1793
|
/* @__PURE__ */ w(x, { children: [
|
|
1794
1794
|
/* @__PURE__ */ p(Z, { action: "undo" }),
|
|
@@ -1796,16 +1796,16 @@ const $r = ({
|
|
|
1796
1796
|
] }),
|
|
1797
1797
|
/* @__PURE__ */ p(A, {}),
|
|
1798
1798
|
/* @__PURE__ */ w(x, { children: [
|
|
1799
|
-
/* @__PURE__ */ p(
|
|
1799
|
+
/* @__PURE__ */ p(me, { levels: [1, 2, 3, 4], portal: r }),
|
|
1800
1800
|
/* @__PURE__ */ p(
|
|
1801
|
-
|
|
1801
|
+
ge,
|
|
1802
1802
|
{
|
|
1803
1803
|
types: ["bulletList", "orderedList", "taskList"],
|
|
1804
1804
|
portal: r
|
|
1805
1805
|
}
|
|
1806
1806
|
),
|
|
1807
|
-
/* @__PURE__ */ p(
|
|
1808
|
-
/* @__PURE__ */ p(
|
|
1807
|
+
/* @__PURE__ */ p(be, {}),
|
|
1808
|
+
/* @__PURE__ */ p(ye, {})
|
|
1809
1809
|
] }),
|
|
1810
1810
|
/* @__PURE__ */ p(A, {}),
|
|
1811
1811
|
/* @__PURE__ */ w(x, { children: [
|
|
@@ -1814,8 +1814,8 @@ const $r = ({
|
|
|
1814
1814
|
/* @__PURE__ */ p(M, { type: "strike" }),
|
|
1815
1815
|
/* @__PURE__ */ p(M, { type: "code" }),
|
|
1816
1816
|
/* @__PURE__ */ p(M, { type: "underline" }),
|
|
1817
|
-
r ? /* @__PURE__ */ p(
|
|
1818
|
-
r ? /* @__PURE__ */ p(
|
|
1817
|
+
r ? /* @__PURE__ */ p(Te, { onClick: t }) : /* @__PURE__ */ p(ke, {}),
|
|
1818
|
+
r ? /* @__PURE__ */ p(we, { onClick: e }) : /* @__PURE__ */ p(Le, {})
|
|
1819
1819
|
] }),
|
|
1820
1820
|
/* @__PURE__ */ p(A, {}),
|
|
1821
1821
|
/* @__PURE__ */ w(x, { children: [
|
|
@@ -1830,31 +1830,32 @@ const $r = ({
|
|
|
1830
1830
|
/* @__PURE__ */ p(R, { align: "justify" })
|
|
1831
1831
|
] }),
|
|
1832
1832
|
/* @__PURE__ */ p(A, {}),
|
|
1833
|
-
/* @__PURE__ */ p(x, { children: /* @__PURE__ */ p(
|
|
1833
|
+
/* @__PURE__ */ p(x, { children: /* @__PURE__ */ p(Jt, { onClick: () => {
|
|
1834
1834
|
n && n.chain().focus().insertTable({ rows: 3, cols: 3 }).run();
|
|
1835
1835
|
} }) }),
|
|
1836
1836
|
r && /* @__PURE__ */ p(A, {})
|
|
1837
1837
|
] });
|
|
1838
|
-
},
|
|
1838
|
+
}, Rr = ({
|
|
1839
1839
|
type: t,
|
|
1840
1840
|
onBack: e
|
|
1841
1841
|
}) => /* @__PURE__ */ w(at, { children: [
|
|
1842
|
-
/* @__PURE__ */ p(x, { children: /* @__PURE__ */ w(
|
|
1843
|
-
/* @__PURE__ */ p(
|
|
1844
|
-
t === "highlighter" ? /* @__PURE__ */ p(
|
|
1842
|
+
/* @__PURE__ */ p(x, { children: /* @__PURE__ */ w(Me, { "data-style": "ghost", onClick: e, children: [
|
|
1843
|
+
/* @__PURE__ */ p(Vt, { className: "tiptap-button-icon" }),
|
|
1844
|
+
t === "highlighter" ? /* @__PURE__ */ p(qt, { className: "tiptap-button-icon" }) : /* @__PURE__ */ p(Ft, { className: "tiptap-button-icon" })
|
|
1845
1845
|
] }) }),
|
|
1846
1846
|
/* @__PURE__ */ p(A, {}),
|
|
1847
|
-
t === "highlighter" ? /* @__PURE__ */ p(
|
|
1847
|
+
t === "highlighter" ? /* @__PURE__ */ p(Ce, {}) : /* @__PURE__ */ p(ve, {})
|
|
1848
1848
|
] });
|
|
1849
|
-
function
|
|
1849
|
+
function gn({
|
|
1850
1850
|
themeMode: t,
|
|
1851
1851
|
content: e,
|
|
1852
1852
|
onContentChange: r,
|
|
1853
|
-
placeholder: n = ""
|
|
1853
|
+
placeholder: n = "",
|
|
1854
|
+
ref: s
|
|
1854
1855
|
}) {
|
|
1855
|
-
const
|
|
1856
|
+
const i = Gt(), { height: a } = Xt(), [o, c] = vt(
|
|
1856
1857
|
"main"
|
|
1857
|
-
),
|
|
1858
|
+
), l = q(null), d = q(!1), u = Ct({
|
|
1858
1859
|
immediatelyRender: !1,
|
|
1859
1860
|
shouldRerenderOnTransaction: !1,
|
|
1860
1861
|
editorProps: {
|
|
@@ -1867,83 +1868,89 @@ function mn({
|
|
|
1867
1868
|
}
|
|
1868
1869
|
},
|
|
1869
1870
|
extensions: [
|
|
1870
|
-
|
|
1871
|
+
jt.configure({
|
|
1871
1872
|
horizontalRule: !1,
|
|
1872
1873
|
link: {
|
|
1873
1874
|
openOnClick: !1,
|
|
1874
1875
|
enableClickSelection: !0
|
|
1875
1876
|
}
|
|
1876
1877
|
}),
|
|
1877
|
-
|
|
1878
|
-
|
|
1878
|
+
Qt,
|
|
1879
|
+
Fe.configure({ types: ["heading", "paragraph"] }),
|
|
1879
1880
|
Tt,
|
|
1880
1881
|
kt.configure({ nested: !0 }),
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1882
|
+
Ie.configure({ multicolor: !0 }),
|
|
1883
|
+
He,
|
|
1884
|
+
gr,
|
|
1885
|
+
qe,
|
|
1884
1886
|
Ve,
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
Qt.configure({
|
|
1887
|
+
yr,
|
|
1888
|
+
Kt.configure({
|
|
1888
1889
|
accept: "image/*",
|
|
1889
|
-
maxSize:
|
|
1890
|
+
maxSize: Zt,
|
|
1890
1891
|
limit: 3,
|
|
1891
|
-
upload:
|
|
1892
|
-
onError: (
|
|
1892
|
+
upload: Yt,
|
|
1893
|
+
onError: (m) => console.error("Upload failed:", m)
|
|
1893
1894
|
}),
|
|
1894
|
-
|
|
1895
|
+
$r.configure({
|
|
1895
1896
|
table: {
|
|
1896
1897
|
resizable: !0
|
|
1897
1898
|
}
|
|
1898
1899
|
}),
|
|
1899
|
-
|
|
1900
|
+
br.configure({
|
|
1900
1901
|
placeholder: n
|
|
1901
1902
|
})
|
|
1902
1903
|
],
|
|
1903
1904
|
content: e,
|
|
1904
|
-
onUpdate: ({ editor:
|
|
1905
|
-
if (!
|
|
1906
|
-
const
|
|
1907
|
-
r(
|
|
1905
|
+
onUpdate: ({ editor: m }) => {
|
|
1906
|
+
if (!d.current && r) {
|
|
1907
|
+
const f = m.getHTML();
|
|
1908
|
+
r(f);
|
|
1908
1909
|
}
|
|
1909
1910
|
}
|
|
1910
|
-
}),
|
|
1911
|
+
}), h = Ut({
|
|
1911
1912
|
editor: u,
|
|
1912
|
-
overlayHeight:
|
|
1913
|
+
overlayHeight: l.current?.getBoundingClientRect().height ?? 0
|
|
1913
1914
|
});
|
|
1914
1915
|
return D(() => {
|
|
1915
|
-
!
|
|
1916
|
-
}, [
|
|
1917
|
-
u && e !== void 0 && u.getHTML() !== e && (
|
|
1916
|
+
!i && o !== "main" && c("main");
|
|
1917
|
+
}, [i, o]), D(() => {
|
|
1918
|
+
u && e !== void 0 && u.getHTML() !== e && (d.current = !0, u.commands.setContent(e, { emitUpdate: !1 }), d.current = !1);
|
|
1918
1919
|
}, [e, u]), D(() => {
|
|
1919
1920
|
document.documentElement.classList.toggle("dark", t === "dark");
|
|
1920
|
-
}, [t]),
|
|
1921
|
+
}, [t]), Mt(
|
|
1922
|
+
s,
|
|
1923
|
+
() => ({
|
|
1924
|
+
getEditor: () => u
|
|
1925
|
+
}),
|
|
1926
|
+
[u]
|
|
1927
|
+
), u ? /* @__PURE__ */ p("div", { className: "simple-editor-wrapper", children: /* @__PURE__ */ w(Lt.Provider, { value: { editor: u }, children: [
|
|
1921
1928
|
/* @__PURE__ */ p(
|
|
1922
|
-
|
|
1929
|
+
fe,
|
|
1923
1930
|
{
|
|
1924
|
-
ref:
|
|
1931
|
+
ref: l,
|
|
1925
1932
|
style: {
|
|
1926
|
-
...
|
|
1927
|
-
bottom: `calc(100% - ${
|
|
1933
|
+
...i ? {
|
|
1934
|
+
bottom: `calc(100% - ${a - h.y}px)`
|
|
1928
1935
|
} : {}
|
|
1929
1936
|
},
|
|
1930
|
-
children:
|
|
1931
|
-
|
|
1937
|
+
children: o === "main" ? /* @__PURE__ */ p(
|
|
1938
|
+
Nr,
|
|
1932
1939
|
{
|
|
1933
|
-
onHighlighterClick: () =>
|
|
1934
|
-
onLinkClick: () =>
|
|
1935
|
-
isMobile:
|
|
1940
|
+
onHighlighterClick: () => c("highlighter"),
|
|
1941
|
+
onLinkClick: () => c("link"),
|
|
1942
|
+
isMobile: i
|
|
1936
1943
|
}
|
|
1937
1944
|
) : /* @__PURE__ */ p(
|
|
1938
|
-
|
|
1945
|
+
Rr,
|
|
1939
1946
|
{
|
|
1940
|
-
type:
|
|
1941
|
-
onBack: () =>
|
|
1947
|
+
type: o === "highlighter" ? "highlighter" : "link",
|
|
1948
|
+
onBack: () => c("main")
|
|
1942
1949
|
}
|
|
1943
1950
|
)
|
|
1944
1951
|
}
|
|
1945
1952
|
),
|
|
1946
|
-
/* @__PURE__ */ p(
|
|
1953
|
+
/* @__PURE__ */ p(te, {}),
|
|
1947
1954
|
/* @__PURE__ */ p(
|
|
1948
1955
|
wt,
|
|
1949
1956
|
{
|
|
@@ -1955,5 +1962,5 @@ function mn({
|
|
|
1955
1962
|
] }) }) : null;
|
|
1956
1963
|
}
|
|
1957
1964
|
export {
|
|
1958
|
-
|
|
1965
|
+
gn as SimpleEditor
|
|
1959
1966
|
};
|
package/dist/main.d.ts
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
1
|
export { SimpleEditor } from './components/tiptap-templates/simple/simple-editor';
|
|
2
|
+
export type { AnyExtension, CanCommands, ChainedCommands, Command, CommandProps, Content, Editor, EditorOptions, Extensions, JSONContent, SingleCommands, } from '@tiptap/core';
|
|
3
|
+
export type { EditorEvents, UseEditorOptions } from '@tiptap/react';
|