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