@forgedevstack/ink 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -5
- package/README.md +77 -19
- package/dist/components/InkEditor/InkEditor.cjs +1 -1
- package/dist/components/InkEditor/InkEditor.d.ts.map +1 -1
- package/dist/components/InkEditor/InkEditor.js +448 -365
- package/dist/components/InkEditor/components/AiPanel/AiPanel.cjs +1 -1
- package/dist/components/InkEditor/components/AiPanel/AiPanel.js +7 -6
- package/dist/components/InkEditor/components/FindReplace/FindReplace.cjs +1 -0
- package/dist/components/InkEditor/components/FindReplace/FindReplace.const.cjs +1 -0
- package/dist/components/InkEditor/components/FindReplace/FindReplace.const.d.ts +11 -0
- package/dist/components/InkEditor/components/FindReplace/FindReplace.const.d.ts.map +1 -0
- package/dist/components/InkEditor/components/FindReplace/FindReplace.const.js +13 -0
- package/dist/components/InkEditor/components/FindReplace/FindReplace.d.ts +4 -0
- package/dist/components/InkEditor/components/FindReplace/FindReplace.d.ts.map +1 -0
- package/dist/components/InkEditor/components/FindReplace/FindReplace.js +49 -0
- package/dist/components/InkEditor/components/FindReplace/FindReplace.types.d.ts +12 -0
- package/dist/components/InkEditor/components/FindReplace/FindReplace.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/FindReplace/index.d.ts +3 -0
- package/dist/components/InkEditor/components/FindReplace/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.cjs +1 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.const.cjs +1 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.const.d.ts +17 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.const.d.ts.map +1 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.const.js +20 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.d.ts +4 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.d.ts.map +1 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.js +76 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.types.d.ts +10 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.utils.cjs +1 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.utils.d.ts +6 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.utils.d.ts.map +1 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.utils.js +19 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.utils.test.d.ts +2 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.utils.test.d.ts.map +1 -0
- package/dist/components/InkEditor/components/SignPad/index.d.ts +3 -0
- package/dist/components/InkEditor/components/SignPad/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.js +3 -2
- package/dist/components/InkEditor/components/index.d.ts +2 -0
- package/dist/components/InkEditor/components/index.d.ts.map +1 -1
- package/dist/constants/defaults.const.cjs +1 -1
- package/dist/constants/defaults.const.d.ts.map +1 -1
- package/dist/constants/defaults.const.js +46 -39
- package/dist/constants/generals.const.cjs +1 -0
- package/dist/constants/generals.const.d.ts +6 -0
- package/dist/constants/generals.const.d.ts.map +1 -0
- package/dist/constants/generals.const.js +5 -0
- package/dist/constants/index.d.ts +4 -1
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/numbers.cjs +1 -0
- package/dist/constants/numbers.d.ts +119 -0
- package/dist/constants/numbers.d.ts.map +1 -0
- package/dist/constants/numbers.js +20 -0
- package/dist/constants/premium.const.cjs +1 -0
- package/dist/constants/premium.const.d.ts +8 -0
- package/dist/constants/premium.const.d.ts.map +1 -0
- package/dist/constants/premium.const.js +100 -0
- package/dist/constants/toolbar.const.cjs +1 -0
- package/dist/constants/toolbar.const.d.ts +4 -0
- package/dist/constants/toolbar.const.d.ts.map +1 -0
- package/dist/constants/toolbar.const.js +6 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -29
- package/dist/plugins/ai/demoProvider.cjs +1 -1
- package/dist/plugins/ai/demoProvider.js +1 -1
- package/dist/styles.css +74 -1
- package/dist/types/features.types.d.ts +1 -1
- package/dist/types/features.types.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/ink.types.d.ts +10 -1
- package/dist/types/ink.types.d.ts.map +1 -1
- package/dist/types/premium.types.d.ts +30 -0
- package/dist/types/premium.types.d.ts.map +1 -0
- package/dist/utils/comments.utils.cjs +1 -1
- package/dist/utils/comments.utils.js +1 -1
- package/dist/utils/findReplace.utils.cjs +1 -0
- package/dist/utils/findReplace.utils.d.ts +3 -0
- package/dist/utils/findReplace.utils.d.ts.map +1 -0
- package/dist/utils/findReplace.utils.js +26 -0
- package/dist/utils/history.utils.cjs +1 -1
- package/dist/utils/history.utils.js +1 -1
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/ink.features.test.d.ts +2 -0
- package/dist/utils/ink.features.test.d.ts.map +1 -0
- package/dist/utils/license.utils.cjs +1 -0
- package/dist/utils/license.utils.d.ts +2 -0
- package/dist/utils/license.utils.d.ts.map +1 -0
- package/dist/utils/license.utils.js +16 -0
- package/dist/utils/memory.utils.cjs +1 -0
- package/dist/utils/memory.utils.d.ts +5 -0
- package/dist/utils/memory.utils.d.ts.map +1 -0
- package/dist/utils/memory.utils.js +10 -0
- package/dist/utils/paste.utils.cjs +1 -0
- package/dist/utils/paste.utils.d.ts +4 -0
- package/dist/utils/paste.utils.d.ts.map +1 -0
- package/dist/utils/paste.utils.js +31 -0
- package/dist/utils/premium.utils.cjs +1 -0
- package/dist/utils/premium.utils.d.ts +6 -0
- package/dist/utils/premium.utils.d.ts.map +1 -0
- package/dist/utils/premium.utils.js +30 -0
- package/dist/utils/slash.utils.cjs +1 -1
- package/dist/utils/slash.utils.js +1 -1
- package/dist/utils/storage.utils.cjs +1 -0
- package/dist/utils/storage.utils.d.ts +2 -0
- package/dist/utils/storage.utils.d.ts.map +1 -0
- package/dist/utils/storage.utils.js +4 -0
- package/dist/utils/table.utils.cjs +1 -1
- package/dist/utils/table.utils.js +1 -1
- package/package.json +3 -2
- package/dist/constants/numbers.const.cjs +0 -1
- package/dist/constants/numbers.const.d.ts +0 -18
- package/dist/constants/numbers.const.d.ts.map +0 -1
- package/dist/constants/numbers.const.js +0 -16
|
@@ -1,525 +1,608 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { INK_MIN_HEIGHT as
|
|
4
|
-
import {
|
|
5
|
-
import { cn as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
clearFormat: "⌫",
|
|
39
|
-
alignLeft: "⫷",
|
|
40
|
-
alignCenter: "☰",
|
|
41
|
-
alignRight: "⫸",
|
|
42
|
-
alignJustify: "≡",
|
|
43
|
-
indent: "→",
|
|
44
|
-
outdent: "←",
|
|
45
|
-
blockquote: "“",
|
|
46
|
-
code: "</>"
|
|
47
|
-
}, Q = () => {
|
|
48
|
-
const w = window.getSelection();
|
|
49
|
-
if (!w || w.rangeCount === 0) return "";
|
|
50
|
-
const h = w.getRangeAt(0), b = document.createElement("div");
|
|
51
|
-
return b.appendChild(h.cloneContents()), b.innerHTML;
|
|
52
|
-
}, En = (w) => {
|
|
53
|
-
var Ce;
|
|
1
|
+
import { jsxs as M, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as Ee, useState as m, useEffect as H } from "react";
|
|
3
|
+
import { INK_MIN_HEIGHT as Wt, INK_DEFAULT_TEXT_COLOR as $t, INK_DEFAULT_HIGHLIGHT_COLOR as zt } from "../../constants/numbers.js";
|
|
4
|
+
import { TOOLBAR_OPTION_SIGNATURE as Pe, TOOLBAR_OPTION_FIND_REPLACE as xe, TOOLBAR_OPTION_HORIZONTAL_RULE as Be } from "../../constants/toolbar.const.js";
|
|
5
|
+
import { INK_PLACEHOLDER_DEFAULT as qt, INK_DEFAULT_TOOLBAR as Xt, INK_DEFAULT_VARIANT as Qt, INK_DEFAULT_AUTHOR as Yt, INK_TABLE_DEFAULT_ROWS as Zt, INK_TABLE_DEFAULT_COLS as Jt, INK_DEFAULT_FEATURES as en, INK_CLASS_TOOLBAR as tn, INK_CLASS_SHELL as nn, INK_CLASS_BODY as rn, INK_CLASS_CONTENT as on, INK_CLASS_FOOTER as cn, INK_CLASS_DIVIDER as sn, INK_HEADING_OPTIONS as an, INK_BUTTON_CONFIG as Ue, INK_CLASS_ROOT as ln } from "../../constants/defaults.const.js";
|
|
6
|
+
import { INK_DEFAULT_ICONS as De } from "../../constants/premium.const.js";
|
|
7
|
+
import { cn as un } from "../../utils/cn.utils.js";
|
|
8
|
+
import { applyTypoAutoFix as mn } from "../../utils/typo.utils.js";
|
|
9
|
+
import { createInkId as Fe } from "../../utils/id.utils.js";
|
|
10
|
+
import { buildTableHtml as dn } from "../../utils/table.utils.js";
|
|
11
|
+
import { getBlockElement as Ke, moveBlock as fn, markActiveBlock as pn } from "../../utils/blocks.utils.js";
|
|
12
|
+
import { createTrackChange as J, rejectTrackChangeInHtml as hn, acceptTrackChangeInHtml as gn, wrapInsertHtml as Me, wrapDeleteHtml as Cn } from "../../utils/trackChanges.utils.js";
|
|
13
|
+
import { removeCommentMark as kn, wrapSelectionAsComment as Tn, createCommentThread as In } from "../../utils/comments.utils.js";
|
|
14
|
+
import { InkHistoryStack as Ve } from "../../utils/history.utils.js";
|
|
15
|
+
import { extractSlashQuery as bn, filterSlashCommands as An } from "../../utils/slash.utils.js";
|
|
16
|
+
import { resolveInkPremium as Ln, hasInkPremiumFeature as B, themeTokensToStyle as wn } from "../../utils/premium.utils.js";
|
|
17
|
+
import { extractClipboardHtml as yn, sanitizePastedHtml as Hn, extractClipboardText as _n } from "../../utils/paste.utils.js";
|
|
18
|
+
import { readInkMemory as Nn, writeInkMemory as Sn } from "../../utils/memory.utils.js";
|
|
19
|
+
import { replaceInHtml as Rn } from "../../utils/findReplace.utils.js";
|
|
20
|
+
import { insertImage as ee, insertHTML as I, setTextColor as vn, setHighlightColor as On, getActiveFormats as En, queryCommandValue as Pn, execCommand as C, insertLink as xn, fileToDataUrl as Bn } from "./helpers/format.utils.js";
|
|
21
|
+
import { ToolbarButton as h } from "./components/ToolbarButton/ToolbarButton.js";
|
|
22
|
+
import { ToolbarDropdown as Un } from "./components/ToolbarDropdown/ToolbarDropdown.js";
|
|
23
|
+
import { ToolbarColorPicker as je } from "./components/ToolbarColorPicker/ToolbarColorPicker.js";
|
|
24
|
+
import { CommentsPanel as Dn } from "./components/CommentsPanel/CommentsPanel.js";
|
|
25
|
+
import { AiPanel as Fn } from "./components/AiPanel/AiPanel.js";
|
|
26
|
+
import { BlockHandles as Kn } from "./components/BlockHandles/BlockHandles.js";
|
|
27
|
+
import { SlashMenu as Mn } from "./components/SlashMenu/SlashMenu.js";
|
|
28
|
+
import { TrackChangesBar as Vn } from "./components/TrackChangesBar/TrackChangesBar.js";
|
|
29
|
+
import { SignPad as jn } from "./components/SignPad/SignPad.js";
|
|
30
|
+
import { FindReplace as Gn } from "./components/FindReplace/FindReplace.js";
|
|
31
|
+
const te = () => {
|
|
32
|
+
const _ = window.getSelection();
|
|
33
|
+
if (!_ || _.rangeCount === 0) return "";
|
|
34
|
+
const g = _.getRangeAt(0), N = document.createElement("div");
|
|
35
|
+
return N.appendChild(g.cloneContents()), N.innerHTML;
|
|
36
|
+
}, br = (_) => {
|
|
37
|
+
var Oe;
|
|
54
38
|
const {
|
|
55
|
-
value:
|
|
56
|
-
defaultValue:
|
|
57
|
-
onChange:
|
|
58
|
-
placeholder:
|
|
39
|
+
value: g,
|
|
40
|
+
defaultValue: N = "",
|
|
41
|
+
onChange: A,
|
|
42
|
+
placeholder: ne = qt,
|
|
59
43
|
disabled: c = !1,
|
|
60
|
-
readOnly:
|
|
61
|
-
minHeight:
|
|
62
|
-
maxHeight:
|
|
63
|
-
toolbar:
|
|
64
|
-
className:
|
|
65
|
-
testId:
|
|
66
|
-
allowImagePaste:
|
|
67
|
-
showCharCount:
|
|
68
|
-
charCountMax:
|
|
69
|
-
typoAutoFix:
|
|
70
|
-
variant:
|
|
71
|
-
features:
|
|
72
|
-
author: L =
|
|
73
|
-
trackChanges:
|
|
74
|
-
onTrackChangesChange:
|
|
75
|
-
trackChangesEnabled:
|
|
76
|
-
onTrackChangesEnabledChange:
|
|
77
|
-
comments:
|
|
78
|
-
onCommentsChange:
|
|
79
|
-
showCommentsPanel:
|
|
80
|
-
onShowCommentsPanelChange:
|
|
81
|
-
ai:
|
|
82
|
-
slashCommands:
|
|
83
|
-
tableRows:
|
|
84
|
-
tableCols:
|
|
85
|
-
|
|
86
|
-
|
|
44
|
+
readOnly: i = !1,
|
|
45
|
+
minHeight: V = Wt,
|
|
46
|
+
maxHeight: j,
|
|
47
|
+
toolbar: Ge = Xt,
|
|
48
|
+
className: We = "",
|
|
49
|
+
testId: $e,
|
|
50
|
+
allowImagePaste: re = !0,
|
|
51
|
+
showCharCount: oe = !1,
|
|
52
|
+
charCountMax: ce,
|
|
53
|
+
typoAutoFix: ze = !0,
|
|
54
|
+
variant: qe = Qt,
|
|
55
|
+
features: Xe,
|
|
56
|
+
author: L = Yt,
|
|
57
|
+
trackChanges: S,
|
|
58
|
+
onTrackChangesChange: G,
|
|
59
|
+
trackChangesEnabled: U,
|
|
60
|
+
onTrackChangesEnabledChange: W,
|
|
61
|
+
comments: R,
|
|
62
|
+
onCommentsChange: $,
|
|
63
|
+
showCommentsPanel: v,
|
|
64
|
+
onShowCommentsPanelChange: z,
|
|
65
|
+
ai: d,
|
|
66
|
+
slashCommands: Qe,
|
|
67
|
+
tableRows: Ye = Zt,
|
|
68
|
+
tableCols: Ze = Jt,
|
|
69
|
+
premium: Je,
|
|
70
|
+
theme: et,
|
|
71
|
+
icons: ie,
|
|
72
|
+
pasteMode: tt = "plain",
|
|
73
|
+
onImageUpload: se,
|
|
74
|
+
wysiwyg: nt = !1,
|
|
75
|
+
keepInMemory: ae = !1,
|
|
76
|
+
memoryKey: le,
|
|
77
|
+
style: rt,
|
|
78
|
+
...ot
|
|
79
|
+
} = _, u = { ...en, ...Xe }, w = Ln(Je), ct = B(w, "icons"), it = B(w, "theme"), st = B(w, "richPaste"), at = B(w, "imageUpload"), lt = B(w, "wysiwyg") && nt, f = ct && ie ? { ...De, ...ie } : De, ut = it ? wn(et) : {}, mt = st && tt === "rich", r = Ee(null), D = Ee(new Ve(g ?? N)), [dt, ft] = m(/* @__PURE__ */ new Set()), [pt, ue] = m("p"), [ht, gt] = m(0), [Ct, kt] = m($t), [Tt, It] = m(zt), [y, me] = m(U ?? !1), [bt, de] = m(S ?? []), [At, fe] = m(R ?? []), [Lt, pe] = m(v ?? !1), [he, q] = m(!!(d != null && d.enabled && d.openOnInit)), [ge, wt] = m(""), [yt, Ht] = m(0), [_t, Ce] = m(!1), [Nt, F] = m([]), [ke, St] = m({ top: 0, left: 0 }), [Te, Ie] = m(!1), [be, Ae] = m(!1), k = S ?? bt, O = R ?? At, X = v ?? Lt, Le = Qe ?? u.slash;
|
|
87
80
|
H(() => {
|
|
88
|
-
|
|
89
|
-
}, [
|
|
90
|
-
|
|
91
|
-
}, [N]), H(() => {
|
|
92
|
-
S && re(S);
|
|
81
|
+
U !== void 0 && me(U);
|
|
82
|
+
}, [U]), H(() => {
|
|
83
|
+
S && de(S);
|
|
93
84
|
}, [S]), H(() => {
|
|
94
|
-
|
|
95
|
-
}, [
|
|
96
|
-
|
|
97
|
-
}, [
|
|
98
|
-
!
|
|
85
|
+
R && fe(R);
|
|
86
|
+
}, [R]), H(() => {
|
|
87
|
+
v !== void 0 && pe(v);
|
|
88
|
+
}, [v]), H(() => {
|
|
89
|
+
!r.current || g === void 0 || r.current.innerHTML !== g && (r.current.innerHTML = g);
|
|
90
|
+
}, [g]), H(() => {
|
|
91
|
+
if (!r.current || g !== void 0) return;
|
|
92
|
+
const t = (ae ? Nn(le) : "") || N;
|
|
93
|
+
t && (r.current.innerHTML = t, D.current = new Ve(t), A == null || A(t));
|
|
99
94
|
}, []);
|
|
100
|
-
const
|
|
95
|
+
const Q = (e) => {
|
|
101
96
|
var t;
|
|
102
|
-
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
},
|
|
110
|
-
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
},
|
|
114
|
-
|
|
115
|
-
const e =
|
|
116
|
-
if (e &&
|
|
117
|
-
const t = window.getSelection(), n = (t == null ? void 0 : t.anchorNode) ?? null,
|
|
118
|
-
if (
|
|
119
|
-
const
|
|
120
|
-
|
|
97
|
+
D.current.push(e), A == null || A(e), ae && Sn(e, le), oe && r.current && gt(((t = r.current.textContent) == null ? void 0 : t.length) ?? 0);
|
|
98
|
+
}, b = (e) => {
|
|
99
|
+
r.current && (r.current.innerHTML = e, Q(e));
|
|
100
|
+
}, E = (e) => {
|
|
101
|
+
de(e), G == null || G(e);
|
|
102
|
+
}, Y = (e) => {
|
|
103
|
+
fe(e), $ == null || $(e);
|
|
104
|
+
}, Z = (e) => {
|
|
105
|
+
pe(e), z == null || z(e);
|
|
106
|
+
}, Rt = (e) => {
|
|
107
|
+
me(e), W == null || W(e);
|
|
108
|
+
}, K = () => {
|
|
109
|
+
ft(En());
|
|
110
|
+
const e = Pn("formatBlock");
|
|
111
|
+
if (e && ue(e.toLowerCase().replace(/[<>]/g, "")), wt(te()), !r.current || !u.blocks) return;
|
|
112
|
+
const t = window.getSelection(), n = (t == null ? void 0 : t.anchorNode) ?? null, o = Ke(n, r.current);
|
|
113
|
+
if (pn(r.current, o), o) {
|
|
114
|
+
const s = r.current.getBoundingClientRect(), p = o.getBoundingClientRect();
|
|
115
|
+
Ht(p.top - s.top + r.current.scrollTop), Ce(!0);
|
|
121
116
|
} else
|
|
122
|
-
|
|
123
|
-
},
|
|
124
|
-
var t, n,
|
|
125
|
-
if (!
|
|
126
|
-
let e =
|
|
127
|
-
if (
|
|
128
|
-
const
|
|
129
|
-
if (
|
|
130
|
-
const
|
|
131
|
-
if (
|
|
132
|
-
const T = J("delete",
|
|
133
|
-
|
|
117
|
+
Ce(!1);
|
|
118
|
+
}, l = () => {
|
|
119
|
+
var t, n, o;
|
|
120
|
+
if (!r.current) return;
|
|
121
|
+
let e = r.current.innerHTML;
|
|
122
|
+
if (y && u.trackChanges) {
|
|
123
|
+
const s = window.getSelection();
|
|
124
|
+
if (s && !s.isCollapsed) {
|
|
125
|
+
const p = te();
|
|
126
|
+
if (p) {
|
|
127
|
+
const T = J("delete", p, L);
|
|
128
|
+
E([...k, T]), vt(T.id), e = r.current.innerHTML;
|
|
134
129
|
}
|
|
135
130
|
}
|
|
136
131
|
}
|
|
137
|
-
if (
|
|
138
|
-
const
|
|
139
|
-
if (
|
|
140
|
-
|
|
141
|
-
const T = (
|
|
142
|
-
if (T &&
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
top:
|
|
146
|
-
left:
|
|
132
|
+
if (Q(e), K(), Le && r.current) {
|
|
133
|
+
const s = ((n = (t = window.getSelection()) == null ? void 0 : t.anchorNode) == null ? void 0 : n.textContent) ?? "", p = bn(s);
|
|
134
|
+
if (p !== null) {
|
|
135
|
+
F(An(p));
|
|
136
|
+
const T = (o = window.getSelection()) == null ? void 0 : o.getRangeAt(0);
|
|
137
|
+
if (T && r.current) {
|
|
138
|
+
const P = T.getBoundingClientRect(), x = r.current.getBoundingClientRect();
|
|
139
|
+
St({
|
|
140
|
+
top: P.bottom - x.top + 8,
|
|
141
|
+
left: P.left - x.left
|
|
147
142
|
});
|
|
148
143
|
}
|
|
149
144
|
} else
|
|
150
|
-
|
|
145
|
+
F([]);
|
|
151
146
|
}
|
|
152
|
-
},
|
|
147
|
+
}, vt = (e) => {
|
|
153
148
|
const t = window.getSelection();
|
|
154
149
|
if (!t || t.rangeCount === 0) return;
|
|
155
|
-
const n =
|
|
156
|
-
n &&
|
|
157
|
-
},
|
|
158
|
-
if (!
|
|
159
|
-
const e =
|
|
160
|
-
t.html !== e && (
|
|
161
|
-
},
|
|
150
|
+
const n = te();
|
|
151
|
+
n && I(Cn(n, e));
|
|
152
|
+
}, Ot = () => {
|
|
153
|
+
if (!r.current || !ze || !u.typoAutoFix || c || i) return;
|
|
154
|
+
const e = r.current.innerHTML, t = mn(e);
|
|
155
|
+
t.html !== e && (r.current.innerHTML = t.html, Q(t.html));
|
|
156
|
+
}, Et = (e) => {
|
|
162
157
|
var n;
|
|
163
|
-
if (c ||
|
|
164
|
-
(n =
|
|
165
|
-
const t =
|
|
166
|
-
t && (t.value ?
|
|
167
|
-
},
|
|
158
|
+
if (c || i) return;
|
|
159
|
+
(n = r.current) == null || n.focus();
|
|
160
|
+
const t = Ue[e];
|
|
161
|
+
t && (t.value ? C(t.command, t.value) : C(t.command), l());
|
|
162
|
+
}, Pt = (e) => {
|
|
168
163
|
var t;
|
|
169
|
-
c ||
|
|
170
|
-
},
|
|
164
|
+
c || i || ((t = r.current) == null || t.focus(), C("formatBlock", e), ue(e), l());
|
|
165
|
+
}, xt = () => {
|
|
171
166
|
var t;
|
|
172
|
-
if (c ||
|
|
167
|
+
if (c || i) return;
|
|
173
168
|
const e = window.prompt("Enter URL:", "https://");
|
|
174
|
-
e && ((t =
|
|
175
|
-
},
|
|
176
|
-
if (c ||
|
|
169
|
+
e && ((t = r.current) == null || t.focus(), xn(e), l());
|
|
170
|
+
}, we = async (e) => at && se ? se(e) : Bn(e), Bt = async () => {
|
|
171
|
+
if (c || i) return;
|
|
177
172
|
const e = document.createElement("input");
|
|
178
173
|
e.type = "file", e.accept = "image/*", e.onchange = async () => {
|
|
179
|
-
var
|
|
180
|
-
const t = (
|
|
174
|
+
var o, s;
|
|
175
|
+
const t = (o = e.files) == null ? void 0 : o[0];
|
|
181
176
|
if (!t) return;
|
|
182
177
|
const n = await we(t);
|
|
183
|
-
(
|
|
178
|
+
(s = r.current) == null || s.focus(), ee(n, t.name), l();
|
|
184
179
|
}, e.click();
|
|
185
|
-
},
|
|
180
|
+
}, ye = () => {
|
|
186
181
|
var t;
|
|
187
|
-
if (c ||
|
|
188
|
-
(t =
|
|
189
|
-
const e =
|
|
190
|
-
if (
|
|
182
|
+
if (c || i || !u.table) return;
|
|
183
|
+
(t = r.current) == null || t.focus();
|
|
184
|
+
const e = dn(Ye, Ze);
|
|
185
|
+
if (y && u.trackChanges) {
|
|
191
186
|
const n = J("insert", e, L);
|
|
192
|
-
|
|
187
|
+
E([...k, n]), I(Me(e, n.id));
|
|
193
188
|
} else
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
},
|
|
197
|
-
const e =
|
|
198
|
-
if (e === null || !
|
|
199
|
-
|
|
189
|
+
I(e);
|
|
190
|
+
l();
|
|
191
|
+
}, He = () => {
|
|
192
|
+
const e = D.current.undo();
|
|
193
|
+
if (e === null || !r.current) {
|
|
194
|
+
C("undo"), l();
|
|
200
195
|
return;
|
|
201
196
|
}
|
|
202
|
-
|
|
203
|
-
},
|
|
204
|
-
const e =
|
|
205
|
-
if (e === null || !
|
|
206
|
-
|
|
197
|
+
b(e);
|
|
198
|
+
}, _e = () => {
|
|
199
|
+
const e = D.current.redo();
|
|
200
|
+
if (e === null || !r.current) {
|
|
201
|
+
C("redo"), l();
|
|
207
202
|
return;
|
|
208
203
|
}
|
|
209
|
-
|
|
210
|
-
},
|
|
211
|
-
var
|
|
212
|
-
if (c ||
|
|
204
|
+
b(e);
|
|
205
|
+
}, Ut = () => {
|
|
206
|
+
var s;
|
|
207
|
+
if (c || i || !u.comments) return;
|
|
213
208
|
const e = window.prompt("Comment:");
|
|
214
209
|
if (!(e != null && e.trim())) return;
|
|
215
|
-
const t =
|
|
216
|
-
if ((
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
},
|
|
220
|
-
if (!
|
|
221
|
-
const t =
|
|
222
|
-
|
|
210
|
+
const t = Fe("hl");
|
|
211
|
+
if ((s = r.current) == null || s.focus(), !Tn(t)) return;
|
|
212
|
+
const o = In(L, e.trim(), t);
|
|
213
|
+
Y([o, ...O]), Z(!0), l();
|
|
214
|
+
}, Ne = (e) => {
|
|
215
|
+
if (!r.current) return;
|
|
216
|
+
const t = gn(r.current.innerHTML, e);
|
|
217
|
+
b(t), E(
|
|
223
218
|
k.map((n) => n.id === e ? { ...n, accepted: !0 } : n)
|
|
224
219
|
);
|
|
225
|
-
},
|
|
226
|
-
if (!
|
|
227
|
-
const t =
|
|
228
|
-
|
|
220
|
+
}, Se = (e) => {
|
|
221
|
+
if (!r.current) return;
|
|
222
|
+
const t = hn(r.current.innerHTML, e);
|
|
223
|
+
b(t), E(
|
|
229
224
|
k.map((n) => n.id === e ? { ...n, rejected: !0 } : n)
|
|
230
225
|
);
|
|
231
|
-
},
|
|
232
|
-
|
|
233
|
-
if (
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
226
|
+
}, Re = async (e) => {
|
|
227
|
+
const t = await we(e), n = `<img src="${t}" alt="" style="max-width:100%;height:auto;" />`;
|
|
228
|
+
if (y && u.trackChanges) {
|
|
229
|
+
const o = J("insert", n, L);
|
|
230
|
+
E([...k, o]), I(Me(n, o.id));
|
|
231
|
+
} else
|
|
232
|
+
ee(t);
|
|
233
|
+
l();
|
|
234
|
+
}, Dt = async (e) => {
|
|
235
|
+
if (c || i) return;
|
|
236
|
+
const t = e.clipboardData;
|
|
237
|
+
if (!t) return;
|
|
238
|
+
if (mt) {
|
|
239
|
+
const o = yn(t);
|
|
240
|
+
if (o) {
|
|
238
241
|
e.preventDefault();
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
const
|
|
242
|
-
if (
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
242
|
+
const p = Hn(o);
|
|
243
|
+
p && (I(p), l());
|
|
244
|
+
const T = t.items;
|
|
245
|
+
if (re && T)
|
|
246
|
+
for (const P of Array.from(T)) {
|
|
247
|
+
if (!P.type.startsWith("image/")) continue;
|
|
248
|
+
const x = P.getAsFile();
|
|
249
|
+
x && await Re(x);
|
|
250
|
+
}
|
|
251
|
+
return;
|
|
248
252
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
253
|
+
const s = _n(t);
|
|
254
|
+
if (s) {
|
|
255
|
+
e.preventDefault(), I(s.replace(/\n/g, "<br />")), l();
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
if (!re) return;
|
|
260
|
+
const n = t.items;
|
|
261
|
+
if (n)
|
|
262
|
+
for (const o of Array.from(n)) {
|
|
263
|
+
if (!o.type.startsWith("image/")) continue;
|
|
264
|
+
e.preventDefault();
|
|
265
|
+
const s = o.getAsFile();
|
|
266
|
+
s && await Re(s);
|
|
267
|
+
}
|
|
268
|
+
}, Ft = (e) => {
|
|
269
|
+
e.key === "Escape" && F([]), (e.metaKey || e.ctrlKey) && e.key === "z" && (e.preventDefault(), e.shiftKey ? _e() : He());
|
|
270
|
+
}, Kt = (e) => {
|
|
271
|
+
var n, o;
|
|
272
|
+
(n = r.current) == null || n.focus();
|
|
254
273
|
const t = window.getSelection();
|
|
255
|
-
if ((
|
|
256
|
-
const
|
|
257
|
-
t.anchorNode.nodeType === Node.TEXT_NODE && (t.anchorNode.textContent =
|
|
274
|
+
if ((o = t == null ? void 0 : t.anchorNode) != null && o.textContent) {
|
|
275
|
+
const p = t.anchorNode.textContent.replace(/(?:^|\s)\/[^\s]*$/, " ");
|
|
276
|
+
t.anchorNode.nodeType === Node.TEXT_NODE && (t.anchorNode.textContent = p);
|
|
258
277
|
}
|
|
259
|
-
switch (
|
|
278
|
+
switch (F([]), e.insert) {
|
|
260
279
|
case "heading1":
|
|
261
|
-
|
|
280
|
+
C("formatBlock", "h1");
|
|
262
281
|
break;
|
|
263
282
|
case "heading2":
|
|
264
|
-
|
|
283
|
+
C("formatBlock", "h2");
|
|
265
284
|
break;
|
|
266
285
|
case "bulletList":
|
|
267
|
-
|
|
286
|
+
C("insertUnorderedList");
|
|
268
287
|
break;
|
|
269
288
|
case "orderedList":
|
|
270
|
-
|
|
289
|
+
C("insertOrderedList");
|
|
271
290
|
break;
|
|
272
291
|
case "table":
|
|
273
|
-
|
|
292
|
+
ye();
|
|
274
293
|
return;
|
|
275
294
|
case "ai":
|
|
276
|
-
|
|
295
|
+
q(!0);
|
|
277
296
|
break;
|
|
278
297
|
}
|
|
279
|
-
|
|
280
|
-
},
|
|
281
|
-
if (!
|
|
282
|
-
const t = window.getSelection(), n =
|
|
283
|
-
n &&
|
|
284
|
-
},
|
|
298
|
+
l();
|
|
299
|
+
}, ve = (e) => {
|
|
300
|
+
if (!r.current) return;
|
|
301
|
+
const t = window.getSelection(), n = Ke((t == null ? void 0 : t.anchorNode) ?? null, r.current);
|
|
302
|
+
n && fn(n, e) && (l(), K());
|
|
303
|
+
}, Mt = (e, t) => {
|
|
285
304
|
if (e === "divider")
|
|
286
|
-
return /* @__PURE__ */
|
|
305
|
+
return /* @__PURE__ */ a("span", { className: sn }, `divider-${t}`);
|
|
287
306
|
if (e === "headingDropdown")
|
|
288
|
-
return /* @__PURE__ */
|
|
289
|
-
|
|
307
|
+
return /* @__PURE__ */ a(
|
|
308
|
+
Un,
|
|
290
309
|
{
|
|
291
310
|
title: "Heading",
|
|
292
|
-
options:
|
|
293
|
-
value:
|
|
294
|
-
disabled: c ||
|
|
295
|
-
onChange:
|
|
311
|
+
options: an,
|
|
312
|
+
value: pt || "p",
|
|
313
|
+
disabled: c || i,
|
|
314
|
+
onChange: Pt
|
|
296
315
|
},
|
|
297
316
|
"heading"
|
|
298
317
|
);
|
|
299
318
|
if (e === "textColor")
|
|
300
|
-
return /* @__PURE__ */
|
|
301
|
-
|
|
319
|
+
return /* @__PURE__ */ a(
|
|
320
|
+
je,
|
|
302
321
|
{
|
|
303
322
|
title: "Text color",
|
|
304
323
|
type: "text",
|
|
305
|
-
value:
|
|
306
|
-
disabled: c ||
|
|
307
|
-
onChange: (
|
|
308
|
-
var
|
|
309
|
-
(
|
|
324
|
+
value: Ct,
|
|
325
|
+
disabled: c || i,
|
|
326
|
+
onChange: (o) => {
|
|
327
|
+
var s;
|
|
328
|
+
(s = r.current) == null || s.focus(), vn(o), kt(o), l();
|
|
310
329
|
}
|
|
311
330
|
},
|
|
312
331
|
"textColor"
|
|
313
332
|
);
|
|
314
333
|
if (e === "highlightColor")
|
|
315
|
-
return /* @__PURE__ */
|
|
316
|
-
|
|
334
|
+
return /* @__PURE__ */ a(
|
|
335
|
+
je,
|
|
317
336
|
{
|
|
318
337
|
title: "Highlight color",
|
|
319
338
|
type: "highlight",
|
|
320
|
-
value:
|
|
321
|
-
disabled: c ||
|
|
322
|
-
onChange: (
|
|
323
|
-
var
|
|
324
|
-
(
|
|
339
|
+
value: Tt,
|
|
340
|
+
disabled: c || i,
|
|
341
|
+
onChange: (o) => {
|
|
342
|
+
var s;
|
|
343
|
+
(s = r.current) == null || s.focus(), On(o), It(o), l();
|
|
325
344
|
}
|
|
326
345
|
},
|
|
327
346
|
"highlightColor"
|
|
328
347
|
);
|
|
329
348
|
if (e === "link")
|
|
330
|
-
return /* @__PURE__ */
|
|
331
|
-
|
|
349
|
+
return /* @__PURE__ */ a(
|
|
350
|
+
h,
|
|
332
351
|
{
|
|
333
|
-
icon:
|
|
352
|
+
icon: f.link,
|
|
334
353
|
title: "Insert link",
|
|
335
|
-
disabled: c ||
|
|
336
|
-
onClick:
|
|
354
|
+
disabled: c || i,
|
|
355
|
+
onClick: xt
|
|
337
356
|
},
|
|
338
357
|
"link"
|
|
339
358
|
);
|
|
340
359
|
if (e === "image")
|
|
341
|
-
return /* @__PURE__ */
|
|
342
|
-
|
|
360
|
+
return /* @__PURE__ */ a(
|
|
361
|
+
h,
|
|
343
362
|
{
|
|
344
|
-
icon:
|
|
363
|
+
icon: f.image,
|
|
345
364
|
title: "Insert image",
|
|
346
|
-
disabled: c ||
|
|
365
|
+
disabled: c || i,
|
|
347
366
|
onClick: () => {
|
|
348
|
-
|
|
367
|
+
Bt();
|
|
349
368
|
}
|
|
350
369
|
},
|
|
351
370
|
"image"
|
|
352
371
|
);
|
|
353
372
|
if (e === "table")
|
|
354
|
-
return
|
|
355
|
-
|
|
373
|
+
return u.table ? /* @__PURE__ */ a(
|
|
374
|
+
h,
|
|
356
375
|
{
|
|
357
|
-
icon:
|
|
376
|
+
icon: f.table,
|
|
358
377
|
title: "Insert table",
|
|
359
|
-
disabled: c ||
|
|
360
|
-
onClick:
|
|
378
|
+
disabled: c || i,
|
|
379
|
+
onClick: ye
|
|
361
380
|
},
|
|
362
381
|
"table"
|
|
363
382
|
) : null;
|
|
383
|
+
if (e === Pe)
|
|
384
|
+
return u.signature ? /* @__PURE__ */ a(
|
|
385
|
+
h,
|
|
386
|
+
{
|
|
387
|
+
icon: f.signature,
|
|
388
|
+
title: "Sign pad",
|
|
389
|
+
active: Te,
|
|
390
|
+
disabled: c || i,
|
|
391
|
+
onClick: () => Ie(!0)
|
|
392
|
+
},
|
|
393
|
+
Pe
|
|
394
|
+
) : null;
|
|
395
|
+
if (e === xe)
|
|
396
|
+
return u.findReplace ? /* @__PURE__ */ a(
|
|
397
|
+
h,
|
|
398
|
+
{
|
|
399
|
+
icon: f.findReplace,
|
|
400
|
+
title: "Find and replace",
|
|
401
|
+
active: be,
|
|
402
|
+
disabled: c || i,
|
|
403
|
+
onClick: () => Ae((o) => !o)
|
|
404
|
+
},
|
|
405
|
+
xe
|
|
406
|
+
) : null;
|
|
407
|
+
if (e === Be)
|
|
408
|
+
return u.horizontalRule ? /* @__PURE__ */ a(
|
|
409
|
+
h,
|
|
410
|
+
{
|
|
411
|
+
icon: f.horizontalRule,
|
|
412
|
+
title: "Horizontal rule",
|
|
413
|
+
disabled: c || i,
|
|
414
|
+
onClick: () => {
|
|
415
|
+
var o;
|
|
416
|
+
(o = r.current) == null || o.focus(), I("<hr />"), l();
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
Be
|
|
420
|
+
) : null;
|
|
364
421
|
if (e === "undo")
|
|
365
|
-
return /* @__PURE__ */
|
|
366
|
-
|
|
422
|
+
return /* @__PURE__ */ a(
|
|
423
|
+
h,
|
|
367
424
|
{
|
|
368
|
-
icon:
|
|
425
|
+
icon: f.undo,
|
|
369
426
|
title: "Undo",
|
|
370
|
-
disabled: c ||
|
|
371
|
-
onClick:
|
|
427
|
+
disabled: c || i,
|
|
428
|
+
onClick: He
|
|
372
429
|
},
|
|
373
430
|
"undo"
|
|
374
431
|
);
|
|
375
432
|
if (e === "redo")
|
|
376
|
-
return /* @__PURE__ */
|
|
377
|
-
|
|
433
|
+
return /* @__PURE__ */ a(
|
|
434
|
+
h,
|
|
378
435
|
{
|
|
379
|
-
icon:
|
|
436
|
+
icon: f.redo,
|
|
380
437
|
title: "Redo",
|
|
381
|
-
disabled: c ||
|
|
382
|
-
onClick:
|
|
438
|
+
disabled: c || i,
|
|
439
|
+
onClick: _e
|
|
383
440
|
},
|
|
384
441
|
"redo"
|
|
385
442
|
);
|
|
386
443
|
if (e === "trackChanges")
|
|
387
|
-
return
|
|
388
|
-
|
|
444
|
+
return u.trackChanges ? /* @__PURE__ */ a(
|
|
445
|
+
h,
|
|
389
446
|
{
|
|
390
|
-
icon:
|
|
447
|
+
icon: f.trackChanges,
|
|
391
448
|
title: "Track changes",
|
|
392
|
-
active:
|
|
393
|
-
disabled: c ||
|
|
394
|
-
onClick: () =>
|
|
449
|
+
active: y,
|
|
450
|
+
disabled: c || i,
|
|
451
|
+
onClick: () => Rt(!y)
|
|
395
452
|
},
|
|
396
453
|
"trackChanges"
|
|
397
454
|
) : null;
|
|
398
455
|
if (e === "comments")
|
|
399
|
-
return
|
|
400
|
-
|
|
456
|
+
return u.comments ? /* @__PURE__ */ a(
|
|
457
|
+
h,
|
|
401
458
|
{
|
|
402
|
-
icon:
|
|
459
|
+
icon: f.comments,
|
|
403
460
|
title: "Comments",
|
|
404
|
-
active:
|
|
405
|
-
disabled: c ||
|
|
461
|
+
active: X,
|
|
462
|
+
disabled: c || i,
|
|
406
463
|
onClick: () => {
|
|
407
|
-
|
|
464
|
+
X ? Z(!1) : Ut();
|
|
408
465
|
}
|
|
409
466
|
},
|
|
410
467
|
"comments"
|
|
411
468
|
) : null;
|
|
412
469
|
if (e === "ai")
|
|
413
|
-
return !
|
|
414
|
-
|
|
470
|
+
return !u.ai || !(d != null && d.enabled) ? null : /* @__PURE__ */ a(
|
|
471
|
+
h,
|
|
415
472
|
{
|
|
416
|
-
icon:
|
|
473
|
+
icon: f.ai,
|
|
417
474
|
title: "Ink AI",
|
|
418
|
-
active:
|
|
419
|
-
disabled: c ||
|
|
420
|
-
onClick: () =>
|
|
475
|
+
active: he,
|
|
476
|
+
disabled: c || i,
|
|
477
|
+
onClick: () => q((o) => !o)
|
|
421
478
|
},
|
|
422
479
|
"ai"
|
|
423
480
|
);
|
|
424
|
-
const n =
|
|
425
|
-
return n ? /* @__PURE__ */
|
|
426
|
-
|
|
481
|
+
const n = Ue[e];
|
|
482
|
+
return n ? /* @__PURE__ */ a(
|
|
483
|
+
h,
|
|
427
484
|
{
|
|
428
|
-
icon:
|
|
485
|
+
icon: f[e] ?? e.slice(0, 1).toUpperCase(),
|
|
429
486
|
title: n.title,
|
|
430
|
-
active:
|
|
431
|
-
disabled: c ||
|
|
432
|
-
onClick: () =>
|
|
487
|
+
active: dt.has(e),
|
|
488
|
+
disabled: c || i,
|
|
489
|
+
onClick: () => Et(e)
|
|
433
490
|
},
|
|
434
491
|
e
|
|
435
492
|
) : null;
|
|
436
|
-
},
|
|
437
|
-
return /* @__PURE__ */
|
|
493
|
+
}, Vt = typeof V == "number" ? `${V}px` : V, jt = typeof j == "number" ? `${j}px` : j, Gt = !!(d != null && d.enabled && he);
|
|
494
|
+
return /* @__PURE__ */ M(
|
|
438
495
|
"div",
|
|
439
496
|
{
|
|
440
|
-
className:
|
|
441
|
-
"data-testid":
|
|
497
|
+
className: un(ln, We),
|
|
498
|
+
"data-testid": $e,
|
|
442
499
|
"data-disabled": c || void 0,
|
|
443
|
-
"data-variant":
|
|
444
|
-
|
|
500
|
+
"data-variant": qe,
|
|
501
|
+
"data-premium": w.active || void 0,
|
|
502
|
+
"data-wysiwyg": lt || void 0,
|
|
503
|
+
style: { ...ut, ...rt },
|
|
504
|
+
...ot,
|
|
445
505
|
children: [
|
|
446
|
-
/* @__PURE__ */
|
|
447
|
-
|
|
448
|
-
|
|
506
|
+
/* @__PURE__ */ a("div", { className: tn, role: "toolbar", "aria-label": "Ink formatting toolbar", children: Ge.map(Mt) }),
|
|
507
|
+
/* @__PURE__ */ a(
|
|
508
|
+
jn,
|
|
509
|
+
{
|
|
510
|
+
open: Te,
|
|
511
|
+
onClose: () => Ie(!1),
|
|
512
|
+
onConfirm: (e) => {
|
|
513
|
+
var t;
|
|
514
|
+
(t = r.current) == null || t.focus(), ee(e), l();
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
),
|
|
518
|
+
/* @__PURE__ */ a(
|
|
519
|
+
Gn,
|
|
520
|
+
{
|
|
521
|
+
open: be,
|
|
522
|
+
onClose: () => Ae(!1),
|
|
523
|
+
onReplace: (e, t, n) => {
|
|
524
|
+
if (!r.current) return;
|
|
525
|
+
const o = Rn(r.current.innerHTML, e, t, n);
|
|
526
|
+
b(o);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
),
|
|
530
|
+
y && u.trackChanges ? /* @__PURE__ */ a(
|
|
531
|
+
Vn,
|
|
449
532
|
{
|
|
450
533
|
changes: k,
|
|
451
|
-
onAccept:
|
|
452
|
-
onReject:
|
|
453
|
-
onAcceptAll: () => k.forEach((e) =>
|
|
454
|
-
onRejectAll: () => k.forEach((e) =>
|
|
534
|
+
onAccept: Ne,
|
|
535
|
+
onReject: Se,
|
|
536
|
+
onAcceptAll: () => k.forEach((e) => Ne(e.id)),
|
|
537
|
+
onRejectAll: () => k.forEach((e) => Se(e.id))
|
|
455
538
|
}
|
|
456
539
|
) : null,
|
|
457
|
-
/* @__PURE__ */
|
|
458
|
-
/* @__PURE__ */
|
|
459
|
-
|
|
460
|
-
|
|
540
|
+
/* @__PURE__ */ M("div", { className: nn, children: [
|
|
541
|
+
/* @__PURE__ */ M("div", { className: rn, children: [
|
|
542
|
+
u.blocks ? /* @__PURE__ */ a(
|
|
543
|
+
Kn,
|
|
461
544
|
{
|
|
462
|
-
visible:
|
|
463
|
-
top:
|
|
464
|
-
onMoveUp: () =>
|
|
465
|
-
onMoveDown: () =>
|
|
545
|
+
visible: _t && !c && !i,
|
|
546
|
+
top: yt,
|
|
547
|
+
onMoveUp: () => ve("up"),
|
|
548
|
+
onMoveDown: () => ve("down")
|
|
466
549
|
}
|
|
467
550
|
) : null,
|
|
468
|
-
/* @__PURE__ */
|
|
551
|
+
/* @__PURE__ */ a(
|
|
469
552
|
"div",
|
|
470
553
|
{
|
|
471
|
-
ref:
|
|
472
|
-
className:
|
|
473
|
-
contentEditable: !c && !
|
|
554
|
+
ref: r,
|
|
555
|
+
className: on,
|
|
556
|
+
contentEditable: !c && !i,
|
|
474
557
|
role: "textbox",
|
|
475
558
|
"aria-multiline": "true",
|
|
476
|
-
"aria-placeholder":
|
|
477
|
-
"data-placeholder":
|
|
559
|
+
"aria-placeholder": ne,
|
|
560
|
+
"data-placeholder": ne,
|
|
478
561
|
suppressContentEditableWarning: !0,
|
|
479
|
-
style: { minHeight:
|
|
480
|
-
onInput:
|
|
481
|
-
onBlur:
|
|
482
|
-
onKeyUp:
|
|
483
|
-
onKeyDown:
|
|
484
|
-
onMouseUp:
|
|
562
|
+
style: { minHeight: Vt, maxHeight: jt },
|
|
563
|
+
onInput: l,
|
|
564
|
+
onBlur: Ot,
|
|
565
|
+
onKeyUp: K,
|
|
566
|
+
onKeyDown: Ft,
|
|
567
|
+
onMouseUp: K,
|
|
485
568
|
onPaste: (e) => {
|
|
486
|
-
|
|
569
|
+
Dt(e);
|
|
487
570
|
}
|
|
488
571
|
}
|
|
489
572
|
),
|
|
490
|
-
|
|
491
|
-
|
|
573
|
+
Le ? /* @__PURE__ */ a(
|
|
574
|
+
Mn,
|
|
492
575
|
{
|
|
493
|
-
items:
|
|
494
|
-
top:
|
|
495
|
-
left:
|
|
496
|
-
onSelect:
|
|
576
|
+
items: Nt,
|
|
577
|
+
top: ke.top,
|
|
578
|
+
left: ke.left,
|
|
579
|
+
onSelect: Kt
|
|
497
580
|
}
|
|
498
581
|
) : null
|
|
499
582
|
] }),
|
|
500
|
-
|
|
501
|
-
|
|
583
|
+
X && u.comments ? /* @__PURE__ */ a(
|
|
584
|
+
Dn,
|
|
502
585
|
{
|
|
503
|
-
comments:
|
|
586
|
+
comments: O,
|
|
504
587
|
author: L,
|
|
505
|
-
onClose: () =>
|
|
588
|
+
onClose: () => Z(!1),
|
|
506
589
|
onResolve: (e) => {
|
|
507
|
-
const t =
|
|
508
|
-
|
|
509
|
-
|
|
590
|
+
const t = O.find((n) => n.id === e);
|
|
591
|
+
Y(
|
|
592
|
+
O.map(
|
|
510
593
|
(n) => n.id === e ? { ...n, resolved: !0 } : n
|
|
511
594
|
)
|
|
512
|
-
), t &&
|
|
595
|
+
), t && r.current && b(kn(r.current.innerHTML, t.highlightId));
|
|
513
596
|
},
|
|
514
597
|
onAddReply: (e, t) => {
|
|
515
|
-
|
|
516
|
-
|
|
598
|
+
Y(
|
|
599
|
+
O.map(
|
|
517
600
|
(n) => n.id === e ? {
|
|
518
601
|
...n,
|
|
519
602
|
replies: [
|
|
520
603
|
...n.replies,
|
|
521
604
|
{
|
|
522
|
-
id:
|
|
605
|
+
id: Fe("reply"),
|
|
523
606
|
author: L,
|
|
524
607
|
body: t,
|
|
525
608
|
timestamp: Date.now()
|
|
@@ -531,34 +614,34 @@ const C = {
|
|
|
531
614
|
}
|
|
532
615
|
}
|
|
533
616
|
) : null,
|
|
534
|
-
|
|
535
|
-
|
|
617
|
+
Gt && d ? /* @__PURE__ */ a(
|
|
618
|
+
Fn,
|
|
536
619
|
{
|
|
537
|
-
config:
|
|
538
|
-
documentHtml: ((
|
|
539
|
-
selectionHtml:
|
|
540
|
-
onClose: () =>
|
|
620
|
+
config: d,
|
|
621
|
+
documentHtml: ((Oe = r.current) == null ? void 0 : Oe.innerHTML) ?? g ?? "",
|
|
622
|
+
selectionHtml: ge,
|
|
623
|
+
onClose: () => q(!1),
|
|
541
624
|
onApplyHtml: (e) => {
|
|
542
625
|
var t;
|
|
543
|
-
if ((t =
|
|
544
|
-
|
|
626
|
+
if ((t = r.current) == null || t.focus(), ge)
|
|
627
|
+
I(e);
|
|
545
628
|
else {
|
|
546
|
-
|
|
629
|
+
b(e);
|
|
547
630
|
return;
|
|
548
631
|
}
|
|
549
|
-
|
|
632
|
+
l();
|
|
550
633
|
}
|
|
551
634
|
}
|
|
552
635
|
) : null
|
|
553
636
|
] }),
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
637
|
+
oe ? /* @__PURE__ */ M("div", { className: cn, children: [
|
|
638
|
+
ht,
|
|
639
|
+
ce ? ` / ${ce}` : ""
|
|
557
640
|
] }) : null
|
|
558
641
|
]
|
|
559
642
|
}
|
|
560
643
|
);
|
|
561
644
|
};
|
|
562
645
|
export {
|
|
563
|
-
|
|
646
|
+
br as InkEditor
|
|
564
647
|
};
|