@naersen/tts-rich-text 0.5.0 → 0.6.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 +19 -4
- package/dist/base.css +1 -1
- package/dist/components/tts-editor-root/index.vue.d.ts +3 -3
- package/dist/components/tts-rich-text/constants/index.d.ts +15 -0
- package/dist/components/tts-rich-text/editor/index.d.ts +0 -2
- package/dist/components/tts-rich-text/editor/useEditorToolbar.d.ts +3 -3
- package/dist/components/tts-rich-text/editor/useRichTextEditor.d.ts +2 -1
- package/dist/components/tts-rich-text-editor/index.vue.d.ts +12 -12
- package/dist/core/config.d.ts +17 -1
- package/dist/core.js +139 -92
- package/dist/index.js +2132 -2648
- package/dist/theme-default.css +1 -1
- package/package.json +1 -1
- package/dist/components/tts-rich-text/editor/config.d.ts +0 -93
- package/dist/components/tts-rich-text/editor/utils/index.d.ts +0 -3
- package/dist/components/tts-rich-text/editor/utils/number-to-text.d.ts +0 -31
- package/dist/components/tts-rich-text/editor/utils/sanitize-pasted-text.d.ts +0 -2
- package/dist/components/tts-rich-text/editor/utils/split-sentence.d.ts +0 -7
- package/dist/components/tts-rich-text/editor/utils/transform-data.d.ts +0 -24
package/dist/core.js
CHANGED
|
@@ -4,49 +4,65 @@ const f = {
|
|
|
4
4
|
}, h = {
|
|
5
5
|
stop: {
|
|
6
6
|
label: "停顿",
|
|
7
|
+
icon: "editor-stop",
|
|
7
8
|
type: "stop",
|
|
8
9
|
deleteMode: f.DELETE_NODE
|
|
9
10
|
},
|
|
10
11
|
customStop: {
|
|
11
12
|
label: "长停顿",
|
|
13
|
+
icon: "editor-stop-long",
|
|
12
14
|
type: "customStop",
|
|
13
15
|
deleteMode: f.DELETE_NODE
|
|
14
16
|
},
|
|
15
17
|
continue: {
|
|
16
18
|
label: "连续",
|
|
19
|
+
icon: "editor-continue",
|
|
17
20
|
type: "continue",
|
|
18
21
|
deleteMode: f.CONVERT_TO_TEXT
|
|
19
22
|
},
|
|
20
23
|
pinyin: {
|
|
21
24
|
label: "拼音标注",
|
|
25
|
+
icon: "editor-pinyin",
|
|
22
26
|
type: "pinyin",
|
|
23
27
|
deleteMode: f.CONVERT_TO_TEXT
|
|
24
28
|
},
|
|
25
29
|
replace: {
|
|
26
30
|
label: "替换",
|
|
31
|
+
icon: "editor-replace",
|
|
27
32
|
type: "replace",
|
|
28
33
|
deleteMode: f.CONVERT_TO_TEXT
|
|
29
34
|
},
|
|
30
35
|
language: {
|
|
31
36
|
label: "语种标记",
|
|
37
|
+
icon: "editor-language",
|
|
32
38
|
type: "language",
|
|
33
39
|
deleteMode: f.CONVERT_TO_TEXT
|
|
34
40
|
},
|
|
35
41
|
number: {
|
|
36
42
|
label: "数字读法",
|
|
43
|
+
icon: "editor-number",
|
|
37
44
|
type: "number"
|
|
38
45
|
},
|
|
39
46
|
formula: {
|
|
40
47
|
label: "读公式",
|
|
48
|
+
icon: "editor-formula",
|
|
41
49
|
type: "formula"
|
|
42
50
|
},
|
|
43
51
|
aiRewrite: {
|
|
44
52
|
label: "AI 改写",
|
|
53
|
+
icon: "editor-ai-rewrite",
|
|
45
54
|
type: "aiRewrite"
|
|
46
55
|
},
|
|
47
56
|
upload: {
|
|
48
57
|
label: "上传文稿",
|
|
58
|
+
icon: "editor-upload",
|
|
49
59
|
type: "upload"
|
|
60
|
+
},
|
|
61
|
+
ignore: {
|
|
62
|
+
label: "忽略读音",
|
|
63
|
+
icon: "editor-ingore",
|
|
64
|
+
type: "ignore",
|
|
65
|
+
deleteMode: f.DELETE_NODE
|
|
50
66
|
}
|
|
51
67
|
}, _ = [
|
|
52
68
|
{ value: "zh", label: "中文" },
|
|
@@ -59,7 +75,7 @@ const f = {
|
|
|
59
75
|
{ value: "it", label: "意大利语" },
|
|
60
76
|
{ value: "pt", label: "葡萄牙语" },
|
|
61
77
|
{ value: "ru", label: "俄语" }
|
|
62
|
-
],
|
|
78
|
+
], ie = [
|
|
63
79
|
{ label: "停顿 0.5 秒", value: 0.5 },
|
|
64
80
|
{ label: "停顿 1 秒", value: 1 }
|
|
65
81
|
], S = Object.keys(h), d = {
|
|
@@ -85,7 +101,7 @@ const f = {
|
|
|
85
101
|
)
|
|
86
102
|
},
|
|
87
103
|
2: d
|
|
88
|
-
},
|
|
104
|
+
}, le = (e, o = {}) => {
|
|
89
105
|
const t = C[e] ?? d;
|
|
90
106
|
return {
|
|
91
107
|
...d,
|
|
@@ -94,7 +110,7 @@ const f = {
|
|
|
94
110
|
tools: o.tools ?? t.tools ?? d.tools,
|
|
95
111
|
languages: o.languages ?? t.languages ?? d.languages
|
|
96
112
|
};
|
|
97
|
-
},
|
|
113
|
+
}, ae = () => ({
|
|
98
114
|
type: "doc",
|
|
99
115
|
content: [
|
|
100
116
|
{
|
|
@@ -102,7 +118,7 @@ const f = {
|
|
|
102
118
|
content: []
|
|
103
119
|
}
|
|
104
120
|
]
|
|
105
|
-
}),
|
|
121
|
+
}), y = {
|
|
106
122
|
0: "零",
|
|
107
123
|
1: "一",
|
|
108
124
|
2: "二",
|
|
@@ -126,7 +142,7 @@ const f = {
|
|
|
126
142
|
9: "九"
|
|
127
143
|
}, A = ["", "十", "百", "千"], D = ["", "万", "亿", "万亿"];
|
|
128
144
|
function w(e) {
|
|
129
|
-
return e ? e.split("").map((o) =>
|
|
145
|
+
return e ? e.split("").map((o) => y[o] || o).join("") : "";
|
|
130
146
|
}
|
|
131
147
|
function ce(e) {
|
|
132
148
|
return e ? e.split("").map((o) => v[o] || o).join("") : "";
|
|
@@ -135,36 +151,36 @@ function V(e) {
|
|
|
135
151
|
const o = e.length;
|
|
136
152
|
let t = "", n = !1;
|
|
137
153
|
for (let s = 0; s < o; s++) {
|
|
138
|
-
const
|
|
139
|
-
|
|
154
|
+
const a = e[s], r = o - 1 - s;
|
|
155
|
+
a === "0" ? !n && t !== "" && (n = !0) : (n && (t += "零", n = !1), t += y[a] + A[r]);
|
|
140
156
|
}
|
|
141
157
|
return t.startsWith("一十") && t.length === 2 && (t = t.substring(1)), t;
|
|
142
158
|
}
|
|
143
|
-
function
|
|
159
|
+
function I(e) {
|
|
144
160
|
if (!e) return "";
|
|
145
161
|
if (e === "0" || (e = e.replace(/^0+/, "") || "0", e === "0")) return "零";
|
|
146
162
|
let o = "";
|
|
147
163
|
const t = e.length, n = [];
|
|
148
164
|
for (let s = t; s > 0; s -= 4) {
|
|
149
|
-
const
|
|
150
|
-
n.unshift(e.substring(
|
|
165
|
+
const a = Math.max(0, s - 4);
|
|
166
|
+
n.unshift(e.substring(a, s));
|
|
151
167
|
}
|
|
152
168
|
for (let s = 0; s < n.length; s++) {
|
|
153
|
-
const
|
|
169
|
+
const a = n[s], r = V(a);
|
|
154
170
|
if (r !== "") {
|
|
155
|
-
const
|
|
156
|
-
o += r + D[
|
|
171
|
+
const i = n.length - 1 - s;
|
|
172
|
+
o += r + D[i];
|
|
157
173
|
}
|
|
158
174
|
}
|
|
159
175
|
return o;
|
|
160
176
|
}
|
|
161
177
|
function $(e) {
|
|
162
|
-
return
|
|
178
|
+
return I(e);
|
|
163
179
|
}
|
|
164
180
|
const ue = [
|
|
165
181
|
{ label: "基数读法", func: w },
|
|
166
182
|
// { label: '位数读法', func: toPhoneReading },
|
|
167
|
-
{ label: "位数读法", func:
|
|
183
|
+
{ label: "位数读法", func: I },
|
|
168
184
|
{ label: "口语读法", func: $ }
|
|
169
185
|
], B = /[\u0000-\u0008\u000B-\u001F\u007F-\u009F\u00AD\u200B-\u200F\u202A-\u202E\u2060-\u206F\uFE00-\uFE0F\uFEFF\uFFFD\uE000-\uF8FF]/g, j = /[\t\f\v\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g, L = {
|
|
170
186
|
"‘": "'",
|
|
@@ -218,10 +234,10 @@ const ue = [
|
|
|
218
234
|
minSegmentLength: 32,
|
|
219
235
|
maxSegmentLength: 128,
|
|
220
236
|
rebalanceRatio: 0.4
|
|
221
|
-
},
|
|
237
|
+
}, F = /[一-鿿㐀-䶿豈- -〿-]/, X = /[。!?!?\.]/, G = /[;;]/, W = /[,,、::]/, K = /[。!?!?,,、;;::\.]/, O = "", R = "", p = (e) => {
|
|
222
238
|
let o = 0;
|
|
223
239
|
for (const t of e)
|
|
224
|
-
o +=
|
|
240
|
+
o += F.test(t) ? 2 : 1;
|
|
225
241
|
return o;
|
|
226
242
|
}, Y = (e) => e.replace(/\r/g, "").split(`
|
|
227
243
|
`).map((o) => o.trim()).filter(Boolean).join(" ").replace(/\s+/g, " ").trim(), q = (e) => {
|
|
@@ -234,28 +250,28 @@ const ue = [
|
|
|
234
250
|
}, b = (e) => e.split(O).join(",").split(R).join("."), E = (e, o) => {
|
|
235
251
|
let t = 0;
|
|
236
252
|
for (let n = 0; n < e.length; n += 1)
|
|
237
|
-
if (t +=
|
|
253
|
+
if (t += F.test(e[n]) ? 2 : 1, t >= o)
|
|
238
254
|
return n + 1;
|
|
239
255
|
return e.length;
|
|
240
256
|
}, x = (e, o, t, n, s) => {
|
|
241
|
-
let
|
|
242
|
-
const
|
|
243
|
-
for (let
|
|
244
|
-
if (!s.test(e[
|
|
257
|
+
let a = -1, r = Number.POSITIVE_INFINITY;
|
|
258
|
+
const i = Math.max(1, t), c = Math.min(e.length, n);
|
|
259
|
+
for (let l = i; l <= c; l += 1) {
|
|
260
|
+
if (!s.test(e[l - 1]))
|
|
245
261
|
continue;
|
|
246
|
-
const u = Math.abs(
|
|
247
|
-
if (u < r && (r = u,
|
|
262
|
+
const u = Math.abs(l - o);
|
|
263
|
+
if (u < r && (r = u, a = l), l > o && a >= 0)
|
|
248
264
|
break;
|
|
249
265
|
}
|
|
250
|
-
return
|
|
266
|
+
return a;
|
|
251
267
|
}, P = (e, o, t, n) => {
|
|
252
|
-
let s = -1,
|
|
253
|
-
const r = Math.max(1, t),
|
|
254
|
-
for (let c = r; c <=
|
|
268
|
+
let s = -1, a = Number.POSITIVE_INFINITY;
|
|
269
|
+
const r = Math.max(1, t), i = Math.min(e.length, n);
|
|
270
|
+
for (let c = r; c <= i; c += 1) {
|
|
255
271
|
if (e[c - 1] !== " ")
|
|
256
272
|
continue;
|
|
257
|
-
const
|
|
258
|
-
if (
|
|
273
|
+
const l = Math.abs(c - o);
|
|
274
|
+
if (l < a && (a = l, s = c), c > o && s >= 0)
|
|
259
275
|
break;
|
|
260
276
|
}
|
|
261
277
|
return s;
|
|
@@ -263,52 +279,52 @@ const ue = [
|
|
|
263
279
|
const t = [];
|
|
264
280
|
let n = e.trim();
|
|
265
281
|
for (; n && p(n) > o; ) {
|
|
266
|
-
const s = p(n),
|
|
282
|
+
const s = p(n), a = Math.min(
|
|
267
283
|
Math.floor(s / 2),
|
|
268
284
|
o
|
|
269
|
-
), r = E(n,
|
|
285
|
+
), r = E(n, a), i = Math.max(1, Math.floor(r / 3)), c = Math.max(
|
|
270
286
|
r + 1,
|
|
271
287
|
E(n, o)
|
|
272
288
|
);
|
|
273
|
-
let
|
|
289
|
+
let l = x(
|
|
274
290
|
n,
|
|
275
291
|
r,
|
|
276
|
-
|
|
292
|
+
i,
|
|
277
293
|
c,
|
|
278
294
|
G
|
|
279
295
|
);
|
|
280
|
-
|
|
296
|
+
l < 0 && (l = x(
|
|
281
297
|
n,
|
|
282
298
|
r,
|
|
283
|
-
|
|
299
|
+
i,
|
|
284
300
|
c,
|
|
285
301
|
W
|
|
286
|
-
)),
|
|
302
|
+
)), l < 0 && (l = P(
|
|
287
303
|
n,
|
|
288
304
|
r,
|
|
289
|
-
|
|
305
|
+
i,
|
|
290
306
|
c
|
|
291
|
-
)), (
|
|
307
|
+
)), (l < 0 || l >= n.length) && (l = r), t.push(n.slice(0, l).trim()), n = n.slice(l).trim();
|
|
292
308
|
}
|
|
293
309
|
return n && t.push(n), t;
|
|
294
310
|
}, Z = (e, o) => {
|
|
295
311
|
if (e.length <= 1)
|
|
296
312
|
return e;
|
|
297
|
-
const t = e[e.length - 1], n = e.reduce((
|
|
313
|
+
const t = e[e.length - 1], n = e.reduce((m, T) => m + p(T), 0) / e.length, s = Math.floor(n * o);
|
|
298
314
|
if (p(t) >= s)
|
|
299
315
|
return e;
|
|
300
|
-
const r = `${e[e.length - 2]}${t}`,
|
|
316
|
+
const r = `${e[e.length - 2]}${t}`, i = Math.floor(p(r) / 2), c = E(r, i), l = Math.max(1, Math.floor(c / 3));
|
|
301
317
|
let u = x(
|
|
302
318
|
r,
|
|
303
319
|
c,
|
|
304
|
-
|
|
320
|
+
l,
|
|
305
321
|
r.length,
|
|
306
322
|
K
|
|
307
323
|
);
|
|
308
324
|
if (u < 0 && (u = P(
|
|
309
325
|
r,
|
|
310
326
|
c,
|
|
311
|
-
|
|
327
|
+
l,
|
|
312
328
|
r.length
|
|
313
329
|
)), u <= 0 || u >= r.length)
|
|
314
330
|
return e;
|
|
@@ -324,17 +340,17 @@ const ue = [
|
|
|
324
340
|
const s = q(n);
|
|
325
341
|
if (p(s) <= t.minSegmentLength)
|
|
326
342
|
return [b(s)];
|
|
327
|
-
const
|
|
328
|
-
let
|
|
329
|
-
for (const
|
|
330
|
-
if (!
|
|
343
|
+
const a = [], r = s.split(new RegExp("(?<=[。!?!?\\.])"));
|
|
344
|
+
let i = "";
|
|
345
|
+
for (const l of r) {
|
|
346
|
+
if (!l)
|
|
331
347
|
continue;
|
|
332
|
-
|
|
333
|
-
const u =
|
|
334
|
-
p(
|
|
348
|
+
i += l;
|
|
349
|
+
const u = i[i.length - 1] ?? "";
|
|
350
|
+
p(i) >= t.minSegmentLength && X.test(u) && (a.push(i.trim()), i = "");
|
|
335
351
|
}
|
|
336
|
-
|
|
337
|
-
const c =
|
|
352
|
+
i && (a.length > 0 && p(i) < t.minSegmentLength ? a[a.length - 1] += i : a.push(i.trim()));
|
|
353
|
+
const c = a.flatMap((l) => p(l) <= t.maxSegmentLength ? [l] : J(l, t.maxSegmentLength));
|
|
338
354
|
return Z(
|
|
339
355
|
c,
|
|
340
356
|
t.rebalanceRatio
|
|
@@ -342,84 +358,108 @@ const ue = [
|
|
|
342
358
|
}, M = (e) => e.type === "text" ? e.text || "" : (e.content || []).map(M).join(""), ee = (e) => {
|
|
343
359
|
const o = e.content || [];
|
|
344
360
|
let t = "";
|
|
345
|
-
const n = [], s = [],
|
|
346
|
-
[h.stop.type]: ({ position: r, actionCode:
|
|
361
|
+
const n = [], s = [], a = {
|
|
362
|
+
[h.stop.type]: ({ position: r, actionCode: i }) => {
|
|
347
363
|
n.push({
|
|
348
364
|
action: "insert",
|
|
349
365
|
model: "control",
|
|
350
366
|
payload: "。 ",
|
|
351
367
|
position: r,
|
|
352
368
|
text: "",
|
|
353
|
-
actionCode:
|
|
369
|
+
actionCode: i
|
|
354
370
|
});
|
|
355
371
|
},
|
|
356
|
-
[h.customStop.type]: ({ payload: r, position:
|
|
372
|
+
[h.customStop.type]: ({ payload: r, position: i, actionCode: c }) => {
|
|
357
373
|
n.push({
|
|
358
374
|
action: "insert",
|
|
359
375
|
model: "control",
|
|
360
376
|
payload: `[stop:${r == null ? void 0 : r.time}]`,
|
|
361
|
-
position:
|
|
377
|
+
position: i,
|
|
362
378
|
text: "",
|
|
363
379
|
actionCode: c
|
|
364
380
|
});
|
|
365
381
|
},
|
|
366
|
-
[h.continue.type]: ({ position: r, text:
|
|
382
|
+
[h.continue.type]: ({ position: r, text: i, actionCode: c }) => {
|
|
367
383
|
n.push({
|
|
368
384
|
action: "replace",
|
|
369
385
|
model: "replace",
|
|
370
|
-
payload: `《${
|
|
386
|
+
payload: `《${i}》`,
|
|
371
387
|
position: r,
|
|
372
|
-
text:
|
|
388
|
+
text: i,
|
|
373
389
|
actionCode: c
|
|
374
390
|
});
|
|
375
391
|
},
|
|
376
|
-
[h.replace.type]: ({
|
|
392
|
+
[h.replace.type]: ({
|
|
393
|
+
payload: r,
|
|
394
|
+
position: i,
|
|
395
|
+
text: c,
|
|
396
|
+
actionCode: l
|
|
397
|
+
}) => {
|
|
377
398
|
n.push({
|
|
378
399
|
action: "replace",
|
|
379
400
|
model: "replace",
|
|
380
401
|
payload: `${r == null ? void 0 : r.text}`,
|
|
381
|
-
position:
|
|
402
|
+
position: i,
|
|
382
403
|
text: c,
|
|
383
|
-
actionCode:
|
|
404
|
+
actionCode: l
|
|
384
405
|
});
|
|
385
406
|
},
|
|
386
|
-
[h.pinyin.type]: ({ payload: r, position:
|
|
407
|
+
[h.pinyin.type]: ({ payload: r, position: i, text: c, actionCode: l }) => {
|
|
387
408
|
n.push({
|
|
388
409
|
action: "replace",
|
|
389
410
|
model: "pinyin",
|
|
390
411
|
payload: `${r == null ? void 0 : r.text}`,
|
|
391
|
-
position:
|
|
412
|
+
position: i,
|
|
392
413
|
text: c,
|
|
393
|
-
actionCode:
|
|
414
|
+
actionCode: l
|
|
394
415
|
});
|
|
395
416
|
},
|
|
396
|
-
[h.language.type]: ({
|
|
417
|
+
[h.language.type]: ({
|
|
418
|
+
payload: r,
|
|
419
|
+
position: i,
|
|
420
|
+
text: c,
|
|
421
|
+
actionCode: l
|
|
422
|
+
}) => {
|
|
397
423
|
n.push({
|
|
398
424
|
action: "language",
|
|
399
425
|
model: "language",
|
|
400
426
|
payload: `${r == null ? void 0 : r.code}`,
|
|
401
|
-
position:
|
|
427
|
+
position: i,
|
|
402
428
|
text: c,
|
|
403
|
-
actionCode:
|
|
429
|
+
actionCode: l
|
|
430
|
+
});
|
|
431
|
+
},
|
|
432
|
+
[h.ignore.type]: ({
|
|
433
|
+
position: r,
|
|
434
|
+
text: i,
|
|
435
|
+
actionCode: c
|
|
436
|
+
}) => {
|
|
437
|
+
n.push({
|
|
438
|
+
action: "replace",
|
|
439
|
+
model: "replace",
|
|
440
|
+
payload: " ",
|
|
441
|
+
position: r,
|
|
442
|
+
text: i,
|
|
443
|
+
actionCode: c
|
|
404
444
|
});
|
|
405
445
|
}
|
|
406
446
|
};
|
|
407
447
|
return o.forEach((r) => {
|
|
408
|
-
var
|
|
448
|
+
var m, T;
|
|
409
449
|
if (r.type === "text") {
|
|
410
450
|
t += r.text || "";
|
|
411
451
|
return;
|
|
412
452
|
}
|
|
413
453
|
if (r.type !== "customTag") return;
|
|
414
|
-
const
|
|
454
|
+
const i = (m = r.attrs) == null ? void 0 : m.categ, c = (T = r.attrs) == null ? void 0 : T.payload, l = t.length, u = M(r), g = a[i];
|
|
415
455
|
u && s.push({
|
|
416
|
-
start:
|
|
417
|
-
end:
|
|
456
|
+
start: l,
|
|
457
|
+
end: l + u.length
|
|
418
458
|
}), g && g({
|
|
419
459
|
payload: c,
|
|
420
|
-
position:
|
|
460
|
+
position: l,
|
|
421
461
|
text: u,
|
|
422
|
-
actionCode:
|
|
462
|
+
actionCode: i
|
|
423
463
|
}), t += u;
|
|
424
464
|
}), {
|
|
425
465
|
text: t,
|
|
@@ -431,7 +471,9 @@ const ue = [
|
|
|
431
471
|
if (e.type === "paragraph") return [e];
|
|
432
472
|
if (e.type === "doc")
|
|
433
473
|
return o.filter((n) => n.type === "paragraph");
|
|
434
|
-
const t = o.filter(
|
|
474
|
+
const t = o.filter(
|
|
475
|
+
(n) => n.type === "paragraph"
|
|
476
|
+
);
|
|
435
477
|
return t.length ? t : o.some(N) ? [
|
|
436
478
|
{
|
|
437
479
|
type: "paragraph",
|
|
@@ -441,19 +483,19 @@ const ue = [
|
|
|
441
483
|
}, ne = (e, o) => {
|
|
442
484
|
let t = 0;
|
|
443
485
|
return o.map((n) => {
|
|
444
|
-
const s = e.indexOf(n, t),
|
|
486
|
+
const s = e.indexOf(n, t), a = s >= 0 ? s : t, r = a + n.length;
|
|
445
487
|
return t = r, {
|
|
446
488
|
text: n,
|
|
447
|
-
start:
|
|
489
|
+
start: a,
|
|
448
490
|
end: r
|
|
449
491
|
};
|
|
450
492
|
});
|
|
451
493
|
}, oe = (e, o) => e.reduce((t, n) => {
|
|
452
494
|
if (o.some(
|
|
453
|
-
(
|
|
495
|
+
(a) => n.start > a.start && n.start < a.end
|
|
454
496
|
) && t.length) {
|
|
455
|
-
const
|
|
456
|
-
return
|
|
497
|
+
const a = t[t.length - 1];
|
|
498
|
+
return a.text += n.text, a.end = n.end, t;
|
|
457
499
|
}
|
|
458
500
|
return t.push({ ...n }), t;
|
|
459
501
|
}, []), re = (e, o, t, n) => e.position >= o && e.position < t ? !0 : !e.text && n && e.position === t, se = (e) => {
|
|
@@ -464,11 +506,16 @@ const ue = [
|
|
|
464
506
|
e.protectedRanges || []
|
|
465
507
|
);
|
|
466
508
|
return t.map((n, s) => {
|
|
467
|
-
const
|
|
468
|
-
(
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
509
|
+
const a = s === t.length - 1, r = e.playments.filter(
|
|
510
|
+
(i) => re(
|
|
511
|
+
i,
|
|
512
|
+
n.start,
|
|
513
|
+
n.end,
|
|
514
|
+
a
|
|
515
|
+
)
|
|
516
|
+
).map((i) => ({
|
|
517
|
+
...i,
|
|
518
|
+
position: i.position - n.start
|
|
472
519
|
}));
|
|
473
520
|
return {
|
|
474
521
|
text: n.text,
|
|
@@ -482,8 +529,8 @@ const ue = [
|
|
|
482
529
|
};
|
|
483
530
|
return te(e).forEach((n) => {
|
|
484
531
|
const s = ee(n);
|
|
485
|
-
!s.text && !s.playments.length || se(s).forEach(({ text:
|
|
486
|
-
o.sentences.push(
|
|
532
|
+
!s.text && !s.playments.length || se(s).forEach(({ text: a, playments: r }) => {
|
|
533
|
+
o.sentences.push(a), o.playments.push(r);
|
|
487
534
|
});
|
|
488
535
|
}), o;
|
|
489
536
|
};
|
|
@@ -491,19 +538,19 @@ export {
|
|
|
491
538
|
f as DeleteMode,
|
|
492
539
|
_ as LanguageOptions,
|
|
493
540
|
ue as NumberToTextTools,
|
|
494
|
-
|
|
541
|
+
ie as StopOptions,
|
|
495
542
|
h as ToolConfig,
|
|
496
543
|
S as allToolTypes,
|
|
497
544
|
ge as convertToTtsFormat,
|
|
498
|
-
|
|
545
|
+
ae as getInitContent,
|
|
499
546
|
p as getVisualLength,
|
|
500
|
-
|
|
547
|
+
le as resolveTtsEditorFeatures,
|
|
501
548
|
pe as sanitizePastedHtml,
|
|
502
549
|
H as sanitizePastedText,
|
|
503
550
|
Q as splitTextToSentences,
|
|
504
551
|
w as toCardinal,
|
|
505
552
|
$ as toColloquial,
|
|
506
553
|
ce as toPhoneReading,
|
|
507
|
-
|
|
554
|
+
I as toPositional,
|
|
508
555
|
ee as transformParagraph
|
|
509
556
|
};
|