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