@dooherceg/tiptap-controlled-editor-with-table 0.0.3 → 0.0.5
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,8 +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;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
ref?: Ref<SimpleEditorRef>;
|
|
6
9
|
}
|
|
7
|
-
export
|
|
8
|
-
|
|
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 {
|
|
@@ -182,7 +182,7 @@ import '../../../assets/simple-editor.css';var Me = /(?:^|\s)(==(?!\s+==)((?:[^=
|
|
|
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,
|
|
@@ -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,8 +402,8 @@ 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
408
|
const d = l.at(-1);
|
|
409
409
|
if (!d)
|
|
@@ -411,7 +411,7 @@ var $ = (t, e) => {
|
|
|
411
411
|
const u = t.state.doc.resolve(c.start() + d.pos + 1);
|
|
412
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; ) {
|
|
@@ -489,15 +489,15 @@ function _e(t) {
|
|
|
489
489
|
let d = c, u = r + 1;
|
|
490
490
|
const h = [s];
|
|
491
491
|
for (; u < t.length; ) {
|
|
492
|
-
const
|
|
493
|
-
if (
|
|
492
|
+
const m = t[u];
|
|
493
|
+
if (m.match(et))
|
|
494
494
|
break;
|
|
495
|
-
if (
|
|
496
|
-
h.push(
|
|
495
|
+
if (m.trim() === "")
|
|
496
|
+
h.push(m), d += `
|
|
497
497
|
`, u += 1;
|
|
498
|
-
else if (
|
|
499
|
-
h.push(
|
|
500
|
-
${
|
|
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
|
}
|
|
@@ -528,21 +528,21 @@ function yt(t, e, r) {
|
|
|
528
528
|
const d = o.slice(1).join(`
|
|
529
529
|
`).trim();
|
|
530
530
|
if (d) {
|
|
531
|
-
const
|
|
532
|
-
l.push(...
|
|
531
|
+
const m = r.blockTokens(d);
|
|
532
|
+
l.push(...m);
|
|
533
533
|
}
|
|
534
534
|
let u = i + 1;
|
|
535
535
|
const h = [];
|
|
536
536
|
for (; u < t.length && t[u].indent > e; )
|
|
537
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
|
}
|
|
@@ -556,7 +556,7 @@ function yt(t, e, r) {
|
|
|
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 {
|
|
@@ -780,11 +780,11 @@ var We = "listItem", rt = "textStyle", nt = /^(\d+)\.\s$/, je = L.create({
|
|
|
780
780
|
}
|
|
781
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
789
|
checked: u
|
|
790
790
|
}), !0;
|
|
@@ -803,7 +803,7 @@ var We = "listItem", rt = "textStyle", nt = /^(\d+)\.\s$/, je = L.create({
|
|
|
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({
|
|
@@ -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
|
-
C.create({
|
|
1286
|
+
var br = C.create({
|
|
1287
1287
|
name: "placeholder",
|
|
1288
1288
|
addOptions() {
|
|
1289
1289
|
return {
|
|
@@ -1306,7 +1306,7 @@ 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
1311
|
const d = [this.options.emptyNodeClass];
|
|
1312
1312
|
i && d.push(this.options.emptyEditorClass);
|
|
@@ -1328,8 +1328,7 @@ C.create({
|
|
|
1328
1328
|
})
|
|
1329
1329
|
];
|
|
1330
1330
|
}
|
|
1331
|
-
})
|
|
1332
|
-
var gr = C.create({
|
|
1331
|
+
}), yr = C.create({
|
|
1333
1332
|
name: "selection",
|
|
1334
1333
|
addOptions() {
|
|
1335
1334
|
return {
|
|
@@ -1343,7 +1342,7 @@ var gr = C.create({
|
|
|
1343
1342
|
key: new E("selection"),
|
|
1344
1343
|
props: {
|
|
1345
1344
|
decorations(r) {
|
|
1346
|
-
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, [
|
|
1347
1346
|
K.inline(r.selection.from, r.selection.to, {
|
|
1348
1347
|
class: e.className
|
|
1349
1348
|
})
|
|
@@ -1402,12 +1401,12 @@ C.create({
|
|
|
1402
1401
|
},
|
|
1403
1402
|
addCommands() {
|
|
1404
1403
|
return {
|
|
1405
|
-
undo: () => ({ state: t, dispatch: e }) =>
|
|
1406
|
-
redo: () => ({ state: t, dispatch: e }) =>
|
|
1404
|
+
undo: () => ({ state: t, dispatch: e }) => Wt(t, e),
|
|
1405
|
+
redo: () => ({ state: t, dispatch: e }) => zt(t, e)
|
|
1407
1406
|
};
|
|
1408
1407
|
},
|
|
1409
1408
|
addProseMirrorPlugins() {
|
|
1410
|
-
return [
|
|
1409
|
+
return [_t(this.options)];
|
|
1411
1410
|
},
|
|
1412
1411
|
addKeyboardShortcuts() {
|
|
1413
1412
|
return {
|
|
@@ -1420,7 +1419,7 @@ C.create({
|
|
|
1420
1419
|
};
|
|
1421
1420
|
}
|
|
1422
1421
|
});
|
|
1423
|
-
var
|
|
1422
|
+
var kr = L.create({
|
|
1424
1423
|
name: "tableCell",
|
|
1425
1424
|
addOptions() {
|
|
1426
1425
|
return {
|
|
@@ -1461,7 +1460,7 @@ var br = L.create({
|
|
|
1461
1460
|
renderHTML({ HTMLAttributes: t }) {
|
|
1462
1461
|
return ["td", k(this.options.HTMLAttributes, t), 0];
|
|
1463
1462
|
}
|
|
1464
|
-
}),
|
|
1463
|
+
}), Tr = L.create({
|
|
1465
1464
|
name: "tableHeader",
|
|
1466
1465
|
addOptions() {
|
|
1467
1466
|
return {
|
|
@@ -1494,7 +1493,7 @@ var br = L.create({
|
|
|
1494
1493
|
renderHTML({ HTMLAttributes: t }) {
|
|
1495
1494
|
return ["th", k(this.options.HTMLAttributes, t), 0];
|
|
1496
1495
|
}
|
|
1497
|
-
}),
|
|
1496
|
+
}), Cr = L.create({
|
|
1498
1497
|
name: "tableRow",
|
|
1499
1498
|
addOptions() {
|
|
1500
1499
|
return {
|
|
@@ -1518,10 +1517,10 @@ function it(t, e, r, n, s, i) {
|
|
|
1518
1517
|
let o = 0, c = !0, l = e.firstChild;
|
|
1519
1518
|
const d = t.firstChild;
|
|
1520
1519
|
if (d !== null)
|
|
1521
|
-
for (let h = 0,
|
|
1522
|
-
const { colspan: f, colwidth:
|
|
1523
|
-
for (let
|
|
1524
|
-
const T = s ===
|
|
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` : "";
|
|
1525
1524
|
if (o += T || n, T || (c = !1), l) {
|
|
1526
1525
|
if (l.style.width !== v) {
|
|
1527
1526
|
const [I, N] = j(n, T);
|
|
@@ -1541,7 +1540,7 @@ function it(t, e, r, n, s, i) {
|
|
|
1541
1540
|
const u = t.attrs.style && typeof t.attrs.style == "string" && /\bwidth\s*:/i.test(t.attrs.style);
|
|
1542
1541
|
c && !u ? (r.style.width = `${o}px`, r.style.minWidth = "") : (r.style.width = "", r.style.minWidth = `${o}px`);
|
|
1543
1542
|
}
|
|
1544
|
-
var
|
|
1543
|
+
var Lr = class {
|
|
1545
1544
|
constructor(t, e) {
|
|
1546
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"));
|
|
1547
1546
|
}
|
|
@@ -1553,17 +1552,17 @@ var Tr = class {
|
|
|
1553
1552
|
return !!(r && !n && (t.type === "attributes" || t.type === "childList" || t.type === "characterData"));
|
|
1554
1553
|
}
|
|
1555
1554
|
};
|
|
1556
|
-
function
|
|
1555
|
+
function wr(t, e, r, n) {
|
|
1557
1556
|
let s = 0, i = !0;
|
|
1558
1557
|
const a = [], o = t.firstChild;
|
|
1559
1558
|
if (!o)
|
|
1560
1559
|
return {};
|
|
1561
1560
|
for (let u = 0, h = 0; u < o.childCount; u += 1) {
|
|
1562
|
-
const { colspan:
|
|
1563
|
-
for (let
|
|
1564
|
-
const
|
|
1565
|
-
s +=
|
|
1566
|
-
const [T, v] = j(e,
|
|
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);
|
|
1567
1566
|
a.push(["col", { style: `${T}: ${v}` }]);
|
|
1568
1567
|
}
|
|
1569
1568
|
}
|
|
@@ -1573,7 +1572,7 @@ function Cr(t, e, r, n) {
|
|
|
1573
1572
|
function ot(t, e) {
|
|
1574
1573
|
return t.createAndFill();
|
|
1575
1574
|
}
|
|
1576
|
-
function
|
|
1575
|
+
function vr(t) {
|
|
1577
1576
|
if (t.cached.tableNodeTypes)
|
|
1578
1577
|
return t.cached.tableNodeTypes;
|
|
1579
1578
|
const e = {};
|
|
@@ -1582,8 +1581,8 @@ function Lr(t) {
|
|
|
1582
1581
|
n.spec.tableRole && (e[n.spec.tableRole] = n);
|
|
1583
1582
|
}), t.cached.tableNodeTypes = e, e;
|
|
1584
1583
|
}
|
|
1585
|
-
function
|
|
1586
|
-
const i =
|
|
1584
|
+
function Mr(t, e, r, n, s) {
|
|
1585
|
+
const i = vr(t), a = [], o = [];
|
|
1587
1586
|
for (let l = 0; l < r; l += 1) {
|
|
1588
1587
|
const d = ot(i.cell);
|
|
1589
1588
|
if (d && o.push(d), n) {
|
|
@@ -1596,62 +1595,62 @@ function wr(t, e, r, n, s) {
|
|
|
1596
1595
|
c.push(i.row.createChecked(null, n && l === 0 ? a : o));
|
|
1597
1596
|
return i.table.createChecked(null, c);
|
|
1598
1597
|
}
|
|
1599
|
-
function
|
|
1598
|
+
function xr(t) {
|
|
1600
1599
|
return t instanceof pt;
|
|
1601
1600
|
}
|
|
1602
1601
|
var P = ({ editor: t }) => {
|
|
1603
1602
|
const { selection: e } = t.state;
|
|
1604
|
-
if (!
|
|
1603
|
+
if (!xr(e))
|
|
1605
1604
|
return !1;
|
|
1606
1605
|
let r = 0;
|
|
1607
|
-
const n =
|
|
1606
|
+
const n = Pt(e.ranges[0].$from, (i) => i.type.name === "table");
|
|
1608
1607
|
return n?.node.descendants((i) => {
|
|
1609
1608
|
if (i.type.name === "table")
|
|
1610
1609
|
return !1;
|
|
1611
1610
|
["tableCell", "tableHeader"].includes(i.type.name) && (r += 1);
|
|
1612
1611
|
}), r === e.ranges.length ? (t.commands.deleteTable(), !0) : !1;
|
|
1613
|
-
},
|
|
1614
|
-
function
|
|
1612
|
+
}, Ar = "";
|
|
1613
|
+
function Ir(t) {
|
|
1615
1614
|
return (t || "").replace(/\s+/g, " ").trim();
|
|
1616
1615
|
}
|
|
1617
|
-
function
|
|
1616
|
+
function Sr(t, e, r = {}) {
|
|
1618
1617
|
var n;
|
|
1619
|
-
const s = (n = r.cellLineSeparator) != null ? n :
|
|
1618
|
+
const s = (n = r.cellLineSeparator) != null ? n : Ar;
|
|
1620
1619
|
if (!t || !t.content || t.content.length === 0)
|
|
1621
1620
|
return "";
|
|
1622
1621
|
const i = [];
|
|
1623
1622
|
t.content.forEach((f) => {
|
|
1624
|
-
const
|
|
1625
|
-
f.content && f.content.forEach((
|
|
1623
|
+
const b = [];
|
|
1624
|
+
f.content && f.content.forEach((g) => {
|
|
1626
1625
|
let T = "";
|
|
1627
|
-
|
|
1628
|
-
const v =
|
|
1629
|
-
|
|
1630
|
-
}), 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);
|
|
1631
1630
|
});
|
|
1632
|
-
const a = i.reduce((f,
|
|
1631
|
+
const a = i.reduce((f, b) => Math.max(f, b.length), 0);
|
|
1633
1632
|
if (a === 0)
|
|
1634
1633
|
return "";
|
|
1635
1634
|
const o = new Array(a).fill(0);
|
|
1636
1635
|
i.forEach((f) => {
|
|
1637
|
-
var
|
|
1638
|
-
for (let
|
|
1639
|
-
const v = (((
|
|
1640
|
-
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);
|
|
1641
1640
|
}
|
|
1642
1641
|
});
|
|
1643
|
-
const c = (f,
|
|
1642
|
+
const c = (f, b) => f + " ".repeat(Math.max(0, b - f.length)), l = i[0], d = l.some((f) => f.isHeader);
|
|
1644
1643
|
let u = `
|
|
1645
1644
|
`;
|
|
1646
|
-
const h = new Array(a).fill(0).map((f,
|
|
1647
|
-
return u += `| ${h.map((f,
|
|
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(" | ")} |
|
|
1648
1647
|
`, u += `| ${o.map((f) => "-".repeat(Math.max(3, f))).join(" | ")} |
|
|
1649
1648
|
`, (d ? i.slice(1) : i).forEach((f) => {
|
|
1650
|
-
u += `| ${new Array(a).fill(0).map((
|
|
1649
|
+
u += `| ${new Array(a).fill(0).map((b, g) => c(f[g] && f[g].text || "", o[g])).join(" | ")} |
|
|
1651
1650
|
`;
|
|
1652
1651
|
}), u;
|
|
1653
1652
|
}
|
|
1654
|
-
var
|
|
1653
|
+
var Hr = Sr, Er = L.create({
|
|
1655
1654
|
name: "table",
|
|
1656
1655
|
// @ts-ignore
|
|
1657
1656
|
addOptions() {
|
|
@@ -1662,7 +1661,7 @@ var Ir = Ar, Sr = L.create({
|
|
|
1662
1661
|
handleWidth: 5,
|
|
1663
1662
|
cellMinWidth: 25,
|
|
1664
1663
|
// TODO: fix
|
|
1665
|
-
View:
|
|
1664
|
+
View: Lr,
|
|
1666
1665
|
lastColumnResizable: !0,
|
|
1667
1666
|
allowTableNodeSelection: !1
|
|
1668
1667
|
};
|
|
@@ -1675,7 +1674,7 @@ var Ir = Ar, Sr = L.create({
|
|
|
1675
1674
|
return [{ tag: "table" }];
|
|
1676
1675
|
},
|
|
1677
1676
|
renderHTML({ node: t, HTMLAttributes: e }) {
|
|
1678
|
-
const { colgroup: r, tableWidth: n, tableMinWidth: s } =
|
|
1677
|
+
const { colgroup: r, tableWidth: n, tableMinWidth: s } = wr(t, this.options.cellMinWidth), i = e.style;
|
|
1679
1678
|
function a() {
|
|
1680
1679
|
return i || (n ? `width: ${n}` : `min-width: ${s}`);
|
|
1681
1680
|
}
|
|
@@ -1704,34 +1703,34 @@ var Ir = Ar, Sr = L.create({
|
|
|
1704
1703
|
}), r.push(e.createNode("tableRow", {}, s));
|
|
1705
1704
|
}), e.createNode("table", void 0, r);
|
|
1706
1705
|
},
|
|
1707
|
-
renderMarkdown: (t, e) =>
|
|
1706
|
+
renderMarkdown: (t, e) => Hr(t, e),
|
|
1708
1707
|
addCommands() {
|
|
1709
1708
|
return {
|
|
1710
1709
|
insertTable: ({ rows: t = 3, cols: e = 3, withHeaderRow: r = !0 } = {}) => ({ tr: n, dispatch: s, editor: i }) => {
|
|
1711
|
-
const a =
|
|
1710
|
+
const a = Mr(i.schema, t, e, r);
|
|
1712
1711
|
if (s) {
|
|
1713
1712
|
const o = n.selection.from + 1;
|
|
1714
|
-
n.replaceSelectionWith(a).scrollIntoView().setSelection(
|
|
1713
|
+
n.replaceSelectionWith(a).scrollIntoView().setSelection(Bt.near(n.doc.resolve(o)));
|
|
1715
1714
|
}
|
|
1716
1715
|
return !0;
|
|
1717
1716
|
},
|
|
1718
|
-
addColumnBefore: () => ({ state: t, dispatch: e }) =>
|
|
1719
|
-
addColumnAfter: () => ({ state: t, dispatch: e }) =>
|
|
1720
|
-
deleteColumn: () => ({ state: t, dispatch: e }) =>
|
|
1721
|
-
addRowBefore: () => ({ state: t, dispatch: e }) =>
|
|
1722
|
-
addRowAfter: () => ({ state: t, dispatch: e }) =>
|
|
1723
|
-
deleteRow: () => ({ state: t, dispatch: e }) =>
|
|
1724
|
-
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),
|
|
1725
1724
|
mergeCells: () => ({ state: t, dispatch: e }) => G(t, e),
|
|
1726
1725
|
splitCell: () => ({ state: t, dispatch: e }) => X(t, e),
|
|
1727
1726
|
toggleHeaderColumn: () => ({ state: t, dispatch: e }) => Y("column")(t, e),
|
|
1728
1727
|
toggleHeaderRow: () => ({ state: t, dispatch: e }) => Y("row")(t, e),
|
|
1729
|
-
toggleHeaderCell: () => ({ state: t, dispatch: e }) =>
|
|
1728
|
+
toggleHeaderCell: () => ({ state: t, dispatch: e }) => oe(t, e),
|
|
1730
1729
|
mergeOrSplit: () => ({ state: t, dispatch: e }) => G(t, e) ? !0 : X(t, e),
|
|
1731
|
-
setCellAttribute: (t, e) => ({ state: r, dispatch: n }) =>
|
|
1730
|
+
setCellAttribute: (t, e) => ({ state: r, dispatch: n }) => ie(t, e)(r, n),
|
|
1732
1731
|
goToNextCell: () => ({ state: t, dispatch: e }) => U(1)(t, e),
|
|
1733
1732
|
goToPreviousCell: () => ({ state: t, dispatch: e }) => U(-1)(t, e),
|
|
1734
|
-
fixTables: () => ({ state: t, dispatch: e }) => (e &&
|
|
1733
|
+
fixTables: () => ({ state: t, dispatch: e }) => (e && se(t), !0),
|
|
1735
1734
|
setCellSelection: (t) => ({ tr: e, dispatch: r }) => {
|
|
1736
1735
|
if (r) {
|
|
1737
1736
|
const n = pt.create(e.doc, t.anchorCell, t.headCell);
|
|
@@ -1754,7 +1753,7 @@ var Ir = Ar, Sr = L.create({
|
|
|
1754
1753
|
addProseMirrorPlugins() {
|
|
1755
1754
|
return [
|
|
1756
1755
|
...this.options.resizable && this.editor.isEditable ? [
|
|
1757
|
-
|
|
1756
|
+
re({
|
|
1758
1757
|
handleWidth: this.options.handleWidth,
|
|
1759
1758
|
cellMinWidth: this.options.cellMinWidth,
|
|
1760
1759
|
defaultCellMinWidth: this.options.cellMinWidth,
|
|
@@ -1762,7 +1761,7 @@ var Ir = Ar, Sr = L.create({
|
|
|
1762
1761
|
lastColumnResizable: this.options.lastColumnResizable
|
|
1763
1762
|
})
|
|
1764
1763
|
] : [],
|
|
1765
|
-
|
|
1764
|
+
ne({
|
|
1766
1765
|
allowTableNodeSelection: this.options.allowTableNodeSelection
|
|
1767
1766
|
})
|
|
1768
1767
|
];
|
|
@@ -1777,19 +1776,19 @@ var Ir = Ar, Sr = L.create({
|
|
|
1777
1776
|
tableRole: dt(ct(t, "tableRole", e))
|
|
1778
1777
|
};
|
|
1779
1778
|
}
|
|
1780
|
-
}),
|
|
1779
|
+
}), $r = C.create({
|
|
1781
1780
|
name: "tableKit",
|
|
1782
1781
|
addExtensions() {
|
|
1783
1782
|
const t = [];
|
|
1784
|
-
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;
|
|
1785
1784
|
}
|
|
1786
1785
|
});
|
|
1787
|
-
const
|
|
1786
|
+
const Nr = ({
|
|
1788
1787
|
onHighlighterClick: t,
|
|
1789
1788
|
onLinkClick: e,
|
|
1790
1789
|
isMobile: r
|
|
1791
1790
|
}) => {
|
|
1792
|
-
const { editor: n } =
|
|
1791
|
+
const { editor: n } = ee();
|
|
1793
1792
|
return /* @__PURE__ */ w(at, { children: [
|
|
1794
1793
|
/* @__PURE__ */ w(x, { children: [
|
|
1795
1794
|
/* @__PURE__ */ p(Z, { action: "undo" }),
|
|
@@ -1797,16 +1796,16 @@ const Er = ({
|
|
|
1797
1796
|
] }),
|
|
1798
1797
|
/* @__PURE__ */ p(A, {}),
|
|
1799
1798
|
/* @__PURE__ */ w(x, { children: [
|
|
1800
|
-
/* @__PURE__ */ p(
|
|
1799
|
+
/* @__PURE__ */ p(me, { levels: [1, 2, 3, 4], portal: r }),
|
|
1801
1800
|
/* @__PURE__ */ p(
|
|
1802
|
-
|
|
1801
|
+
ge,
|
|
1803
1802
|
{
|
|
1804
1803
|
types: ["bulletList", "orderedList", "taskList"],
|
|
1805
1804
|
portal: r
|
|
1806
1805
|
}
|
|
1807
1806
|
),
|
|
1808
|
-
/* @__PURE__ */ p(
|
|
1809
|
-
/* @__PURE__ */ p(
|
|
1807
|
+
/* @__PURE__ */ p(be, {}),
|
|
1808
|
+
/* @__PURE__ */ p(ye, {})
|
|
1810
1809
|
] }),
|
|
1811
1810
|
/* @__PURE__ */ p(A, {}),
|
|
1812
1811
|
/* @__PURE__ */ w(x, { children: [
|
|
@@ -1815,8 +1814,8 @@ const Er = ({
|
|
|
1815
1814
|
/* @__PURE__ */ p(M, { type: "strike" }),
|
|
1816
1815
|
/* @__PURE__ */ p(M, { type: "code" }),
|
|
1817
1816
|
/* @__PURE__ */ p(M, { type: "underline" }),
|
|
1818
|
-
r ? /* @__PURE__ */ p(
|
|
1819
|
-
r ? /* @__PURE__ */ p(
|
|
1817
|
+
r ? /* @__PURE__ */ p(Te, { onClick: t }) : /* @__PURE__ */ p(ke, {}),
|
|
1818
|
+
r ? /* @__PURE__ */ p(we, { onClick: e }) : /* @__PURE__ */ p(Le, {})
|
|
1820
1819
|
] }),
|
|
1821
1820
|
/* @__PURE__ */ p(A, {}),
|
|
1822
1821
|
/* @__PURE__ */ w(x, { children: [
|
|
@@ -1831,30 +1830,32 @@ const Er = ({
|
|
|
1831
1830
|
/* @__PURE__ */ p(R, { align: "justify" })
|
|
1832
1831
|
] }),
|
|
1833
1832
|
/* @__PURE__ */ p(A, {}),
|
|
1834
|
-
/* @__PURE__ */ p(x, { children: /* @__PURE__ */ p(
|
|
1833
|
+
/* @__PURE__ */ p(x, { children: /* @__PURE__ */ p(Jt, { onClick: () => {
|
|
1835
1834
|
n && n.chain().focus().insertTable({ rows: 3, cols: 3 }).run();
|
|
1836
1835
|
} }) }),
|
|
1837
1836
|
r && /* @__PURE__ */ p(A, {})
|
|
1838
1837
|
] });
|
|
1839
|
-
},
|
|
1838
|
+
}, Rr = ({
|
|
1840
1839
|
type: t,
|
|
1841
1840
|
onBack: e
|
|
1842
1841
|
}) => /* @__PURE__ */ w(at, { children: [
|
|
1843
|
-
/* @__PURE__ */ p(x, { children: /* @__PURE__ */ w(
|
|
1844
|
-
/* @__PURE__ */ p(
|
|
1845
|
-
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" })
|
|
1846
1845
|
] }) }),
|
|
1847
1846
|
/* @__PURE__ */ p(A, {}),
|
|
1848
|
-
t === "highlighter" ? /* @__PURE__ */ p(
|
|
1847
|
+
t === "highlighter" ? /* @__PURE__ */ p(Ce, {}) : /* @__PURE__ */ p(ve, {})
|
|
1849
1848
|
] });
|
|
1850
|
-
function
|
|
1849
|
+
function gn({
|
|
1851
1850
|
themeMode: t,
|
|
1852
1851
|
content: e,
|
|
1853
|
-
onContentChange: r
|
|
1852
|
+
onContentChange: r,
|
|
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,84 +1868,93 @@ function fn({
|
|
|
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
|
-
mr,
|
|
1884
|
-
Ve,
|
|
1885
|
-
Ke,
|
|
1882
|
+
Ie.configure({ multicolor: !0 }),
|
|
1883
|
+
He,
|
|
1886
1884
|
gr,
|
|
1887
|
-
|
|
1885
|
+
qe,
|
|
1886
|
+
Ve,
|
|
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
|
}
|
|
1899
|
+
}),
|
|
1900
|
+
br.configure({
|
|
1901
|
+
placeholder: n
|
|
1898
1902
|
})
|
|
1899
1903
|
],
|
|
1900
1904
|
content: e,
|
|
1901
|
-
onUpdate: ({ editor:
|
|
1902
|
-
if (!
|
|
1903
|
-
const
|
|
1904
|
-
r(
|
|
1905
|
+
onUpdate: ({ editor: m }) => {
|
|
1906
|
+
if (!d.current && r) {
|
|
1907
|
+
const f = m.getHTML();
|
|
1908
|
+
r(f);
|
|
1905
1909
|
}
|
|
1906
1910
|
}
|
|
1907
|
-
}),
|
|
1908
|
-
editor:
|
|
1909
|
-
overlayHeight:
|
|
1911
|
+
}), h = Ut({
|
|
1912
|
+
editor: u,
|
|
1913
|
+
overlayHeight: l.current?.getBoundingClientRect().height ?? 0
|
|
1910
1914
|
});
|
|
1911
1915
|
return D(() => {
|
|
1912
|
-
!
|
|
1913
|
-
}, [
|
|
1914
|
-
|
|
1915
|
-
}, [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);
|
|
1919
|
+
}, [e, u]), D(() => {
|
|
1916
1920
|
document.documentElement.classList.toggle("dark", t === "dark");
|
|
1917
|
-
}, [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: [
|
|
1918
1928
|
/* @__PURE__ */ p(
|
|
1919
|
-
|
|
1929
|
+
fe,
|
|
1920
1930
|
{
|
|
1921
|
-
ref:
|
|
1931
|
+
ref: l,
|
|
1922
1932
|
style: {
|
|
1923
|
-
...
|
|
1924
|
-
bottom: `calc(100% - ${
|
|
1933
|
+
...i ? {
|
|
1934
|
+
bottom: `calc(100% - ${a - h.y}px)`
|
|
1925
1935
|
} : {}
|
|
1926
1936
|
},
|
|
1927
|
-
children:
|
|
1928
|
-
|
|
1937
|
+
children: o === "main" ? /* @__PURE__ */ p(
|
|
1938
|
+
Nr,
|
|
1929
1939
|
{
|
|
1930
|
-
onHighlighterClick: () =>
|
|
1931
|
-
onLinkClick: () =>
|
|
1932
|
-
isMobile:
|
|
1940
|
+
onHighlighterClick: () => c("highlighter"),
|
|
1941
|
+
onLinkClick: () => c("link"),
|
|
1942
|
+
isMobile: i
|
|
1933
1943
|
}
|
|
1934
1944
|
) : /* @__PURE__ */ p(
|
|
1935
|
-
|
|
1945
|
+
Rr,
|
|
1936
1946
|
{
|
|
1937
|
-
type:
|
|
1938
|
-
onBack: () =>
|
|
1947
|
+
type: o === "highlighter" ? "highlighter" : "link",
|
|
1948
|
+
onBack: () => c("main")
|
|
1939
1949
|
}
|
|
1940
1950
|
)
|
|
1941
1951
|
}
|
|
1942
1952
|
),
|
|
1943
|
-
/* @__PURE__ */ p(
|
|
1953
|
+
/* @__PURE__ */ p(te, {}),
|
|
1944
1954
|
/* @__PURE__ */ p(
|
|
1945
1955
|
wt,
|
|
1946
1956
|
{
|
|
1947
|
-
editor:
|
|
1957
|
+
editor: u,
|
|
1948
1958
|
role: "presentation",
|
|
1949
1959
|
className: "simple-editor-content"
|
|
1950
1960
|
}
|
|
@@ -1952,5 +1962,5 @@ function fn({
|
|
|
1952
1962
|
] }) }) : null;
|
|
1953
1963
|
}
|
|
1954
1964
|
export {
|
|
1955
|
-
|
|
1965
|
+
gn as SimpleEditor
|
|
1956
1966
|
};
|