eddyter 1.4.19 → 1.4.20-beta.0
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/README.md +6 -3
- package/dist/{AIChatPlugin-BUWq8ixX.js → AIChatPlugin-XDBXQanb.js} +3 -3
- package/dist/{CombinedAutocompletGrammarPlugin-Dq25w8tq.js → CombinedAutocompletGrammarPlugin-BRBmG7Uo.js} +186 -167
- package/dist/{CommentBubblePlugin-B77d3Qq6.js → CommentBubblePlugin-BALioirG.js} +1 -1
- package/dist/{CommentPlugin-BJQyKmrN.js → CommentPlugin-CHmC9IZh.js} +2 -2
- package/dist/{NotePanelPlugin-BqOdcg07.js → NotePanelPlugin-CPGzqjuk.js} +1 -1
- package/dist/{TextEnhancePlugin-BnmdRgUu.js → TextEnhancePlugin-DgC4kmVA.js} +2 -2
- package/dist/assets/style.css +1 -1
- package/dist/components/FormatTextMenu/FormatTextMenu.d.ts +5 -0
- package/dist/components/InsertVideoDialog.d.ts +7 -0
- package/dist/components/ListMenu/ListMenu.d.ts +10 -0
- package/dist/components/ListMenu/index.d.ts +1 -0
- package/dist/components/NewBadge/NewBadge.d.ts +5 -0
- package/dist/components/NewBadge/NewDot.d.ts +9 -0
- package/dist/components/Toolbar/styles.d.ts +2 -2
- package/dist/{generateDocxThumbnail-DBMxjZ83.js → generateDocxThumbnail-BTxOqVy6.js} +1 -1
- package/dist/{generatePdfThumbnail-Cv2-ZCzh.js → generatePdfThumbnail-bcpGGSUp.js} +1 -1
- package/dist/{generateXlsxThumbnail-UHmNc7Fa.js → generateXlsxThumbnail-BWM1cmSl.js} +1 -1
- package/dist/hooks/useNewFeatures.d.ts +5 -0
- package/dist/{index-Bex3G_eE.js → index-0VTRLfjb.js} +15648 -14919
- package/dist/{index-ChSepytp.js → index-BNICgdB-.js} +21 -21
- package/dist/{index-q_TW8dU1.js → index-BxOZNLwu.js} +4 -4
- package/dist/{index-C_mjLQUF.js → index-DDSVx-B8.js} +2 -2
- package/dist/{index-Cl_A9eof.js → index-DRLZF4xQ.js} +193 -198
- package/dist/{index-BaWQzoL2.js → index-DZESLGLB.js} +1 -1
- package/dist/{index-DcHU8PlQ.js → index-FZ7Aopvl.js} +73 -73
- package/dist/index.d.ts +0 -1
- package/dist/index.js +12 -13
- package/dist/nodes/ButtonNode.d.ts +15 -2
- package/dist/nodes/documentPalette.d.ts +24 -0
- package/dist/plugins/WordCountPlugin.d.ts +2 -0
- package/dist/{sparkles-C-XoMho5.js → sparkles-DIeZhywG.js} +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/ui/Icons.d.ts +7 -1
- package/dist/{useVoiceToText-BzaLSbRi.js → useVoiceToText-sR--QAUC.js} +1 -1
- package/dist/utils/neutralTextColor.d.ts +22 -0
- package/dist/utils/newFeatures.d.ts +13 -0
- package/dist/utils/notePanelPaste.d.ts +3 -0
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { c as
|
|
1
|
+
import { jsx as y, jsxs as L, Fragment as ve } from "react/jsx-runtime";
|
|
2
|
+
import { c as ye, a3 as J, a4 as Ee, a5 as be, a6 as ke, a7 as Se, a8 as Me, a0 as Ne, a9 as Ut, aa as Re } from "./index-0VTRLfjb.js";
|
|
3
3
|
import { $isCodeNode as Ie } from "@lexical/code";
|
|
4
4
|
import { useLexicalComposerContext as Oe } from "@lexical/react/LexicalComposerContext";
|
|
5
5
|
import { $getRoot as It, $getSelection as zt, $isRangeSelection as qt, $isTextNode as ut, $getNodeByKey as Gt, $createRangeSelection as Le, $setSelection as Ae, KEY_ARROW_DOWN_COMMAND as Be, COMMAND_PRIORITY_LOW as at, KEY_ARROW_UP_COMMAND as Pe, KEY_ESCAPE_COMMAND as De, KEY_TAB_COMMAND as _e, KEY_ENTER_COMMAND as Te, createCommand as He, $isElementNode as Fe } from "lexical";
|
|
@@ -7,12 +7,12 @@ import { g as We } from "./_commonjsHelpers-DaMA6jEr.js";
|
|
|
7
7
|
import * as st from "react";
|
|
8
8
|
import { useRef as B, useState as q, useEffect as T, useCallback as G } from "react";
|
|
9
9
|
import { createPortal as Xt } from "react-dom";
|
|
10
|
-
import { S as $e } from "./sparkles-
|
|
11
|
-
const Yt =
|
|
10
|
+
import { S as $e } from "./sparkles-DIeZhywG.js";
|
|
11
|
+
const Yt = ye("BookOpen", [
|
|
12
12
|
["path", { d: "M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z", key: "vv98re" }],
|
|
13
13
|
["path", { d: "M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z", key: "1cyq3y" }]
|
|
14
14
|
]);
|
|
15
|
-
var
|
|
15
|
+
var Et = { exports: {} }, bt = { exports: {} }, jt;
|
|
16
16
|
function Ke() {
|
|
17
17
|
return jt || (jt = 1, (function() {
|
|
18
18
|
var o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", t = {
|
|
@@ -115,7 +115,7 @@ function Zt() {
|
|
|
115
115
|
return kt = o, kt;
|
|
116
116
|
}
|
|
117
117
|
var St, Qt;
|
|
118
|
-
function
|
|
118
|
+
function Ve() {
|
|
119
119
|
if (Qt) return St;
|
|
120
120
|
Qt = 1, St = function(e) {
|
|
121
121
|
return e != null && (o(e) || t(e) || !!e._isBuffer);
|
|
@@ -129,16 +129,16 @@ function Ue() {
|
|
|
129
129
|
return St;
|
|
130
130
|
}
|
|
131
131
|
var te;
|
|
132
|
-
function
|
|
132
|
+
function Ue() {
|
|
133
133
|
return te || (te = 1, (function() {
|
|
134
|
-
var o = Ke(), t = Zt().utf8, e =
|
|
134
|
+
var o = Ke(), t = Zt().utf8, e = Ve(), n = Zt().bin, c = function(d, h) {
|
|
135
135
|
d.constructor == String ? h && h.encoding === "binary" ? d = n.stringToBytes(d) : d = t.stringToBytes(d) : e(d) ? d = Array.prototype.slice.call(d, 0) : !Array.isArray(d) && d.constructor !== Uint8Array && (d = d.toString());
|
|
136
136
|
for (var r = o.bytesToWords(d), w = d.length * 8, i = 1732584193, s = -271733879, l = -1732584194, a = 271733878, f = 0; f < r.length; f++)
|
|
137
137
|
r[f] = (r[f] << 8 | r[f] >>> 24) & 16711935 | (r[f] << 24 | r[f] >>> 8) & 4278255360;
|
|
138
138
|
r[w >>> 5] |= 128 << w % 32, r[(w + 64 >>> 9 << 4) + 14] = w;
|
|
139
139
|
for (var M = c._ff, k = c._gg, S = c._hh, N = c._ii, f = 0; f < r.length; f += 16) {
|
|
140
|
-
var
|
|
141
|
-
i = M(i, s, l, a, r[f + 0], 7, -680876936), a = M(a, i, s, l, r[f + 1], 12, -389564586), l = M(l, a, i, s, r[f + 2], 17, 606105819), s = M(s, l, a, i, r[f + 3], 22, -1044525330), i = M(i, s, l, a, r[f + 4], 7, -176418897), a = M(a, i, s, l, r[f + 5], 12, 1200080426), l = M(l, a, i, s, r[f + 6], 17, -1473231341), s = M(s, l, a, i, r[f + 7], 22, -45705983), i = M(i, s, l, a, r[f + 8], 7, 1770035416), a = M(a, i, s, l, r[f + 9], 12, -1958414417), l = M(l, a, i, s, r[f + 10], 17, -42063), s = M(s, l, a, i, r[f + 11], 22, -1990404162), i = M(i, s, l, a, r[f + 12], 7, 1804603682), a = M(a, i, s, l, r[f + 13], 12, -40341101), l = M(l, a, i, s, r[f + 14], 17, -1502002290), s = M(s, l, a, i, r[f + 15], 22, 1236535329), i = k(i, s, l, a, r[f + 1], 5, -165796510), a = k(a, i, s, l, r[f + 6], 9, -1069501632), l = k(l, a, i, s, r[f + 11], 14, 643717713), s = k(s, l, a, i, r[f + 0], 20, -373897302), i = k(i, s, l, a, r[f + 5], 5, -701558691), a = k(a, i, s, l, r[f + 10], 9, 38016083), l = k(l, a, i, s, r[f + 15], 14, -660478335), s = k(s, l, a, i, r[f + 4], 20, -405537848), i = k(i, s, l, a, r[f + 9], 5, 568446438), a = k(a, i, s, l, r[f + 14], 9, -1019803690), l = k(l, a, i, s, r[f + 3], 14, -187363961), s = k(s, l, a, i, r[f + 8], 20, 1163531501), i = k(i, s, l, a, r[f + 13], 5, -1444681467), a = k(a, i, s, l, r[f + 2], 9, -51403784), l = k(l, a, i, s, r[f + 7], 14, 1735328473), s = k(s, l, a, i, r[f + 12], 20, -1926607734), i = S(i, s, l, a, r[f + 5], 4, -378558), a = S(a, i, s, l, r[f + 8], 11, -2022574463), l = S(l, a, i, s, r[f + 11], 16, 1839030562), s = S(s, l, a, i, r[f + 14], 23, -35309556), i = S(i, s, l, a, r[f + 1], 4, -1530992060), a = S(a, i, s, l, r[f + 4], 11, 1272893353), l = S(l, a, i, s, r[f + 7], 16, -155497632), s = S(s, l, a, i, r[f + 10], 23, -1094730640), i = S(i, s, l, a, r[f + 13], 4, 681279174), a = S(a, i, s, l, r[f + 0], 11, -358537222), l = S(l, a, i, s, r[f + 3], 16, -722521979), s = S(s, l, a, i, r[f + 6], 23, 76029189), i = S(i, s, l, a, r[f + 9], 4, -640364487), a = S(a, i, s, l, r[f + 12], 11, -421815835), l = S(l, a, i, s, r[f + 15], 16, 530742520), s = S(s, l, a, i, r[f + 2], 23, -995338651), i = N(i, s, l, a, r[f + 0], 6, -198630844), a = N(a, i, s, l, r[f + 7], 10, 1126891415), l = N(l, a, i, s, r[f + 14], 15, -1416354905), s = N(s, l, a, i, r[f + 5], 21, -57434055), i = N(i, s, l, a, r[f + 12], 6, 1700485571), a = N(a, i, s, l, r[f + 3], 10, -1894986606), l = N(l, a, i, s, r[f + 10], 15, -1051523), s = N(s, l, a, i, r[f + 1], 21, -2054922799), i = N(i, s, l, a, r[f + 8], 6, 1873313359), a = N(a, i, s, l, r[f + 15], 10, -30611744), l = N(l, a, i, s, r[f + 6], 15, -1560198380), s = N(s, l, a, i, r[f + 13], 21, 1309151649), i = N(i, s, l, a, r[f + 4], 6, -145523070), a = N(a, i, s, l, r[f + 11], 10, -1120210379), l = N(l, a, i, s, r[f + 2], 15, 718787259), s = N(s, l, a, i, r[f + 9], 21, -343485551), i = i +
|
|
140
|
+
var Z = i, P = s, H = l, X = a;
|
|
141
|
+
i = M(i, s, l, a, r[f + 0], 7, -680876936), a = M(a, i, s, l, r[f + 1], 12, -389564586), l = M(l, a, i, s, r[f + 2], 17, 606105819), s = M(s, l, a, i, r[f + 3], 22, -1044525330), i = M(i, s, l, a, r[f + 4], 7, -176418897), a = M(a, i, s, l, r[f + 5], 12, 1200080426), l = M(l, a, i, s, r[f + 6], 17, -1473231341), s = M(s, l, a, i, r[f + 7], 22, -45705983), i = M(i, s, l, a, r[f + 8], 7, 1770035416), a = M(a, i, s, l, r[f + 9], 12, -1958414417), l = M(l, a, i, s, r[f + 10], 17, -42063), s = M(s, l, a, i, r[f + 11], 22, -1990404162), i = M(i, s, l, a, r[f + 12], 7, 1804603682), a = M(a, i, s, l, r[f + 13], 12, -40341101), l = M(l, a, i, s, r[f + 14], 17, -1502002290), s = M(s, l, a, i, r[f + 15], 22, 1236535329), i = k(i, s, l, a, r[f + 1], 5, -165796510), a = k(a, i, s, l, r[f + 6], 9, -1069501632), l = k(l, a, i, s, r[f + 11], 14, 643717713), s = k(s, l, a, i, r[f + 0], 20, -373897302), i = k(i, s, l, a, r[f + 5], 5, -701558691), a = k(a, i, s, l, r[f + 10], 9, 38016083), l = k(l, a, i, s, r[f + 15], 14, -660478335), s = k(s, l, a, i, r[f + 4], 20, -405537848), i = k(i, s, l, a, r[f + 9], 5, 568446438), a = k(a, i, s, l, r[f + 14], 9, -1019803690), l = k(l, a, i, s, r[f + 3], 14, -187363961), s = k(s, l, a, i, r[f + 8], 20, 1163531501), i = k(i, s, l, a, r[f + 13], 5, -1444681467), a = k(a, i, s, l, r[f + 2], 9, -51403784), l = k(l, a, i, s, r[f + 7], 14, 1735328473), s = k(s, l, a, i, r[f + 12], 20, -1926607734), i = S(i, s, l, a, r[f + 5], 4, -378558), a = S(a, i, s, l, r[f + 8], 11, -2022574463), l = S(l, a, i, s, r[f + 11], 16, 1839030562), s = S(s, l, a, i, r[f + 14], 23, -35309556), i = S(i, s, l, a, r[f + 1], 4, -1530992060), a = S(a, i, s, l, r[f + 4], 11, 1272893353), l = S(l, a, i, s, r[f + 7], 16, -155497632), s = S(s, l, a, i, r[f + 10], 23, -1094730640), i = S(i, s, l, a, r[f + 13], 4, 681279174), a = S(a, i, s, l, r[f + 0], 11, -358537222), l = S(l, a, i, s, r[f + 3], 16, -722521979), s = S(s, l, a, i, r[f + 6], 23, 76029189), i = S(i, s, l, a, r[f + 9], 4, -640364487), a = S(a, i, s, l, r[f + 12], 11, -421815835), l = S(l, a, i, s, r[f + 15], 16, 530742520), s = S(s, l, a, i, r[f + 2], 23, -995338651), i = N(i, s, l, a, r[f + 0], 6, -198630844), a = N(a, i, s, l, r[f + 7], 10, 1126891415), l = N(l, a, i, s, r[f + 14], 15, -1416354905), s = N(s, l, a, i, r[f + 5], 21, -57434055), i = N(i, s, l, a, r[f + 12], 6, 1700485571), a = N(a, i, s, l, r[f + 3], 10, -1894986606), l = N(l, a, i, s, r[f + 10], 15, -1051523), s = N(s, l, a, i, r[f + 1], 21, -2054922799), i = N(i, s, l, a, r[f + 8], 6, 1873313359), a = N(a, i, s, l, r[f + 15], 10, -30611744), l = N(l, a, i, s, r[f + 6], 15, -1560198380), s = N(s, l, a, i, r[f + 13], 21, 1309151649), i = N(i, s, l, a, r[f + 4], 6, -145523070), a = N(a, i, s, l, r[f + 11], 10, -1120210379), l = N(l, a, i, s, r[f + 2], 15, 718787259), s = N(s, l, a, i, r[f + 9], 21, -343485551), i = i + Z >>> 0, s = s + P >>> 0, l = l + H >>> 0, a = a + X >>> 0;
|
|
142
142
|
}
|
|
143
143
|
return o.endian([i, s, l, a]);
|
|
144
144
|
};
|
|
@@ -154,28 +154,28 @@ function Ve() {
|
|
|
154
154
|
}, c._ii = function(d, h, r, w, i, s, l) {
|
|
155
155
|
var a = d + (r ^ (h | ~w)) + (i >>> 0) + l;
|
|
156
156
|
return (a << s | a >>> 32 - s) + h;
|
|
157
|
-
}, c._blocksize = 16, c._digestsize = 16,
|
|
157
|
+
}, c._blocksize = 16, c._digestsize = 16, Et.exports = function(d, h) {
|
|
158
158
|
if (d == null)
|
|
159
159
|
throw new Error("Illegal argument " + d);
|
|
160
160
|
var r = o.wordsToBytes(c(d, h));
|
|
161
161
|
return h && h.asBytes ? r : h && h.asString ? n.bytesToString(r) : o.bytesToHex(r);
|
|
162
162
|
};
|
|
163
|
-
})()),
|
|
163
|
+
})()), Et.exports;
|
|
164
164
|
}
|
|
165
|
-
var ze =
|
|
165
|
+
var ze = Ue();
|
|
166
166
|
const qe = /* @__PURE__ */ We(ze);
|
|
167
167
|
var ee;
|
|
168
168
|
(function(o) {
|
|
169
169
|
o.Document = "Document", o.DocumentExit = "Document:exit", o.Paragraph = "Paragraph", o.ParagraphExit = "Paragraph:exit", o.BlockQuote = "BlockQuote", o.BlockQuoteExit = "BlockQuote:exit", o.ListItem = "ListItem", o.ListItemExit = "ListItem:exit", o.List = "List", o.ListExit = "List:exit", o.Header = "Header", o.HeaderExit = "Header:exit", o.CodeBlock = "CodeBlock", o.CodeBlockExit = "CodeBlock:exit", o.HtmlBlock = "HtmlBlock", o.HtmlBlockExit = "HtmlBlock:exit", o.HorizontalRule = "HorizontalRule", o.HorizontalRuleExit = "HorizontalRule:exit", o.Comment = "Comment", o.CommentExit = "Comment:exit", o.ReferenceDef = "ReferenceDef", o.ReferenceDefExit = "ReferenceDef:exit", o.Str = "Str", o.StrExit = "Str:exit", o.Break = "Break", o.BreakExit = "Break:exit", o.Emphasis = "Emphasis", o.EmphasisExit = "Emphasis:exit", o.Strong = "Strong", o.StrongExit = "Strong:exit", o.Html = "Html", o.HtmlExit = "Html:exit", o.Link = "Link", o.LinkExit = "Link:exit", o.Image = "Image", o.ImageExit = "Image:exit", o.Code = "Code", o.CodeExit = "Code:exit", o.Delete = "Delete", o.DeleteExit = "Delete:exit", o.Table = "Table", o.TableExit = "Table:exit", o.TableRow = "TableRow", o.TableRowExit = "TableRow:exit", o.TableCell = "TableCell", o.TableCellExit = "TableCell:exit";
|
|
170
170
|
})(ee || (ee = {}));
|
|
171
|
-
var lt = {},
|
|
171
|
+
var lt = {}, V = {}, re;
|
|
172
172
|
function Ge() {
|
|
173
|
-
if (re) return
|
|
174
|
-
re = 1, Object.defineProperty(
|
|
173
|
+
if (re) return V;
|
|
174
|
+
re = 1, Object.defineProperty(V, "__esModule", { value: !0 }), V.binarySearch = V.upperBound = V.lowerBound = V.compare = void 0;
|
|
175
175
|
function o(c, d) {
|
|
176
176
|
return c < d;
|
|
177
177
|
}
|
|
178
|
-
|
|
178
|
+
V.compare = o;
|
|
179
179
|
function t(c, d, h = o) {
|
|
180
180
|
let r = c.length, w = 0;
|
|
181
181
|
for (; r; ) {
|
|
@@ -184,7 +184,7 @@ function Ge() {
|
|
|
184
184
|
}
|
|
185
185
|
return w;
|
|
186
186
|
}
|
|
187
|
-
|
|
187
|
+
V.upperBound = t;
|
|
188
188
|
function e(c, d, h = o) {
|
|
189
189
|
let r = c.length, w = 0;
|
|
190
190
|
for (; r; ) {
|
|
@@ -193,12 +193,12 @@ function Ge() {
|
|
|
193
193
|
}
|
|
194
194
|
return w;
|
|
195
195
|
}
|
|
196
|
-
|
|
196
|
+
V.lowerBound = e;
|
|
197
197
|
function n(c, d, h = o) {
|
|
198
198
|
let r = e(c, d, h);
|
|
199
199
|
return r !== c.length && !h(d, c[r]);
|
|
200
200
|
}
|
|
201
|
-
return
|
|
201
|
+
return V.binarySearch = n, V;
|
|
202
202
|
}
|
|
203
203
|
var ne;
|
|
204
204
|
function Xe() {
|
|
@@ -1024,11 +1024,30 @@ function hr() {
|
|
|
1024
1024
|
contexts: []
|
|
1025
1025
|
};
|
|
1026
1026
|
}
|
|
1027
|
-
const
|
|
1027
|
+
const gr = Ee(
|
|
1028
|
+
"cteditor-inline-flex cteditor-items-center cteditor-rounded-md cteditor-border cteditor-px-2.5 cteditor-py-0.5 cteditor-text-xs cteditor-font-semibold cteditor-transition-colors focus:cteditor-outline-none focus:cteditor-ring-2 focus:cteditor-ring-ring focus:cteditor-ring-offset-2",
|
|
1029
|
+
{
|
|
1030
|
+
variants: {
|
|
1031
|
+
variant: {
|
|
1032
|
+
default: "cteditor-border-transparent cteditor-bg-primary cteditor-text-primary-foreground cteditor-shadow hover:cteditor-bg-primary/80",
|
|
1033
|
+
secondary: "cteditor-border-transparent cteditor-bg-secondary cteditor-text-secondary-foreground hover:cteditor-bg-secondary/80",
|
|
1034
|
+
destructive: "cteditor-border-transparent cteditor-bg-destructive cteditor-text-destructive-foreground cteditor-shadow hover:cteditor-bg-destructive/80",
|
|
1035
|
+
outline: "cteditor-text-foreground"
|
|
1036
|
+
}
|
|
1037
|
+
},
|
|
1038
|
+
defaultVariants: {
|
|
1039
|
+
variant: "default"
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
);
|
|
1043
|
+
function pr({ className: o, variant: t, ...e }) {
|
|
1044
|
+
return /* @__PURE__ */ y("div", { className: J(gr({ variant: t }), o), ...e });
|
|
1045
|
+
}
|
|
1046
|
+
const Ot = st.forwardRef(({ className: o, ...t }, e) => /* @__PURE__ */ y(
|
|
1028
1047
|
"div",
|
|
1029
1048
|
{
|
|
1030
1049
|
ref: e,
|
|
1031
|
-
className:
|
|
1050
|
+
className: J(
|
|
1032
1051
|
"cteditor-rounded-xl cteditor-border cteditor-bg-card cteditor-text-card-foreground cteditor-shadow",
|
|
1033
1052
|
o
|
|
1034
1053
|
),
|
|
@@ -1036,47 +1055,47 @@ const Ot = st.forwardRef(({ className: o, ...t }, e) => /* @__PURE__ */ v(
|
|
|
1036
1055
|
}
|
|
1037
1056
|
));
|
|
1038
1057
|
Ot.displayName = "Card";
|
|
1039
|
-
const
|
|
1058
|
+
const mr = st.forwardRef(({ className: o, ...t }, e) => /* @__PURE__ */ y(
|
|
1040
1059
|
"div",
|
|
1041
1060
|
{
|
|
1042
1061
|
ref: e,
|
|
1043
|
-
className:
|
|
1062
|
+
className: J("cteditor-flex cteditor-flex-col cteditor-space-y-1.5 cteditor-p-6", o),
|
|
1044
1063
|
...t
|
|
1045
1064
|
}
|
|
1046
1065
|
));
|
|
1047
|
-
|
|
1048
|
-
const
|
|
1066
|
+
mr.displayName = "CardHeader";
|
|
1067
|
+
const xr = st.forwardRef(({ className: o, ...t }, e) => /* @__PURE__ */ y(
|
|
1049
1068
|
"div",
|
|
1050
1069
|
{
|
|
1051
1070
|
ref: e,
|
|
1052
|
-
className:
|
|
1071
|
+
className: J("cteditor-font-semibold cteditor-leading-none cteditor-tracking-tight", o),
|
|
1053
1072
|
...t
|
|
1054
1073
|
}
|
|
1055
1074
|
));
|
|
1056
|
-
|
|
1057
|
-
const
|
|
1075
|
+
xr.displayName = "CardTitle";
|
|
1076
|
+
const wr = st.forwardRef(({ className: o, ...t }, e) => /* @__PURE__ */ y(
|
|
1058
1077
|
"div",
|
|
1059
1078
|
{
|
|
1060
1079
|
ref: e,
|
|
1061
|
-
className:
|
|
1080
|
+
className: J("cteditor-text-sm cteditor-text-muted-foreground", o),
|
|
1062
1081
|
...t
|
|
1063
1082
|
}
|
|
1064
1083
|
));
|
|
1065
|
-
|
|
1066
|
-
const Lt = st.forwardRef(({ className: o, ...t }, e) => /* @__PURE__ */
|
|
1084
|
+
wr.displayName = "CardDescription";
|
|
1085
|
+
const Lt = st.forwardRef(({ className: o, ...t }, e) => /* @__PURE__ */ y("div", { ref: e, className: J("cteditor-p-6 cteditor-pt-0", o), ...t }));
|
|
1067
1086
|
Lt.displayName = "CardContent";
|
|
1068
|
-
const
|
|
1087
|
+
const Cr = st.forwardRef(({ className: o, ...t }, e) => /* @__PURE__ */ y(
|
|
1069
1088
|
"div",
|
|
1070
1089
|
{
|
|
1071
1090
|
ref: e,
|
|
1072
|
-
className:
|
|
1091
|
+
className: J("cteditor-flex cteditor-items-center cteditor-p-6 cteditor-pt-0", o),
|
|
1073
1092
|
...t
|
|
1074
1093
|
}
|
|
1075
1094
|
));
|
|
1076
|
-
|
|
1077
|
-
const
|
|
1095
|
+
Cr.displayName = "CardFooter";
|
|
1096
|
+
const Kr = He(
|
|
1078
1097
|
"AUTOCOMPLETE_COMMAND"
|
|
1079
|
-
), le = "grammarDictionary",
|
|
1098
|
+
), le = "grammarDictionary", vr = [
|
|
1080
1099
|
"javascript",
|
|
1081
1100
|
"typescript",
|
|
1082
1101
|
"lexical",
|
|
@@ -1087,20 +1106,20 @@ const Wr = He(
|
|
|
1087
1106
|
"navigation",
|
|
1088
1107
|
"development",
|
|
1089
1108
|
"programming"
|
|
1090
|
-
],
|
|
1109
|
+
], yr = 300 * 1e3, Er = 200, br = 3e4, kr = { padding: 8 }, dt = {
|
|
1091
1110
|
width: 340,
|
|
1092
1111
|
maxHeight: 280,
|
|
1093
1112
|
padding: 16,
|
|
1094
1113
|
offsetX: 10,
|
|
1095
1114
|
offsetY: 20
|
|
1096
|
-
},
|
|
1115
|
+
}, Sr = 400, de = () => {
|
|
1097
1116
|
try {
|
|
1098
1117
|
const o = localStorage.getItem(le);
|
|
1099
1118
|
return o ? new Set(JSON.parse(o)) : /* @__PURE__ */ new Set();
|
|
1100
1119
|
} catch (o) {
|
|
1101
1120
|
return console.error("Error reading dictionary from localStorage", o), /* @__PURE__ */ new Set();
|
|
1102
1121
|
}
|
|
1103
|
-
},
|
|
1122
|
+
}, Mr = (o) => {
|
|
1104
1123
|
try {
|
|
1105
1124
|
const t = de();
|
|
1106
1125
|
return t.add(o.toLowerCase()), localStorage.setItem(
|
|
@@ -1111,14 +1130,14 @@ const Wr = He(
|
|
|
1111
1130
|
return console.error("Error saving to dictionary", t), /* @__PURE__ */ new Set();
|
|
1112
1131
|
}
|
|
1113
1132
|
}, Rt = (o) => qe(o.trim().toLowerCase());
|
|
1114
|
-
function
|
|
1133
|
+
function Nr(o) {
|
|
1115
1134
|
return dr(o).filter((e) => e.type === "Sentence").map((e, n) => ({
|
|
1116
1135
|
id: `${n}`,
|
|
1117
1136
|
text: e.raw,
|
|
1118
1137
|
index: n
|
|
1119
1138
|
})).filter((e) => e.text.trim().length > 0);
|
|
1120
1139
|
}
|
|
1121
|
-
const
|
|
1140
|
+
const Rr = (o, t, e, n, c, d, h) => {
|
|
1122
1141
|
const r = window.innerWidth, w = window.innerHeight;
|
|
1123
1142
|
let i = o + c, s = t + d;
|
|
1124
1143
|
return i + e > r - h && (i = o - e - c), i < h && (i = h), s + n > w - h && (s = t - n - d), s < h && (s = h), { left: i, top: s };
|
|
@@ -1153,16 +1172,16 @@ const Mr = (o, t, e, n, c, d, h) => {
|
|
|
1153
1172
|
}
|
|
1154
1173
|
return { fullText: t, nodeMap: e };
|
|
1155
1174
|
};
|
|
1156
|
-
class
|
|
1175
|
+
class Ir {
|
|
1157
1176
|
apiEndpoint;
|
|
1158
|
-
requestTimeout =
|
|
1177
|
+
requestTimeout = br;
|
|
1159
1178
|
sentenceCache = /* @__PURE__ */ new Map();
|
|
1160
1179
|
constructor(t = "/api/ai/process") {
|
|
1161
1180
|
this.apiEndpoint = Re + t;
|
|
1162
1181
|
}
|
|
1163
1182
|
isSentenceCached(t) {
|
|
1164
1183
|
const e = Rt(t), n = this.sentenceCache.get(e);
|
|
1165
|
-
return n && Date.now() - n.checkedAt <
|
|
1184
|
+
return n && Date.now() - n.checkedAt < yr ? n : (n && this.sentenceCache.delete(e), null);
|
|
1166
1185
|
}
|
|
1167
1186
|
cacheSentence(t, e, n) {
|
|
1168
1187
|
const c = Rt(t.text);
|
|
@@ -1214,10 +1233,10 @@ class Nr {
|
|
|
1214
1233
|
a?.results && a.results.forEach((f, M) => {
|
|
1215
1234
|
const k = r[M];
|
|
1216
1235
|
if (!k) return;
|
|
1217
|
-
const S = [], N = f.correctedSentence || k.text,
|
|
1236
|
+
const S = [], N = f.correctedSentence || k.text, Z = (H, X) => {
|
|
1218
1237
|
Array.isArray(H) && H.forEach((A, ct) => {
|
|
1219
|
-
const
|
|
1220
|
-
X === "spelling" && F <=
|
|
1238
|
+
const Q = Number(A.startOffset ?? -1), F = Number(A.endOffset ?? Q);
|
|
1239
|
+
X === "spelling" && F <= Q || A.original && S.push({
|
|
1221
1240
|
type: X,
|
|
1222
1241
|
original: A.original,
|
|
1223
1242
|
suggestions: A.suggestions || (A.suggestion ? [A.suggestion] : []),
|
|
@@ -1232,7 +1251,7 @@ class Nr {
|
|
|
1232
1251
|
});
|
|
1233
1252
|
});
|
|
1234
1253
|
};
|
|
1235
|
-
|
|
1254
|
+
Z(f.errors?.spelling, "spelling"), Z(f.errors?.grammar, "grammar");
|
|
1236
1255
|
const P = {
|
|
1237
1256
|
id: k.id,
|
|
1238
1257
|
text: k.text,
|
|
@@ -1255,7 +1274,7 @@ class Nr {
|
|
|
1255
1274
|
};
|
|
1256
1275
|
}
|
|
1257
1276
|
}
|
|
1258
|
-
function
|
|
1277
|
+
function Vr({
|
|
1259
1278
|
onQueryChange: o,
|
|
1260
1279
|
onSelectOption: t,
|
|
1261
1280
|
minMatchLength: e = 2,
|
|
@@ -1264,23 +1283,23 @@ function $r({
|
|
|
1264
1283
|
enableAI: d = !0,
|
|
1265
1284
|
debounceDelay: h = 800
|
|
1266
1285
|
}) {
|
|
1267
|
-
const [r] = Oe(), { toolbarState: w, updateToolbarState: i } =
|
|
1286
|
+
const [r] = Oe(), { toolbarState: w, updateToolbarState: i } = be(), { isHtmlView: s } = ke(), l = B([]), a = B(new Ir(c)), f = B(), M = B(""), k = B(null), S = B(null), N = B(null), Z = B(!1), P = B(null), H = B(null), X = B(() => {
|
|
1268
1287
|
}), A = B(0), ct = B(async () => {
|
|
1269
|
-
}),
|
|
1288
|
+
}), Q = B(/* @__PURE__ */ new Set()), [F, tt] = q(null), [W, et] = q([]), [ft, rt] = q(0), [At, ue] = q(
|
|
1270
1289
|
null
|
|
1271
|
-
), [xt,
|
|
1290
|
+
), [xt, U] = q([]), [Or, z] = q(/* @__PURE__ */ new Map()), [Lr, nt] = q(
|
|
1272
1291
|
/* @__PURE__ */ new Set()
|
|
1273
|
-
), [Bt, fe] = q(/* @__PURE__ */ new Set()), [
|
|
1292
|
+
), [Bt, fe] = q(/* @__PURE__ */ new Set()), [Ar, he] = q(
|
|
1274
1293
|
/* @__PURE__ */ new Set()
|
|
1275
|
-
), [wt, $] = q(null), ot =
|
|
1294
|
+
), [wt, $] = q(null), ot = Se() ?? null;
|
|
1276
1295
|
T(() => {
|
|
1277
|
-
|
|
1296
|
+
Q.current = de();
|
|
1278
1297
|
}, []);
|
|
1279
1298
|
const Pt = G(() => {
|
|
1280
|
-
const u = new Set(
|
|
1299
|
+
const u = new Set(vr);
|
|
1281
1300
|
return r.getEditorState().read(() => {
|
|
1282
|
-
const
|
|
1283
|
-
|
|
1301
|
+
const v = It().getTextContent().match(/\b[a-zA-Z][a-zA-Z0-9_]*\b/g);
|
|
1302
|
+
v && v.forEach((x) => {
|
|
1284
1303
|
x.length >= e && u.add(x);
|
|
1285
1304
|
});
|
|
1286
1305
|
}), Array.from(u);
|
|
@@ -1300,51 +1319,51 @@ function $r({
|
|
|
1300
1319
|
tt(null);
|
|
1301
1320
|
}, []), ht = G(async () => {
|
|
1302
1321
|
if (!w.isAutocompleteEnabled || !d) {
|
|
1303
|
-
|
|
1322
|
+
U([]), z(/* @__PURE__ */ new Map()), nt(/* @__PURE__ */ new Set());
|
|
1304
1323
|
return;
|
|
1305
1324
|
}
|
|
1306
1325
|
const { fullText: u, nodeMap: m } = ce(r.getEditorState());
|
|
1307
1326
|
if (!u) return;
|
|
1308
1327
|
if (l.current = m, u.trim().length < 3) {
|
|
1309
|
-
|
|
1328
|
+
U([]), z(/* @__PURE__ */ new Map()), nt(/* @__PURE__ */ new Set());
|
|
1310
1329
|
return;
|
|
1311
1330
|
}
|
|
1312
1331
|
M.current = u;
|
|
1313
|
-
const
|
|
1314
|
-
if (
|
|
1315
|
-
const x = ++A.current, p = new Set(
|
|
1316
|
-
nt(new Set(
|
|
1332
|
+
const v = Nr(u);
|
|
1333
|
+
if (v.length === 0) return;
|
|
1334
|
+
const x = ++A.current, p = new Set(v.map((g) => g.id));
|
|
1335
|
+
nt(new Set(v.map((g) => g.id))), z((g) => {
|
|
1317
1336
|
const C = /* @__PURE__ */ new Map();
|
|
1318
|
-
return g.forEach((
|
|
1319
|
-
p.has(b) && C.set(b,
|
|
1337
|
+
return g.forEach((E, b) => {
|
|
1338
|
+
p.has(b) && C.set(b, E);
|
|
1320
1339
|
}), C;
|
|
1321
1340
|
});
|
|
1322
1341
|
try {
|
|
1323
1342
|
await a.current.processInChunks(
|
|
1324
|
-
|
|
1343
|
+
v.map((g) => ({ id: g.id, text: g.text, index: g.index })),
|
|
1325
1344
|
n,
|
|
1326
1345
|
(g) => {
|
|
1327
1346
|
if (A.current !== x) return;
|
|
1328
|
-
nt((
|
|
1329
|
-
const b = new Set(
|
|
1347
|
+
nt((E) => {
|
|
1348
|
+
const b = new Set(E);
|
|
1330
1349
|
return b.delete(g.id), b;
|
|
1331
1350
|
});
|
|
1332
|
-
const C = g.errors.filter((
|
|
1333
|
-
const b = `${
|
|
1334
|
-
|
|
1351
|
+
const C = g.errors.filter((E) => {
|
|
1352
|
+
const b = `${E.sentenceId}-${E.original.toLowerCase()}`, I = Bt.has(b), K = Q.current.has(
|
|
1353
|
+
E.original.toLowerCase()
|
|
1335
1354
|
);
|
|
1336
1355
|
return !I && !K;
|
|
1337
1356
|
});
|
|
1338
|
-
z((
|
|
1339
|
-
const b = new Map(
|
|
1357
|
+
z((E) => {
|
|
1358
|
+
const b = new Map(E);
|
|
1340
1359
|
return C.length > 0 ? b.set(g.id, C) : b.delete(g.id), b;
|
|
1341
|
-
}),
|
|
1360
|
+
}), U((E) => [...E.filter(
|
|
1342
1361
|
(I) => I.sentenceId !== g.id
|
|
1343
1362
|
), ...C]);
|
|
1344
1363
|
}
|
|
1345
1364
|
);
|
|
1346
1365
|
} catch {
|
|
1347
|
-
A.current === x && (
|
|
1366
|
+
A.current === x && (U([]), z(/* @__PURE__ */ new Map()), nt(/* @__PURE__ */ new Set()));
|
|
1348
1367
|
}
|
|
1349
1368
|
}, [r, w, d, n, Bt]);
|
|
1350
1369
|
T(() => {
|
|
@@ -1352,16 +1371,16 @@ function $r({
|
|
|
1352
1371
|
});
|
|
1353
1372
|
const gt = G(
|
|
1354
1373
|
(u) => {
|
|
1355
|
-
et((m) => m.filter((
|
|
1374
|
+
et((m) => m.filter((v) => v.key !== u.key)), rt(0), Z.current = !0, r.update(() => {
|
|
1356
1375
|
const m = zt();
|
|
1357
1376
|
if (!qt(m)) return;
|
|
1358
|
-
const
|
|
1377
|
+
const v = m.anchor, x = v.getNode(), p = x.getTextContent(), g = v.offset;
|
|
1359
1378
|
let C = g;
|
|
1360
1379
|
for (; C > 0 && /[a-zA-Z0-9_']/.test(p[C - 1]); )
|
|
1361
1380
|
C--;
|
|
1362
1381
|
if (ut(x)) {
|
|
1363
|
-
const
|
|
1364
|
-
x.setTextContent(
|
|
1382
|
+
const E = p.slice(0, C) + u.displayText + p.slice(g);
|
|
1383
|
+
x.setTextContent(E);
|
|
1365
1384
|
const b = C + u.displayText.length;
|
|
1366
1385
|
m.anchor.set(x.getKey(), b, "text"), m.focus.set(x.getKey(), b, "text");
|
|
1367
1386
|
}
|
|
@@ -1370,11 +1389,11 @@ function $r({
|
|
|
1370
1389
|
[r, t, ht]
|
|
1371
1390
|
), ge = G(
|
|
1372
1391
|
(u, m) => {
|
|
1373
|
-
const
|
|
1392
|
+
const v = m.sentenceId || "";
|
|
1374
1393
|
z((x) => {
|
|
1375
|
-
const p = new Map(x), C = (p.get(
|
|
1376
|
-
return C.length > 0 ? p.set(
|
|
1377
|
-
}),
|
|
1394
|
+
const p = new Map(x), C = (p.get(v) || []).filter((E) => E !== m);
|
|
1395
|
+
return C.length > 0 ? p.set(v, C) : p.delete(v), p;
|
|
1396
|
+
}), U((x) => x.filter((p) => p !== m)), $(null), r.update(() => {
|
|
1378
1397
|
const { fullText: x, nodeMap: p } = ce(
|
|
1379
1398
|
r.getEditorState()
|
|
1380
1399
|
);
|
|
@@ -1382,20 +1401,20 @@ function $r({
|
|
|
1382
1401
|
if (g === -1 && (g = x.indexOf(m.original)), g === -1) return;
|
|
1383
1402
|
const C = x.substring(g).indexOf(m.original);
|
|
1384
1403
|
if (C === -1) return;
|
|
1385
|
-
const
|
|
1386
|
-
(O) =>
|
|
1404
|
+
const E = g + C, b = E + m.original.length, I = p.find(
|
|
1405
|
+
(O) => E >= O.start && E < O.end
|
|
1387
1406
|
), K = p.find(
|
|
1388
1407
|
(O) => b > O.start && b <= O.end
|
|
1389
1408
|
);
|
|
1390
1409
|
if (I && K) {
|
|
1391
1410
|
const O = Gt(I.key), Y = Gt(K.key);
|
|
1392
1411
|
if (ut(O) && ut(Y)) {
|
|
1393
|
-
const D = Le(), it =
|
|
1412
|
+
const D = Le(), it = E - I.start, Wt = b - K.start;
|
|
1394
1413
|
D.anchor.set(O.getKey(), it, "text"), D.focus.set(Y.getKey(), Wt, "text"), Ae(D), D.insertText(u);
|
|
1395
1414
|
}
|
|
1396
1415
|
}
|
|
1397
|
-
}),
|
|
1398
|
-
(x) => x.map((p) => p.sentenceId ===
|
|
1416
|
+
}), U(
|
|
1417
|
+
(x) => x.map((p) => p.sentenceId === v && p !== m ? {
|
|
1399
1418
|
...p,
|
|
1400
1419
|
originalSentence: p.originalSentence?.replace(
|
|
1401
1420
|
m.original,
|
|
@@ -1406,11 +1425,11 @@ function $r({
|
|
|
1406
1425
|
},
|
|
1407
1426
|
[r]
|
|
1408
1427
|
), pe = G(
|
|
1409
|
-
(u, m,
|
|
1410
|
-
he((x) => new Set(x).add(
|
|
1428
|
+
(u, m, v) => {
|
|
1429
|
+
he((x) => new Set(x).add(v)), z((x) => {
|
|
1411
1430
|
const p = new Map(x);
|
|
1412
|
-
return p.delete(
|
|
1413
|
-
}),
|
|
1431
|
+
return p.delete(v), p;
|
|
1432
|
+
}), U((x) => x.filter((p) => p.sentenceId !== v)), $(null), r.update(() => {
|
|
1414
1433
|
const x = It();
|
|
1415
1434
|
let p = !1;
|
|
1416
1435
|
const g = (C) => {
|
|
@@ -1422,8 +1441,8 @@ function $r({
|
|
|
1422
1441
|
return C.setTextContent(K), p = !0, !0;
|
|
1423
1442
|
}
|
|
1424
1443
|
}
|
|
1425
|
-
const
|
|
1426
|
-
for (const b of
|
|
1444
|
+
const E = C.getChildren ? C.getChildren() : [];
|
|
1445
|
+
for (const b of E)
|
|
1427
1446
|
if (g(b)) return !0;
|
|
1428
1447
|
return !1;
|
|
1429
1448
|
};
|
|
@@ -1432,23 +1451,23 @@ function $r({
|
|
|
1432
1451
|
},
|
|
1433
1452
|
[r]
|
|
1434
1453
|
), Tt = G((u) => {
|
|
1435
|
-
const m = `${u.sentenceId}-${u.original.toLowerCase()}`,
|
|
1454
|
+
const m = `${u.sentenceId}-${u.original.toLowerCase()}`, v = u.sentenceId || "";
|
|
1436
1455
|
fe((x) => new Set(x).add(m)), z((x) => {
|
|
1437
|
-
const p = new Map(x), C = (p.get(
|
|
1438
|
-
(
|
|
1456
|
+
const p = new Map(x), C = (p.get(v) || []).filter(
|
|
1457
|
+
(E) => E.original !== u.original
|
|
1439
1458
|
);
|
|
1440
|
-
return C.length > 0 ? p.set(
|
|
1441
|
-
}),
|
|
1459
|
+
return C.length > 0 ? p.set(v, C) : p.delete(v), p;
|
|
1460
|
+
}), U((x) => x.filter((p) => p.original !== u.original)), $(null);
|
|
1442
1461
|
}, []), Ht = G((u) => {
|
|
1443
|
-
const m =
|
|
1444
|
-
|
|
1445
|
-
const
|
|
1462
|
+
const m = Mr(u.original);
|
|
1463
|
+
Q.current = m;
|
|
1464
|
+
const v = u.sentenceId || "";
|
|
1446
1465
|
z((x) => {
|
|
1447
|
-
const p = new Map(x), C = (p.get(
|
|
1448
|
-
(
|
|
1466
|
+
const p = new Map(x), C = (p.get(v) || []).filter(
|
|
1467
|
+
(E) => E.original.toLowerCase() !== u.original.toLowerCase()
|
|
1449
1468
|
);
|
|
1450
|
-
return C.length > 0 ? p.set(
|
|
1451
|
-
}),
|
|
1469
|
+
return C.length > 0 ? p.set(v, C) : p.delete(v), p;
|
|
1470
|
+
}), U(
|
|
1452
1471
|
(x) => x.filter(
|
|
1453
1472
|
(p) => p.original.toLowerCase() !== u.original.toLowerCase()
|
|
1454
1473
|
)
|
|
@@ -1459,17 +1478,17 @@ function $r({
|
|
|
1459
1478
|
if (!qt(u)) return;
|
|
1460
1479
|
const m = window.getSelection()?.getRangeAt(0);
|
|
1461
1480
|
if (!m) return;
|
|
1462
|
-
const
|
|
1481
|
+
const v = m.getBoundingClientRect(), x = S.current;
|
|
1463
1482
|
if (!x) return;
|
|
1464
|
-
const p =
|
|
1483
|
+
const p = v.bottom + window.scrollY + kr.padding, g = v.left + window.scrollX;
|
|
1465
1484
|
x.style.top = `${p}px`, x.style.left = `${g}px`;
|
|
1466
1485
|
});
|
|
1467
1486
|
}, [r]);
|
|
1468
1487
|
T(() => {
|
|
1469
1488
|
M.current = "";
|
|
1470
1489
|
}, []), T(() => {
|
|
1471
|
-
w.isAutocompleteEnabled ? ht() : (tt(null), et([]),
|
|
1472
|
-
}, [w.isAutocompleteEnabled]), T(() => (N.current && clearTimeout(N.current), F && !
|
|
1490
|
+
w.isAutocompleteEnabled ? ht() : (tt(null), et([]), U([]), z(/* @__PURE__ */ new Map()), nt(/* @__PURE__ */ new Set()));
|
|
1491
|
+
}, [w.isAutocompleteEnabled]), T(() => (N.current && clearTimeout(N.current), F && !Z.current ? N.current = window.setTimeout(() => {
|
|
1473
1492
|
et(Dt(F)), rt(0), o?.(F);
|
|
1474
1493
|
}, h) : (et([]), rt(0), o?.(null)), () => {
|
|
1475
1494
|
N.current && clearTimeout(N.current);
|
|
@@ -1485,7 +1504,7 @@ function $r({
|
|
|
1485
1504
|
(C) => (C - 1 + W.length) % W.length
|
|
1486
1505
|
), !0),
|
|
1487
1506
|
at
|
|
1488
|
-
),
|
|
1507
|
+
), v = r.registerCommand(
|
|
1489
1508
|
De,
|
|
1490
1509
|
(g) => (g?.preventDefault(), tt(null), !0),
|
|
1491
1510
|
at
|
|
@@ -1499,7 +1518,7 @@ function $r({
|
|
|
1499
1518
|
at
|
|
1500
1519
|
);
|
|
1501
1520
|
return () => {
|
|
1502
|
-
u(), m(),
|
|
1521
|
+
u(), m(), v(), x(), p();
|
|
1503
1522
|
};
|
|
1504
1523
|
}, [r, F, W, ft, gt]), T(() => r.registerUpdateListener(({ editorState: u }) => {
|
|
1505
1524
|
u.read(() => setTimeout(_t, 0));
|
|
@@ -1526,26 +1545,26 @@ function $r({
|
|
|
1526
1545
|
document.querySelectorAll(".grammar-error-highlight").forEach((g) => g.remove());
|
|
1527
1546
|
return;
|
|
1528
1547
|
}
|
|
1529
|
-
const
|
|
1530
|
-
if (
|
|
1548
|
+
const v = m.getBoundingClientRect();
|
|
1549
|
+
if (v.width === 0 || v.height === 0) {
|
|
1531
1550
|
document.querySelectorAll(".grammar-error-highlight").forEach((g) => g.remove());
|
|
1532
1551
|
return;
|
|
1533
1552
|
}
|
|
1534
1553
|
if (document.querySelectorAll(".grammar-error-highlight").forEach((g) => g.remove()), xt.length === 0) return;
|
|
1535
1554
|
const x = l.current, p = M.current;
|
|
1536
1555
|
xt.forEach((g) => {
|
|
1537
|
-
if (
|
|
1556
|
+
if (Q.current.has(g.original.toLowerCase()))
|
|
1538
1557
|
return;
|
|
1539
1558
|
let C = p.indexOf(g.originalSentence || "");
|
|
1540
1559
|
if (C === -1 && (C = p.indexOf(g.original)), C === -1) return;
|
|
1541
|
-
const
|
|
1560
|
+
const E = p.substring(C), b = g.original.replace(
|
|
1542
1561
|
/[.*+?^${}()|[\]\\]/g,
|
|
1543
1562
|
"\\$&"
|
|
1544
1563
|
), I = new RegExp(`\\b${b}\\b`, "g");
|
|
1545
1564
|
if (!I.test(p))
|
|
1546
1565
|
return;
|
|
1547
1566
|
I.lastIndex = 0;
|
|
1548
|
-
const K = new RegExp(`\\b${b}\\b`), O =
|
|
1567
|
+
const K = new RegExp(`\\b${b}\\b`), O = E.match(K), Y = O ? O.index : -1;
|
|
1549
1568
|
if (Y === void 0 || Y === -1) return;
|
|
1550
1569
|
const D = C + Y, it = D + g.original.length;
|
|
1551
1570
|
x.filter(
|
|
@@ -1553,16 +1572,16 @@ function $r({
|
|
|
1553
1572
|
).forEach((_) => {
|
|
1554
1573
|
const we = Math.max(_.start, D), Ce = Math.min(_.end, it), $t = we - _.start, Kt = Ce - _.start;
|
|
1555
1574
|
if (Kt <= $t) return;
|
|
1556
|
-
const
|
|
1557
|
-
if (!
|
|
1558
|
-
const pt =
|
|
1575
|
+
const Vt = r.getElementByKey(_.key);
|
|
1576
|
+
if (!Vt) return;
|
|
1577
|
+
const pt = Vt.firstChild;
|
|
1559
1578
|
if (!pt || pt.nodeType !== Node.TEXT_NODE) return;
|
|
1560
1579
|
const Ct = document.createRange();
|
|
1561
1580
|
try {
|
|
1562
1581
|
Ct.setStart(pt, $t), Ct.setEnd(pt, Kt);
|
|
1563
|
-
const
|
|
1564
|
-
for (let
|
|
1565
|
-
const j =
|
|
1582
|
+
const vt = Ct.getClientRects();
|
|
1583
|
+
for (let yt = 0; yt < vt.length; yt++) {
|
|
1584
|
+
const j = vt[yt];
|
|
1566
1585
|
if (j.width === 0 || j.height === 0) continue;
|
|
1567
1586
|
const R = document.createElement("div");
|
|
1568
1587
|
R.className = "grammar-error-highlight", R.style.position = "absolute", R.style.left = `${j.left + window.scrollX}px`, R.style.top = `${j.bottom + window.scrollY - 8}px`, R.style.width = `${j.width}px`, R.style.height = "2px", R.style.paddingTop = "3px", R.style.paddingBottom = "3px", R.style.zIndex = "10", R.style.cursor = "pointer", R.style.pointerEvents = "auto", R.style.boxSizing = "content-box", g.type === "grammar" ? (R.style.backgroundColor = "rgba(59, 130, 246, 0.1)", R.style.borderBottom = "2.5px solid #3b82f6") : (R.style.backgroundColor = "rgba(239, 68, 68, 0.1)", R.style.borderBottom = "2.5px solid #ef4444"), R.onmouseenter = () => {
|
|
@@ -1592,31 +1611,31 @@ function $r({
|
|
|
1592
1611
|
};
|
|
1593
1612
|
}, [xt, r, s]), T(() => {
|
|
1594
1613
|
const u = (m) => {
|
|
1595
|
-
const
|
|
1596
|
-
k.current?.contains(
|
|
1614
|
+
const v = m.target;
|
|
1615
|
+
k.current?.contains(v) || document.querySelector(".grammar-tooltip-card")?.contains(v) || (tt(null), et([]), $(null));
|
|
1597
1616
|
};
|
|
1598
1617
|
return document.addEventListener("mousedown", u), () => document.removeEventListener("mousedown", u);
|
|
1599
1618
|
}, []);
|
|
1600
1619
|
const me = () => {
|
|
1601
1620
|
if (!wt || !wt.isVisible) return null;
|
|
1602
|
-
const { error: u, x: m, y:
|
|
1621
|
+
const { error: u, x: m, y: v } = wt, x = !!ot, p = ot?.getBoundingClientRect(), { left: g, top: C } = Rr(
|
|
1603
1622
|
m,
|
|
1604
|
-
|
|
1623
|
+
v,
|
|
1605
1624
|
dt.width,
|
|
1606
1625
|
dt.maxHeight,
|
|
1607
1626
|
dt.offsetX,
|
|
1608
1627
|
dt.offsetY,
|
|
1609
1628
|
dt.padding
|
|
1610
1629
|
);
|
|
1611
|
-
let
|
|
1612
|
-
x && p && ot ? (I = "absolute",
|
|
1613
|
-
const K = /* @__PURE__ */
|
|
1630
|
+
let E, b, I;
|
|
1631
|
+
x && p && ot ? (I = "absolute", E = g - p.left + ot.scrollLeft, b = C - p.top + ot.scrollTop) : (I = "fixed", E = g, b = C);
|
|
1632
|
+
const K = /* @__PURE__ */ y(
|
|
1614
1633
|
"div",
|
|
1615
1634
|
{
|
|
1616
1635
|
className: I === "fixed" ? "cteditor-fixed cteditor-z-[10001]" : "cteditor-absolute cteditor-z-[10001]",
|
|
1617
1636
|
style: {
|
|
1618
1637
|
top: `${b}px`,
|
|
1619
|
-
left: `${
|
|
1638
|
+
left: `${E}px`,
|
|
1620
1639
|
animation: "fadeIn 0.2s ease-out",
|
|
1621
1640
|
pointerEvents: "auto",
|
|
1622
1641
|
paddingTop: "10px"
|
|
@@ -1627,17 +1646,17 @@ function $r({
|
|
|
1627
1646
|
onMouseLeave: () => {
|
|
1628
1647
|
P.current = window.setTimeout(() => {
|
|
1629
1648
|
$(null);
|
|
1630
|
-
},
|
|
1649
|
+
}, Sr);
|
|
1631
1650
|
},
|
|
1632
|
-
children: /* @__PURE__ */
|
|
1651
|
+
children: /* @__PURE__ */ y(Ot, { className: "cteditor-w-[340px] cteditor-max-w-[calc(100vw-32px)] cteditor-shadow-2xl cteditor-border cteditor-border-foreground/15 cteditor-bg-grammar-tooltip-bg grammar-tooltip-card cteditor-overflow-hidden cteditor-relative", children: /* @__PURE__ */ L(Lt, { className: "!cteditor-p-4 sm:!cteditor-p-5 cteditor-space-y-3 cteditor-font-geist", children: [
|
|
1633
1652
|
/* @__PURE__ */ L("div", { className: "cteditor-flex cteditor-items-start cteditor-justify-between cteditor-gap-2 ", children: [
|
|
1634
1653
|
/* @__PURE__ */ L("div", { className: "cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-min-w-0 cteditor-flex-1", children: [
|
|
1635
|
-
/* @__PURE__ */
|
|
1654
|
+
/* @__PURE__ */ y(
|
|
1636
1655
|
"div",
|
|
1637
1656
|
{
|
|
1638
1657
|
className: `cteditor-w-6 cteditor-h-6 cteditor-rounded-full cteditor-flex cteditor-items-center cteditor-justify-center cteditor-flex-shrink-0 ${u.type === "spelling" ? "cteditor-bg-red-100 dark:cteditor-bg-red-900/30" : "cteditor-bg-blue-100 dark:cteditor-bg-blue-900/30"}`,
|
|
1639
|
-
children: /* @__PURE__ */
|
|
1640
|
-
|
|
1658
|
+
children: /* @__PURE__ */ y(
|
|
1659
|
+
Me,
|
|
1641
1660
|
{
|
|
1642
1661
|
className: `cteditor-w-4 cteditor-h-4 ${u.type === "spelling" ? "cteditor-text-red-600 dark:cteditor-text-red-400" : "cteditor-text-blue-600 dark:cteditor-text-blue-400"}`
|
|
1643
1662
|
}
|
|
@@ -1645,31 +1664,31 @@ function $r({
|
|
|
1645
1664
|
}
|
|
1646
1665
|
),
|
|
1647
1666
|
/* @__PURE__ */ L("div", { className: "cteditor-min-w-0 cteditor-flex-1", children: [
|
|
1648
|
-
/* @__PURE__ */
|
|
1649
|
-
|
|
1667
|
+
/* @__PURE__ */ y(
|
|
1668
|
+
pr,
|
|
1650
1669
|
{
|
|
1651
1670
|
variant: u.type === "spelling" ? "destructive" : "default",
|
|
1652
1671
|
className: "cteditor-text-xs cteditor-font-bold",
|
|
1653
1672
|
children: u.type === "spelling" ? "Spelling" : "Grammar"
|
|
1654
1673
|
}
|
|
1655
1674
|
),
|
|
1656
|
-
u.issue && /* @__PURE__ */
|
|
1675
|
+
u.issue && /* @__PURE__ */ y("p", { className: "cteditor-text-xs cteditor-text-foreground/50 cteditor-mt-1 cteditor-break-words", children: u.issue })
|
|
1657
1676
|
] })
|
|
1658
1677
|
] }),
|
|
1659
|
-
/* @__PURE__ */
|
|
1678
|
+
/* @__PURE__ */ y(
|
|
1660
1679
|
"button",
|
|
1661
1680
|
{
|
|
1662
1681
|
type: "button",
|
|
1663
1682
|
onClick: () => $(null),
|
|
1664
1683
|
className: "cteditor-text-gray-400 hover:cteditor-text-gray-600 cteditor-flex-shrink-0 cteditor-p-1 cteditor-absolute cteditor-top-1 cteditor-right-1",
|
|
1665
|
-
children: /* @__PURE__ */
|
|
1684
|
+
children: /* @__PURE__ */ y(Ne, { className: "cteditor-w-4 cteditor-h-4" })
|
|
1666
1685
|
}
|
|
1667
1686
|
)
|
|
1668
1687
|
] }),
|
|
1669
|
-
/* @__PURE__ */
|
|
1688
|
+
/* @__PURE__ */ y("div", { className: "cteditor-p-3 cteditor-bg-incorrect-word-bg cteditor-rounded-lg cteditor-border cteditor-border-incorrect-word-border cteditor-overflow-hidden", children: /* @__PURE__ */ y("p", { className: "cteditor-text-sm cteditor-line-through cteditor-text-incorrect-word-text cteditor-font-semibold cteditor-break-all", children: u.original }) }),
|
|
1670
1689
|
u.suggestions.length > 0 ? /* @__PURE__ */ L("div", { className: "cteditor-space-y-3", children: [
|
|
1671
|
-
/* @__PURE__ */
|
|
1672
|
-
/* @__PURE__ */
|
|
1690
|
+
/* @__PURE__ */ y("p", { className: "cteditor-text-xs cteditor-font-bold cteditor-text-main-foreground cteditor-uppercase cteditor-tracking-wider", children: "Suggestions:" }),
|
|
1691
|
+
/* @__PURE__ */ y("div", { className: "cteditor-space-y-2 cteditor-max-h-[120px] cteditor-overflow-y-auto cteditor-pr-1", children: u.suggestions.map((O, Y) => /* @__PURE__ */ L(
|
|
1673
1692
|
"button",
|
|
1674
1693
|
{
|
|
1675
1694
|
type: "button",
|
|
@@ -1678,13 +1697,13 @@ function $r({
|
|
|
1678
1697
|
},
|
|
1679
1698
|
className: "cteditor-w-full cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-px-3 cteditor-py-2 cteditor-bg-suggestion-bg cteditor-border cteditor-border-suggestion-border cteditor-rounded-lg cteditor-transition-all",
|
|
1680
1699
|
children: [
|
|
1681
|
-
/* @__PURE__ */
|
|
1682
|
-
/* @__PURE__ */
|
|
1700
|
+
/* @__PURE__ */ y(Ut, { className: "cteditor-w-4 cteditor-h-4 cteditor-flex-shrink-0 cteditor-text-suggestion-text " }),
|
|
1701
|
+
/* @__PURE__ */ y("span", { className: "cteditor-text-sm cteditor-font-semibold cteditor-text-suggestion-text cteditor-break-all cteditor-text-left", children: O })
|
|
1683
1702
|
]
|
|
1684
1703
|
},
|
|
1685
1704
|
Y
|
|
1686
1705
|
)) }),
|
|
1687
|
-
u.type === "grammar" && u.correctedSentence && /* @__PURE__ */
|
|
1706
|
+
u.type === "grammar" && u.correctedSentence && /* @__PURE__ */ y(
|
|
1688
1707
|
"button",
|
|
1689
1708
|
{
|
|
1690
1709
|
type: "button",
|
|
@@ -1697,16 +1716,16 @@ function $r({
|
|
|
1697
1716
|
},
|
|
1698
1717
|
className: "cteditor-w-full cteditor-px-3 cteditor-py-2 cteditor-bg-explanation-bg cteditor-border-2 cteditor-border-explanation-border cteditor-rounded-lg cteditor-text-left",
|
|
1699
1718
|
children: /* @__PURE__ */ L("div", { className: "cteditor-flex cteditor-items-start cteditor-gap-2", children: [
|
|
1700
|
-
/* @__PURE__ */
|
|
1719
|
+
/* @__PURE__ */ y(Ut, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-blue-600 cteditor-mt-0.5 cteditor-flex-shrink-0" }),
|
|
1701
1720
|
/* @__PURE__ */ L("div", { className: "cteditor-min-w-0 cteditor-flex-1", children: [
|
|
1702
|
-
/* @__PURE__ */
|
|
1703
|
-
/* @__PURE__ */
|
|
1721
|
+
/* @__PURE__ */ y("p", { className: "cteditor-text-xs cteditor-font-semibold cteditor-text-blue-700", children: "Fix entire sentence" }),
|
|
1722
|
+
/* @__PURE__ */ y("p", { className: "cteditor-text-xs cteditor-text-blue-600 cteditor-break-words cteditor-line-clamp-2", children: u.correctedSentence })
|
|
1704
1723
|
] })
|
|
1705
1724
|
] })
|
|
1706
1725
|
}
|
|
1707
1726
|
),
|
|
1708
1727
|
/* @__PURE__ */ L("div", { className: "cteditor-flex cteditor-flex-col cteditor-gap-3 cteditor-mt-3 cteditor-pt-3 ", children: [
|
|
1709
|
-
/* @__PURE__ */
|
|
1728
|
+
/* @__PURE__ */ y(
|
|
1710
1729
|
"button",
|
|
1711
1730
|
{
|
|
1712
1731
|
type: "button",
|
|
@@ -1725,12 +1744,12 @@ function $r({
|
|
|
1725
1744
|
className: "cteditor-flex cteditor-items-center cteditor-justify-center cteditor-gap-1.5 cteditor-text-xs cteditor-transition-colors cteditor-font-medium hover:cteditor-opacity-90",
|
|
1726
1745
|
title: "Add word to your personal dictionary ",
|
|
1727
1746
|
children: [
|
|
1728
|
-
/* @__PURE__ */
|
|
1747
|
+
/* @__PURE__ */ y(Yt, { className: "cteditor-w-3.5 cteditor-h-3.5" }),
|
|
1729
1748
|
"Add to Dictionary"
|
|
1730
1749
|
]
|
|
1731
1750
|
}
|
|
1732
1751
|
),
|
|
1733
|
-
/* @__PURE__ */
|
|
1752
|
+
/* @__PURE__ */ y(
|
|
1734
1753
|
"button",
|
|
1735
1754
|
{
|
|
1736
1755
|
type: "button",
|
|
@@ -1747,7 +1766,7 @@ function $r({
|
|
|
1747
1766
|
] }) : (
|
|
1748
1767
|
/* No suggestions - action buttons only */
|
|
1749
1768
|
/* @__PURE__ */ L("div", { className: "cteditor-flex cteditor-flex-col cteditor-gap-3 cteditor-mt-3 cteditor-pt-3 ", children: [
|
|
1750
|
-
/* @__PURE__ */
|
|
1769
|
+
/* @__PURE__ */ y(
|
|
1751
1770
|
"button",
|
|
1752
1771
|
{
|
|
1753
1772
|
type: "button",
|
|
@@ -1766,12 +1785,12 @@ function $r({
|
|
|
1766
1785
|
className: "cteditor-flex cteditor-items-center cteditor-justify-center cteditor-gap-1.5 cteditor-text-xs cteditor-rounded-md cteditor-transition-colors cteditor-font-medium hover:cteditor-opacity-90 ",
|
|
1767
1786
|
title: "Add word to your personal dictionary",
|
|
1768
1787
|
children: [
|
|
1769
|
-
/* @__PURE__ */
|
|
1788
|
+
/* @__PURE__ */ y(Yt, { className: "cteditor-w-3.5 cteditor-h-3.5" }),
|
|
1770
1789
|
"Add to Dictionary"
|
|
1771
1790
|
]
|
|
1772
1791
|
}
|
|
1773
1792
|
),
|
|
1774
|
-
/* @__PURE__ */
|
|
1793
|
+
/* @__PURE__ */ y(
|
|
1775
1794
|
"button",
|
|
1776
1795
|
{
|
|
1777
1796
|
type: "button",
|
|
@@ -1791,24 +1810,24 @@ function $r({
|
|
|
1791
1810
|
);
|
|
1792
1811
|
return Xt(K, ot || document.body);
|
|
1793
1812
|
}, xe = () => !At || !F || W.length === 0 ? null : Xt(
|
|
1794
|
-
/* @__PURE__ */
|
|
1813
|
+
/* @__PURE__ */ y(
|
|
1795
1814
|
Ot,
|
|
1796
1815
|
{
|
|
1797
1816
|
ref: k,
|
|
1798
1817
|
className: "cteditor-w-80 cteditor-max-h-64 cteditor-overflow-hidden cteditor-shadow-xl cteditor-border-2 cteditor-bg-white dark:cteditor-bg-gray-900 autocomplete-menu",
|
|
1799
|
-
children: /* @__PURE__ */
|
|
1818
|
+
children: /* @__PURE__ */ y(Lt, { className: "!cteditor-p-2", children: /* @__PURE__ */ y("div", { className: "cteditor-max-h-56 cteditor-overflow-y-auto cteditor-space-y-1", children: W.map((u, m) => /* @__PURE__ */ L(
|
|
1800
1819
|
"button",
|
|
1801
1820
|
{
|
|
1802
1821
|
type: "button",
|
|
1803
|
-
className:
|
|
1822
|
+
className: J(
|
|
1804
1823
|
"cteditor-w-full cteditor-flex cteditor-items-center cteditor-gap-3 cteditor-px-3 cteditor-py-2.5 cteditor-rounded-md cteditor-text-left",
|
|
1805
1824
|
m === ft ? "cteditor-bg-blue-100" : "hover:cteditor-bg-gray-100"
|
|
1806
1825
|
),
|
|
1807
1826
|
onClick: () => gt(u),
|
|
1808
1827
|
onMouseEnter: () => rt(m),
|
|
1809
1828
|
children: [
|
|
1810
|
-
/* @__PURE__ */
|
|
1811
|
-
/* @__PURE__ */
|
|
1829
|
+
/* @__PURE__ */ y($e, { className: "cteditor-w-4 cteditor-h-4" }),
|
|
1830
|
+
/* @__PURE__ */ y("span", { className: "cteditor-text-sm cteditor-font-medium", children: u.displayText })
|
|
1812
1831
|
]
|
|
1813
1832
|
},
|
|
1814
1833
|
u.key
|
|
@@ -1817,13 +1836,13 @@ function $r({
|
|
|
1817
1836
|
),
|
|
1818
1837
|
At
|
|
1819
1838
|
);
|
|
1820
|
-
return /* @__PURE__ */ L(
|
|
1839
|
+
return /* @__PURE__ */ L(ve, { children: [
|
|
1821
1840
|
me(),
|
|
1822
1841
|
xe()
|
|
1823
1842
|
] });
|
|
1824
1843
|
}
|
|
1825
1844
|
export {
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1845
|
+
Kr as AUTOCOMPLETE_COMMAND,
|
|
1846
|
+
Vr as default,
|
|
1847
|
+
Nr as splitIntoSentences
|
|
1829
1848
|
};
|