@connectedxm/entity-editor 0.0.3 → 0.0.4
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/dist/index.es.js +82 -76
- package/dist/src/Editor.d.ts +1 -0
- package/dist/src/helpers/entities/Link.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -31,7 +31,7 @@ function Fe() {
|
|
|
31
31
|
}
|
|
32
32
|
return x.Fragment = t, x.jsx = n, x.jsxs = n, x;
|
|
33
33
|
}
|
|
34
|
-
var
|
|
34
|
+
var D = {};
|
|
35
35
|
/**
|
|
36
36
|
* @license React
|
|
37
37
|
* react-jsx-runtime.development.js
|
|
@@ -47,7 +47,7 @@ function We() {
|
|
|
47
47
|
function e(r) {
|
|
48
48
|
if (r == null) return null;
|
|
49
49
|
if (typeof r == "function")
|
|
50
|
-
return r.$$typeof ===
|
|
50
|
+
return r.$$typeof === V ? null : r.displayName || r.name || null;
|
|
51
51
|
if (typeof r == "string") return r;
|
|
52
52
|
switch (r) {
|
|
53
53
|
case O:
|
|
@@ -60,7 +60,7 @@ function We() {
|
|
|
60
60
|
return "Suspense";
|
|
61
61
|
case U:
|
|
62
62
|
return "SuspenseList";
|
|
63
|
-
case
|
|
63
|
+
case z:
|
|
64
64
|
return "Activity";
|
|
65
65
|
}
|
|
66
66
|
if (typeof r == "object")
|
|
@@ -78,7 +78,7 @@ function We() {
|
|
|
78
78
|
return r = r.displayName, r || (r = l.displayName || l.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
|
|
79
79
|
case S:
|
|
80
80
|
return l = r.displayName || null, l !== null ? l : e(r.type) || "Memo";
|
|
81
|
-
case
|
|
81
|
+
case I:
|
|
82
82
|
l = r._payload, r = r._init;
|
|
83
83
|
try {
|
|
84
84
|
return e(r(l));
|
|
@@ -109,7 +109,7 @@ function We() {
|
|
|
109
109
|
}
|
|
110
110
|
function s(r) {
|
|
111
111
|
if (r === O) return "<>";
|
|
112
|
-
if (typeof r == "object" && r !== null && r.$$typeof ===
|
|
112
|
+
if (typeof r == "object" && r !== null && r.$$typeof === I)
|
|
113
113
|
return "<...>";
|
|
114
114
|
try {
|
|
115
115
|
var l = e(r);
|
|
@@ -119,7 +119,7 @@ function We() {
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
function o() {
|
|
122
|
-
var r =
|
|
122
|
+
var r = M.A;
|
|
123
123
|
return r === null ? null : r.getOwner();
|
|
124
124
|
}
|
|
125
125
|
function i() {
|
|
@@ -152,7 +152,7 @@ function We() {
|
|
|
152
152
|
}
|
|
153
153
|
function m(r, l, d, g, R, w, de, Ee) {
|
|
154
154
|
return d = w.ref, r = {
|
|
155
|
-
$$typeof:
|
|
155
|
+
$$typeof: j,
|
|
156
156
|
type: r,
|
|
157
157
|
key: l,
|
|
158
158
|
props: w,
|
|
@@ -197,10 +197,10 @@ function We() {
|
|
|
197
197
|
else p(k);
|
|
198
198
|
if (G.call(l, "key")) {
|
|
199
199
|
k = e(r);
|
|
200
|
-
var
|
|
201
|
-
return
|
|
200
|
+
var P = Object.keys(l).filter(function(Le) {
|
|
201
|
+
return Le !== "key";
|
|
202
202
|
});
|
|
203
|
-
g = 0 <
|
|
203
|
+
g = 0 < P.length ? "{key: someKey, " + P.join(": ..., ") + ": ...}" : "{key: someKey}", h[k + g] || (P = 0 < P.length ? "{" + P.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
204
204
|
`A props object containing a "key" prop is being spread into JSX:
|
|
205
205
|
let props = %s;
|
|
206
206
|
<%s {...props} />
|
|
@@ -209,7 +209,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
209
209
|
<%s key={someKey} {...props} />`,
|
|
210
210
|
g,
|
|
211
211
|
k,
|
|
212
|
-
|
|
212
|
+
P,
|
|
213
213
|
k
|
|
214
214
|
), h[k + g] = !0);
|
|
215
215
|
}
|
|
@@ -233,22 +233,22 @@ React keys must be passed directly to JSX without using spread:
|
|
|
233
233
|
);
|
|
234
234
|
}
|
|
235
235
|
function p(r) {
|
|
236
|
-
typeof r == "object" && r !== null && r.$$typeof ===
|
|
236
|
+
typeof r == "object" && r !== null && r.$$typeof === j && r._store && (r._store.validated = 1);
|
|
237
237
|
}
|
|
238
|
-
var
|
|
238
|
+
var C = A, j = Symbol.for("react.transitional.element"), v = Symbol.for("react.portal"), O = Symbol.for("react.fragment"), le = Symbol.for("react.strict_mode"), F = Symbol.for("react.profiler"), W = Symbol.for("react.consumer"), K = Symbol.for("react.context"), ue = Symbol.for("react.forward_ref"), ae = Symbol.for("react.suspense"), U = Symbol.for("react.suspense_list"), S = Symbol.for("react.memo"), I = Symbol.for("react.lazy"), z = Symbol.for("react.activity"), V = Symbol.for("react.client.reference"), M = C.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, G = Object.prototype.hasOwnProperty, fe = Array.isArray, T = console.createTask ? console.createTask : function() {
|
|
239
239
|
return null;
|
|
240
240
|
};
|
|
241
|
-
|
|
241
|
+
C = {
|
|
242
242
|
react_stack_bottom_frame: function(r) {
|
|
243
243
|
return r();
|
|
244
244
|
}
|
|
245
245
|
};
|
|
246
|
-
var J, a = {}, _ =
|
|
247
|
-
|
|
246
|
+
var J, a = {}, _ = C.react_stack_bottom_frame.bind(
|
|
247
|
+
C,
|
|
248
248
|
i
|
|
249
|
-
)(), E =
|
|
250
|
-
|
|
251
|
-
var w = 1e4 >
|
|
249
|
+
)(), E = T(s(i)), h = {};
|
|
250
|
+
D.Fragment = O, D.jsx = function(r, l, d, g, R) {
|
|
251
|
+
var w = 1e4 > M.recentlyCreatedOwnerStacks++;
|
|
252
252
|
return N(
|
|
253
253
|
r,
|
|
254
254
|
l,
|
|
@@ -257,10 +257,10 @@ React keys must be passed directly to JSX without using spread:
|
|
|
257
257
|
g,
|
|
258
258
|
R,
|
|
259
259
|
w ? Error("react-stack-top-frame") : _,
|
|
260
|
-
w ?
|
|
260
|
+
w ? T(s(r)) : E
|
|
261
261
|
);
|
|
262
|
-
},
|
|
263
|
-
var w = 1e4 >
|
|
262
|
+
}, D.jsxs = function(r, l, d, g, R) {
|
|
263
|
+
var w = 1e4 > M.recentlyCreatedOwnerStacks++;
|
|
264
264
|
return N(
|
|
265
265
|
r,
|
|
266
266
|
l,
|
|
@@ -269,16 +269,16 @@ React keys must be passed directly to JSX without using spread:
|
|
|
269
269
|
g,
|
|
270
270
|
R,
|
|
271
271
|
w ? Error("react-stack-top-frame") : _,
|
|
272
|
-
w ?
|
|
272
|
+
w ? T(s(r)) : E
|
|
273
273
|
);
|
|
274
274
|
};
|
|
275
|
-
})()),
|
|
275
|
+
})()), D;
|
|
276
276
|
}
|
|
277
277
|
var Ie;
|
|
278
278
|
function Ke() {
|
|
279
279
|
return Ie || (Ie = 1, process.env.NODE_ENV === "production" ? X.exports = Fe() : X.exports = We()), X.exports;
|
|
280
280
|
}
|
|
281
|
-
var
|
|
281
|
+
var y = Ke();
|
|
282
282
|
const ye = () => {
|
|
283
283
|
const e = window.getSelection(), t = document.getElementById("entity-editor");
|
|
284
284
|
if (!e || !t) return { start: 0, end: 0 };
|
|
@@ -314,7 +314,7 @@ const ye = () => {
|
|
|
314
314
|
const N = window.getSelection();
|
|
315
315
|
N?.removeAllRanges(), N?.addRange(m);
|
|
316
316
|
}
|
|
317
|
-
},
|
|
317
|
+
}, ze = (e, t, n) => {
|
|
318
318
|
let s = "", o = "", i = "", c = "";
|
|
319
319
|
t.includes("bold") && (o = "bold"), t.includes("italic") && (i = "italic"), (t.includes("underline") || e === "link") && (c += "underline"), t.includes("strike") && (c += " line-through"), e !== "segment" && (s = "#1da1f2", e === "mention" && n.mentionColor ? s = n.mentionColor : e === "interest" && n.interestColor ? s = n.interestColor : e === "link" && n.linkColor && (s = n.linkColor));
|
|
320
320
|
let u = "";
|
|
@@ -325,24 +325,27 @@ const ye = () => {
|
|
|
325
325
|
let s = "", o = 0;
|
|
326
326
|
return t.forEach((i) => {
|
|
327
327
|
o < i.startIndex && (s += e.slice(o, i.startIndex));
|
|
328
|
-
const c = e.slice(i.startIndex, i.endIndex), u =
|
|
328
|
+
const c = e.slice(i.startIndex, i.endIndex), u = ze(i.type, i.marks, n);
|
|
329
329
|
s += `<span style="${u}">${c}</span>`, o = i.endIndex;
|
|
330
330
|
}), s += e.slice(o), s;
|
|
331
|
-
},
|
|
331
|
+
}, Ve = (e, t) => {
|
|
332
332
|
let n = !1;
|
|
333
333
|
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), document.execCommand("insertLineBreak"), n = !0) : (e.metaKey || e.ctrlKey) && (e.key === "b" ? (t("bold"), n = !0) : e.key === "i" ? (t("italic"), n = !0) : e.key === "u" ? (t("underline"), n = !0) : e.key === "s" && (t("strike"), n = !0)), n && e.preventDefault();
|
|
334
|
-
}, ee = 128, Ge =
|
|
334
|
+
}, ee = 128, Ge = "()[]{}", Te = "", Je = new RegExp(
|
|
335
|
+
"^(?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62})?[a-z0-9\\u00a1-\\uffff]\\.)+(?:[a-z\\u00a1-\\uffff]{2,}\\.?))(?::\\d{2,5})?(?:[/?#]\\S*)?$",
|
|
336
|
+
"i"
|
|
337
|
+
), xe = (e, t) => {
|
|
335
338
|
const n = ve(
|
|
336
339
|
e,
|
|
337
340
|
t,
|
|
338
|
-
|
|
339
|
-
|
|
341
|
+
Ge,
|
|
342
|
+
Te
|
|
340
343
|
);
|
|
341
|
-
return n?.search.match(
|
|
344
|
+
return n?.search.match(Je) ? {
|
|
342
345
|
type: "link",
|
|
343
346
|
...n
|
|
344
347
|
} : null;
|
|
345
|
-
}, te = (e) => (e & ee) !== 0, Re = (e, t) => t ? e | ee : e & ~ee, re = 32, Xe = /^@[a-zA-Z0-9_'-]+$/, qe = `.,!?;()[]{}"'<>#`, ne = "@",
|
|
348
|
+
}, te = (e) => (e & ee) !== 0, Re = (e, t) => t ? e | ee : e & ~ee, re = 32, Xe = /^@[a-zA-Z0-9_'-]+$/, qe = `.,!?;()[]{}"'<>#`, ne = "@", De = (e, t) => {
|
|
346
349
|
const n = ve(
|
|
347
350
|
e,
|
|
348
351
|
t,
|
|
@@ -353,7 +356,7 @@ const ye = () => {
|
|
|
353
356
|
type: "mention",
|
|
354
357
|
...n
|
|
355
358
|
} : null;
|
|
356
|
-
}, oe = (e) => (e & re) !== 0, _e = (e, t) => t ? e | re : e & ~re,
|
|
359
|
+
}, oe = (e) => (e & re) !== 0, _e = (e, t) => t ? e | re : e & ~re, B = 2, q = (e) => (e & B) !== 0, ke = (e, t) => t ? e | B : e & ~B, L = 4, H = (e) => (e & L) !== 0, be = (e, t) => t ? e | L : e & ~L, $ = 16, Z = (e) => (e & $) !== 0, Se = (e, t) => t ? e | $ : e & ~$, Y = 8, Q = (e) => (e & Y) !== 0, we = (e, t) => t ? e | Y : e & ~Y, je = (e, t) => {
|
|
357
360
|
if (e === t) return null;
|
|
358
361
|
let n = 0;
|
|
359
362
|
for (; n < e.length && n < t.length && e[n] === t[n]; )
|
|
@@ -386,7 +389,7 @@ const ye = () => {
|
|
|
386
389
|
i--;
|
|
387
390
|
}
|
|
388
391
|
return e;
|
|
389
|
-
},
|
|
392
|
+
}, Pe = (e, t, n) => {
|
|
390
393
|
if (!t) return e;
|
|
391
394
|
const { position: s, deletedLength: o, insertedText: i } = t, c = i.length;
|
|
392
395
|
let u = [...e];
|
|
@@ -426,7 +429,7 @@ const ye = () => {
|
|
|
426
429
|
startIndex: i,
|
|
427
430
|
endIndex: c
|
|
428
431
|
};
|
|
429
|
-
}, se = 64, Ze = `.,!?;()[]{}"'<>@`, Qe = /^#[\w-]+$/, ie = "#",
|
|
432
|
+
}, se = 64, Ze = `.,!?;()[]{}"'<>@`, Qe = /^#[\w-]+$/, ie = "#", Be = (e, t) => {
|
|
430
433
|
const n = ve(
|
|
431
434
|
e,
|
|
432
435
|
t,
|
|
@@ -457,8 +460,8 @@ const ye = () => {
|
|
|
457
460
|
startIndex: c,
|
|
458
461
|
endIndex: u + 1,
|
|
459
462
|
marks: m,
|
|
460
|
-
username: f === "mention" ?
|
|
461
|
-
interest: f === "interest" ?
|
|
463
|
+
username: f === "mention" ? De(e, u)?.search.replace(ne, "") : void 0,
|
|
464
|
+
interest: f === "interest" ? Be(e, u)?.search.replace(
|
|
462
465
|
ie,
|
|
463
466
|
""
|
|
464
467
|
) : void 0,
|
|
@@ -467,9 +470,9 @@ const ye = () => {
|
|
|
467
470
|
s.push(N), o = u + 1;
|
|
468
471
|
}
|
|
469
472
|
return s;
|
|
470
|
-
}, rt = (e, t) => e & re && t.mentions ? "mention" : e & se && t.interests ? "interest" : e & ee && t.links ? "link" : (e & (
|
|
473
|
+
}, rt = (e, t) => e & re && t.mentions ? "mention" : e & se && t.interests ? "interest" : e & ee && t.links ? "link" : (e & (B | L | Y | $), "segment"), nt = (e) => {
|
|
471
474
|
const t = [];
|
|
472
|
-
return e &
|
|
475
|
+
return e & B && t.push("bold"), e & L && t.push("italic"), e & Y && t.push("underline"), e & $ && t.push("strike"), t;
|
|
473
476
|
}, b = (e, t) => {
|
|
474
477
|
const n = e[t];
|
|
475
478
|
return typeof n != "number" ? 0 : n;
|
|
@@ -532,7 +535,7 @@ const ye = () => {
|
|
|
532
535
|
for (let c = t; c < n; c++)
|
|
533
536
|
o = st(o, c, s, i);
|
|
534
537
|
return o;
|
|
535
|
-
},
|
|
538
|
+
}, Me = (e, t) => {
|
|
536
539
|
const n = new Array(e.length).fill(0);
|
|
537
540
|
for (let s = 0; s < e.length; s++) {
|
|
538
541
|
let o = 0;
|
|
@@ -565,25 +568,28 @@ const ye = () => {
|
|
|
565
568
|
options: m = {},
|
|
566
569
|
entityStyles: N = {},
|
|
567
570
|
placeholder: p = "",
|
|
568
|
-
debug:
|
|
569
|
-
...
|
|
571
|
+
debug: C = !1,
|
|
572
|
+
...j
|
|
570
573
|
}) => {
|
|
571
|
-
const v = A.useRef(null), [O, le] = A.useState({ start: 0, end: 0 }), [F, W] = A.useState(!1), [K, ue] = A.useState(!1), [ae, U] = A.useState(!1), [S,
|
|
572
|
-
|
|
574
|
+
const v = A.useRef(null), [O, le] = A.useState({ start: 0, end: 0 }), [F, W] = A.useState(!1), [K, ue] = A.useState(!1), [ae, U] = A.useState(!1), [S, I] = A.useState(
|
|
575
|
+
Me(t, s)
|
|
573
576
|
);
|
|
574
577
|
e.current = {
|
|
575
578
|
selectEntity: (a, _, E, h) => {
|
|
576
579
|
if (!v.current) return;
|
|
577
580
|
let r = [...S];
|
|
578
|
-
a === "mention" ? h = ne + h : a === "interest" ? h = ie + h : a === "link" && (h =
|
|
579
|
-
const l = t.slice(0, _) + h + t.slice(E), d =
|
|
580
|
-
d ? r =
|
|
581
|
+
a === "mention" ? h = ne + h : a === "interest" ? h = ie + h : a === "link" && (h = Te + h);
|
|
582
|
+
const l = t.slice(0, _) + h + t.slice(E), d = je(t, l);
|
|
583
|
+
d ? r = Pe(S, d, i) : r = Me(l, s);
|
|
581
584
|
for (let g = _; g < _ + h.length; g++)
|
|
582
585
|
r[g] = ot(r, g, a);
|
|
583
|
-
n(l),
|
|
586
|
+
n(l), I(r), f(null);
|
|
584
587
|
},
|
|
585
588
|
toggleMark: (a) => {
|
|
586
|
-
|
|
589
|
+
V(a);
|
|
590
|
+
},
|
|
591
|
+
clear: () => {
|
|
592
|
+
n(""), I([]), o([]);
|
|
587
593
|
}
|
|
588
594
|
}, A.useEffect(() => {
|
|
589
595
|
if (v.current) {
|
|
@@ -596,10 +602,10 @@ const ye = () => {
|
|
|
596
602
|
const a = tt(t, S, m), _ = ye() ?? O, E = Ce(t, a, N);
|
|
597
603
|
v.current.innerHTML = E, o(a), K && Ue(v.current, _);
|
|
598
604
|
}, [S]);
|
|
599
|
-
const
|
|
605
|
+
const z = ut(O, 500);
|
|
600
606
|
A.useEffect(() => {
|
|
601
|
-
let { start: a, end: _ } =
|
|
602
|
-
if (!E && !oe(b(S, a - 1)) && (E =
|
|
607
|
+
let { start: a, end: _ } = z, E = null;
|
|
608
|
+
if (!E && !oe(b(S, a - 1)) && (E = De(t, a), E && (E.search = E.search.replace(ne, ""))), !E && !ce(b(S, a - 1)) && (E = Be(t, a), E && (E.search = E.search.replace(ie, ""))), !E && !te(b(S, a - 1)) && (E = xe(t, a)), E ? f(E) : u && f(null), F) return;
|
|
603
609
|
let h = !0, r = !0, l = !0, d = !0;
|
|
604
610
|
if (a === _)
|
|
605
611
|
if (a > 0) {
|
|
@@ -620,38 +626,38 @@ const ye = () => {
|
|
|
620
626
|
underline: l,
|
|
621
627
|
strike: d
|
|
622
628
|
});
|
|
623
|
-
}, [
|
|
624
|
-
const
|
|
629
|
+
}, [z]);
|
|
630
|
+
const V = (a) => {
|
|
625
631
|
if (W(!0), !v.current)
|
|
626
632
|
return;
|
|
627
633
|
const { start: _, end: E } = O;
|
|
628
634
|
if (_ !== E) {
|
|
629
635
|
const r = lt(S, _, E, a);
|
|
630
|
-
|
|
636
|
+
I(r);
|
|
631
637
|
}
|
|
632
638
|
const h = { ...i };
|
|
633
639
|
a === "bold" ? h.bold = !i.bold : a === "italic" ? h.italic = !i.italic : a === "underline" ? h.underline = !i.underline : a === "strike" && (h.strike = !i.strike), c(h);
|
|
634
|
-
},
|
|
640
|
+
}, M = (a) => {
|
|
635
641
|
if (!v.current) return;
|
|
636
642
|
if (F && W(!1), a.target.textContent.length === 0) {
|
|
637
|
-
n(""),
|
|
643
|
+
n(""), I([]), o([]);
|
|
638
644
|
return;
|
|
639
645
|
}
|
|
640
|
-
const _ = a.target.innerText || "", E =
|
|
646
|
+
const _ = a.target.innerText || "", E = je(t, _);
|
|
641
647
|
if (E) {
|
|
642
|
-
const h =
|
|
648
|
+
const h = Pe(
|
|
643
649
|
S,
|
|
644
650
|
E,
|
|
645
651
|
i
|
|
646
652
|
);
|
|
647
|
-
|
|
653
|
+
I(h);
|
|
648
654
|
}
|
|
649
655
|
n(_);
|
|
650
656
|
}, G = (a) => {
|
|
651
|
-
v.current &&
|
|
657
|
+
v.current && Ve(a, V);
|
|
652
658
|
}, fe = () => {
|
|
653
659
|
U(!0);
|
|
654
|
-
},
|
|
660
|
+
}, T = () => {
|
|
655
661
|
U(!1);
|
|
656
662
|
};
|
|
657
663
|
A.useEffect(() => {
|
|
@@ -664,42 +670,42 @@ const ye = () => {
|
|
|
664
670
|
};
|
|
665
671
|
}, []);
|
|
666
672
|
const J = t.length === 0 && p && !ae;
|
|
667
|
-
return /* @__PURE__ */
|
|
668
|
-
/* @__PURE__ */
|
|
669
|
-
/* @__PURE__ */
|
|
673
|
+
return /* @__PURE__ */ y.jsxs(y.Fragment, { children: [
|
|
674
|
+
/* @__PURE__ */ y.jsxs("div", { style: { position: "relative" }, children: [
|
|
675
|
+
/* @__PURE__ */ y.jsx(
|
|
670
676
|
"div",
|
|
671
677
|
{
|
|
672
678
|
id: "entity-editor",
|
|
673
679
|
ref: v,
|
|
674
|
-
style: { ...
|
|
675
|
-
className:
|
|
680
|
+
style: { ...j.style, position: "relative", zIndex: 2 },
|
|
681
|
+
className: j.className,
|
|
676
682
|
contentEditable: !0,
|
|
677
683
|
onKeyDown: G,
|
|
678
|
-
onInput:
|
|
684
|
+
onInput: M,
|
|
679
685
|
onFocus: fe,
|
|
680
|
-
onBlur:
|
|
686
|
+
onBlur: T,
|
|
681
687
|
role: "textbox",
|
|
682
688
|
"aria-multiline": "true"
|
|
683
689
|
}
|
|
684
690
|
),
|
|
685
|
-
J && /* @__PURE__ */
|
|
691
|
+
J && /* @__PURE__ */ y.jsx(
|
|
686
692
|
"div",
|
|
687
693
|
{
|
|
688
694
|
style: {
|
|
695
|
+
...j.style,
|
|
689
696
|
position: "absolute",
|
|
690
697
|
top: 0,
|
|
691
698
|
left: 0,
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
padding: I.style?.padding,
|
|
699
|
+
right: 0,
|
|
700
|
+
bottom: 0,
|
|
695
701
|
color: "#9ca3af"
|
|
696
702
|
},
|
|
697
703
|
"aria-hidden": "true",
|
|
698
|
-
children: p
|
|
704
|
+
children: /* @__PURE__ */ y.jsx("p", { children: p })
|
|
699
705
|
}
|
|
700
706
|
)
|
|
701
707
|
] }),
|
|
702
|
-
|
|
708
|
+
C && /* @__PURE__ */ y.jsx("div", { style: {}, children: /* @__PURE__ */ y.jsx("pre", { children: JSON.stringify(S) }) })
|
|
703
709
|
] });
|
|
704
710
|
};
|
|
705
711
|
export {
|
package/dist/src/Editor.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Entity, EntityOptions, StyleOptions, EntityType, MarkState, MarkType, S
|
|
|
3
3
|
export interface EditorRef {
|
|
4
4
|
selectEntity: (entityType: EntityType, startIndex: number, endIndex: number, newText: string) => void;
|
|
5
5
|
toggleMark: (markType: MarkType) => void;
|
|
6
|
+
clear: () => void;
|
|
6
7
|
}
|
|
7
8
|
export interface EditorProps {
|
|
8
9
|
ref: React.RefObject<EditorRef | null>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SearchEntity } from '../../interfaces';
|
|
2
2
|
export declare const LINK_MASK = 128;
|
|
3
|
-
export declare const LINK_REGEX: RegExp;
|
|
4
3
|
export declare const LINK_BOUNDARIES = "()[]{}";
|
|
5
4
|
export declare const LINK_KEY = "";
|
|
5
|
+
export declare const LINK_REGEX: RegExp;
|
|
6
6
|
export declare const getLinkWord: (plainText: string, position: number) => SearchEntity | null;
|
|
7
7
|
export declare const isLink: (value: number) => boolean;
|
|
8
8
|
export declare const setLink: (value: number, link: boolean) => number;
|