oasis-editor 0.0.366 → 0.0.367
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/{OasisEditorApp-nDAGCu_U.js → OasisEditorApp-BCqvLzdx.js} +1 -1
- package/dist/assets/{importDocxWorker-BaeaKrDG.js → importDocxWorker-DmlXA3cz.js} +123 -87
- package/dist/{defaultToolbar-CFrB1ssO.js → defaultToolbar-BdHm7GcP.js} +1 -1
- package/dist/import/docx/runs.d.ts +1 -1
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +1 -1
- package/package.json +1 -1
|
@@ -10283,56 +10283,56 @@ while (n === s[++o] && n === s[++o] && n === s[++o] && n === s[++o] && n === s[+
|
|
|
10283
10283
|
...void 0 !== p ? { displacedByCustomXml: p } : {}
|
|
10284
10284
|
};
|
|
10285
10285
|
}
|
|
10286
|
-
async function mn(e, t, r, n, o) {
|
|
10287
|
-
const
|
|
10288
|
-
let
|
|
10289
|
-
const
|
|
10290
|
-
|
|
10291
|
-
},
|
|
10292
|
-
for (let
|
|
10293
|
-
const e =
|
|
10286
|
+
async function mn(e, t, r, n, o, i) {
|
|
10287
|
+
const a = [];
|
|
10288
|
+
let s, l, c, u = 0;
|
|
10289
|
+
const d = [], p = [], f = (e) => {
|
|
10290
|
+
a.push(e), u += e.length;
|
|
10291
|
+
}, h = i ?? e.childNodes;
|
|
10292
|
+
for (let m = 0; m < h.length; m += 1) {
|
|
10293
|
+
const e = h[m];
|
|
10294
10294
|
if (e?.nodeType !== e.ELEMENT_NODE) continue;
|
|
10295
10295
|
const i = e;
|
|
10296
|
-
if ("http://schemas.openxmlformats.org/wordprocessingml/2006/main" === i.namespaceURI) if ("t" === i.localName || "delText" === i.localName)
|
|
10297
|
-
else if ("tab" === i.localName)
|
|
10298
|
-
else if ("noBreakHyphen" === i.localName)
|
|
10299
|
-
else if ("softHyphen" === i.localName)
|
|
10296
|
+
if ("http://schemas.openxmlformats.org/wordprocessingml/2006/main" === i.namespaceURI) if ("t" === i.localName || "delText" === i.localName) f(i.textContent ?? "");
|
|
10297
|
+
else if ("tab" === i.localName) f(" ");
|
|
10298
|
+
else if ("noBreakHyphen" === i.localName) f("‑");
|
|
10299
|
+
else if ("softHyphen" === i.localName) f("");
|
|
10300
10300
|
else if ("br" === i.localName) {
|
|
10301
10301
|
const e = Fe(i, "type");
|
|
10302
|
-
|
|
10302
|
+
f("page" === e ? "\f" : "column" === e ? "\v" : "\n");
|
|
10303
10303
|
} else {
|
|
10304
10304
|
if ("lastRenderedPageBreak" === i.localName) continue;
|
|
10305
10305
|
if ("bookmarkStart" === i.localName || "bookmarkEnd" === i.localName) {
|
|
10306
10306
|
const e = un(i);
|
|
10307
|
-
e &&
|
|
10308
|
-
offset:
|
|
10307
|
+
e && d.push({
|
|
10308
|
+
offset: u,
|
|
10309
10309
|
marker: e
|
|
10310
10310
|
});
|
|
10311
10311
|
continue;
|
|
10312
10312
|
}
|
|
10313
10313
|
if ("commentRangeStart" === i.localName || "commentRangeEnd" === i.localName) {
|
|
10314
10314
|
const e = dn(i);
|
|
10315
|
-
e &&
|
|
10316
|
-
offset:
|
|
10315
|
+
e && p.push({
|
|
10316
|
+
offset: u,
|
|
10317
10317
|
marker: e
|
|
10318
10318
|
});
|
|
10319
10319
|
continue;
|
|
10320
10320
|
}
|
|
10321
10321
|
if ("proofErr" === i.localName || "commentReference" === i.localName || "permStart" === i.localName || "permEnd" === i.localName) continue;
|
|
10322
|
-
if ("cr" === i.localName)
|
|
10322
|
+
if ("cr" === i.localName) f("\n");
|
|
10323
10323
|
else if ("drawing" === i.localName) {
|
|
10324
10324
|
const e = await nn(i, t, r, n);
|
|
10325
|
-
if (e.image)
|
|
10325
|
+
if (e.image) f(e.text), s = e.image;
|
|
10326
10326
|
else {
|
|
10327
10327
|
const e = await sn(i, o);
|
|
10328
|
-
e && (
|
|
10328
|
+
e && (f(""), l = e);
|
|
10329
10329
|
}
|
|
10330
10330
|
} else if ("pict" === i.localName) {
|
|
10331
10331
|
const e = await an(i, t, r, n);
|
|
10332
|
-
e && (
|
|
10332
|
+
e && (f(""), s = e);
|
|
10333
10333
|
} else if ("sym" === i.localName) {
|
|
10334
10334
|
const e = Fe(i, "font") ?? "", t = Fe(i, "char") ?? "", r = parseInt(t, 16);
|
|
10335
|
-
|
|
10335
|
+
f(Number.isFinite(r) && r > 0 ? String.fromCodePoint(r) : "?"), c = {
|
|
10336
10336
|
font: e,
|
|
10337
10337
|
char: t
|
|
10338
10338
|
};
|
|
@@ -10342,17 +10342,17 @@ while (n === s[++o] && n === s[++o] && n === s[++o] && n === s[++o] && n === s[+
|
|
|
10342
10342
|
const e = ln(i);
|
|
10343
10343
|
if (e) {
|
|
10344
10344
|
const t = await sn(e, o);
|
|
10345
|
-
t && (
|
|
10345
|
+
t && (f(""), l = t);
|
|
10346
10346
|
}
|
|
10347
10347
|
}
|
|
10348
10348
|
}
|
|
10349
10349
|
return {
|
|
10350
|
-
text:
|
|
10351
|
-
image:
|
|
10352
|
-
...
|
|
10353
|
-
...
|
|
10354
|
-
...
|
|
10355
|
-
...
|
|
10350
|
+
text: a.join(""),
|
|
10351
|
+
image: s,
|
|
10352
|
+
...l ? { textBox: l } : {},
|
|
10353
|
+
...d.length > 0 ? { innerBookmarks: d } : {},
|
|
10354
|
+
...p.length > 0 ? { innerComments: p } : {},
|
|
10355
|
+
...c ? { sym: c } : {}
|
|
10356
10356
|
};
|
|
10357
10357
|
}
|
|
10358
10358
|
async function gn(e, t, r, n, o, i, a, s) {
|
|
@@ -10387,7 +10387,7 @@ while (n === s[++o] && n === s[++o] && n === s[++o] && n === s[++o] && n === s[+
|
|
|
10387
10387
|
const t = /\bNUMPAGES\b/i.test(e.instruction) ? "NUMPAGES" : /\bPAGE\b/i.test(e.instruction) ? "PAGE" : /\bDATE\b/i.test(e.instruction) ? "DATE" : /\bREF\b/i.test(e.instruction) ? "REF" : /\bPAGEREF\b/i.test(e.instruction) ? "PAGEREF" : null;
|
|
10388
10388
|
if (!t) return;
|
|
10389
10389
|
const r = Cr(/\*\s*([A-Za-z]+)/.exec(e.instruction)?.[1]), n = "DATE" === t ? /@\s*"([^"]*)"/.exec(e.instruction)?.[1] : void 0, o = "REF" === t || "PAGEREF" === t ? cn(e.instruction) : void 0, i = l.slice(e.beginIndex);
|
|
10390
|
-
if (i.some((e) => e.bookmark)) return;
|
|
10390
|
+
if (i.some((e) => Boolean(e.bookmark || e.comment || e.opaque || e.image || e.textBox || e.math || e.sym || e.footnoteReference || e.endnoteReference || e.revision || e.sdtWrappers?.length))) return;
|
|
10391
10391
|
const a = i.filter((e) => !e.fieldChar && void 0 === e.fieldInstruction), s = a.map((e) => e.text).join("") || "1", c = a.find((e) => e.styles)?.styles ?? e.beginStyles;
|
|
10392
10392
|
l.length = e.beginIndex;
|
|
10393
10393
|
const u = "DATE" === t ? n ? {
|
|
@@ -10491,47 +10491,83 @@ while (n === s[++o] && n === s[++o] && n === s[++o] && n === s[++o] && n === s[+
|
|
|
10491
10491
|
"br",
|
|
10492
10492
|
"cr",
|
|
10493
10493
|
"lastRenderedPageBreak"
|
|
10494
|
-
].includes(e.localName ?? "")
|
|
10495
|
-
|
|
10494
|
+
].includes(e.localName ?? ""), m = (e) => "http://schemas.openxmlformats.org/wordprocessingml/2006/main" === e.namespaceURI && [
|
|
10495
|
+
"drawing",
|
|
10496
|
+
"pict",
|
|
10497
|
+
"sym",
|
|
10498
|
+
"bookmarkStart",
|
|
10499
|
+
"bookmarkEnd",
|
|
10500
|
+
"commentRangeStart",
|
|
10501
|
+
"commentRangeEnd"
|
|
10502
|
+
].includes(e.localName ?? "") || "http://schemas.openxmlformats.org/markup-compatibility/2006" === e.namespaceURI && "AlternateContent" === e.localName;
|
|
10503
|
+
if (p.some((e) => e.opaque) && (1 === t.length || !c.length && p.every((e) => e.opaque || f(e.child) || m(e.child)))) {
|
|
10496
10504
|
let t = "";
|
|
10497
|
-
const
|
|
10505
|
+
const i = a ? {
|
|
10498
10506
|
...e,
|
|
10499
10507
|
link: a
|
|
10500
|
-
} : e,
|
|
10508
|
+
} : e, c = () => {
|
|
10501
10509
|
t.length && (l.push({
|
|
10502
10510
|
text: t,
|
|
10503
|
-
...
|
|
10511
|
+
...i ? { styles: { ...i } } : {}
|
|
10504
10512
|
}), t = "");
|
|
10505
10513
|
};
|
|
10506
|
-
for (const { child: e, opaque:
|
|
10514
|
+
for (const { child: e, opaque: a } of p) if (a) c(), l.push({
|
|
10507
10515
|
text: "",
|
|
10508
|
-
opaque:
|
|
10509
|
-
...
|
|
10516
|
+
opaque: a,
|
|
10517
|
+
...i ? { styles: { ...i } } : {}
|
|
10510
10518
|
});
|
|
10511
|
-
else
|
|
10512
|
-
|
|
10513
|
-
|
|
10514
|
-
t
|
|
10515
|
-
|
|
10516
|
-
|
|
10517
|
-
|
|
10518
|
-
|
|
10519
|
-
|
|
10520
|
-
|
|
10521
|
-
|
|
10522
|
-
|
|
10523
|
-
t
|
|
10524
|
-
|
|
10525
|
-
|
|
10526
|
-
|
|
10527
|
-
|
|
10528
|
-
|
|
10529
|
-
|
|
10530
|
-
|
|
10531
|
-
|
|
10519
|
+
else {
|
|
10520
|
+
if (m(e)) {
|
|
10521
|
+
c();
|
|
10522
|
+
const t = await mn(h, r, n, o, s, [e]);
|
|
10523
|
+
for (const e of t.innerBookmarks ?? []) l.push({
|
|
10524
|
+
text: "",
|
|
10525
|
+
bookmark: e.marker
|
|
10526
|
+
});
|
|
10527
|
+
for (const e of t.innerComments ?? []) l.push({
|
|
10528
|
+
text: "",
|
|
10529
|
+
comment: e.marker
|
|
10530
|
+
});
|
|
10531
|
+
if (t.text.length || t.image || t.textBox) {
|
|
10532
|
+
const e = t.sym && !i?.fontFamily ? {
|
|
10533
|
+
...i,
|
|
10534
|
+
fontFamily: t.sym.font
|
|
10535
|
+
} : i;
|
|
10536
|
+
l.push({
|
|
10537
|
+
text: t.text,
|
|
10538
|
+
...t.image ? { image: t.image } : {},
|
|
10539
|
+
...t.textBox ? { textBox: t.textBox } : {},
|
|
10540
|
+
...t.sym ? { sym: t.sym } : {},
|
|
10541
|
+
...e ? { styles: { ...e } } : {}
|
|
10542
|
+
});
|
|
10543
|
+
}
|
|
10544
|
+
continue;
|
|
10545
|
+
}
|
|
10546
|
+
switch (e.localName) {
|
|
10547
|
+
case "t":
|
|
10548
|
+
case "delText":
|
|
10549
|
+
t += e.textContent ?? "";
|
|
10550
|
+
break;
|
|
10551
|
+
case "tab":
|
|
10552
|
+
t += " ";
|
|
10553
|
+
break;
|
|
10554
|
+
case "noBreakHyphen":
|
|
10555
|
+
t += "‑";
|
|
10556
|
+
break;
|
|
10557
|
+
case "softHyphen":
|
|
10558
|
+
t += "";
|
|
10559
|
+
break;
|
|
10560
|
+
case "cr":
|
|
10561
|
+
t += "\n";
|
|
10562
|
+
break;
|
|
10563
|
+
case "br": {
|
|
10564
|
+
const r = Fe(e, "type");
|
|
10565
|
+
t += "page" === r ? "\f" : "column" === r ? "\v" : "\n";
|
|
10566
|
+
break;
|
|
10567
|
+
}
|
|
10532
10568
|
}
|
|
10533
10569
|
}
|
|
10534
|
-
|
|
10570
|
+
c();
|
|
10535
10571
|
continue;
|
|
10536
10572
|
}
|
|
10537
10573
|
if (Ae(h, "http://schemas.openxmlformats.org/wordprocessingml/2006/main", "fldChar").length > 0 || Ae(h, "http://schemas.openxmlformats.org/wordprocessingml/2006/main", "instrText").length > 0 || Ae(h, "http://schemas.openxmlformats.org/wordprocessingml/2006/main", "delInstrText").length > 0) {
|
|
@@ -10543,11 +10579,11 @@ while (n === s[++o] && n === s[++o] && n === s[++o] && n === s[++o] && n === s[+
|
|
|
10543
10579
|
}
|
|
10544
10580
|
continue;
|
|
10545
10581
|
}
|
|
10546
|
-
const
|
|
10547
|
-
if (
|
|
10548
|
-
const t = Fe(
|
|
10582
|
+
const g = De(h, Ne, "footnoteReference");
|
|
10583
|
+
if (g) {
|
|
10584
|
+
const t = Fe(g, "id");
|
|
10549
10585
|
if (!t) continue;
|
|
10550
|
-
const r = Fe(
|
|
10586
|
+
const r = Fe(g, "customMarkFollows");
|
|
10551
10587
|
let n = e;
|
|
10552
10588
|
(n ??= {}).styleId ??= "footnoteReference", void 0 === n.superscript && (n.superscript = !0), l.push({
|
|
10553
10589
|
text: "?",
|
|
@@ -10559,11 +10595,11 @@ while (n === s[++o] && n === s[++o] && n === s[++o] && n === s[++o] && n === s[+
|
|
|
10559
10595
|
});
|
|
10560
10596
|
continue;
|
|
10561
10597
|
}
|
|
10562
|
-
const
|
|
10563
|
-
if (
|
|
10564
|
-
const t = Fe(
|
|
10598
|
+
const w = De(h, Ne, "endnoteReference");
|
|
10599
|
+
if (w) {
|
|
10600
|
+
const t = Fe(w, "id");
|
|
10565
10601
|
if (!t) continue;
|
|
10566
|
-
const r = Fe(
|
|
10602
|
+
const r = Fe(w, "customMarkFollows");
|
|
10567
10603
|
let n = e;
|
|
10568
10604
|
(n ??= {}).styleId ??= "endnoteReference", void 0 === n.superscript && (n.superscript = !0), l.push({
|
|
10569
10605
|
text: "?",
|
|
@@ -10575,47 +10611,47 @@ while (n === s[++o] && n === s[++o] && n === s[++o] && n === s[++o] && n === s[+
|
|
|
10575
10611
|
});
|
|
10576
10612
|
continue;
|
|
10577
10613
|
}
|
|
10578
|
-
const { text:
|
|
10579
|
-
let
|
|
10580
|
-
|
|
10581
|
-
const
|
|
10614
|
+
const { text: b, image: v, textBox: y, innerBookmarks: x, innerComments: E, sym: S } = await mn(h, r, n, o, s);
|
|
10615
|
+
let N = e;
|
|
10616
|
+
S && !N?.fontFamily && ((N ??= {}).fontFamily = S.font), a && ((N ??= {}).link = a);
|
|
10617
|
+
const k = [...(x ?? []).map((e) => ({
|
|
10582
10618
|
offset: e.offset,
|
|
10583
10619
|
run: {
|
|
10584
10620
|
text: "",
|
|
10585
10621
|
bookmark: e.marker
|
|
10586
10622
|
}
|
|
10587
|
-
})), ...(
|
|
10623
|
+
})), ...(E ?? []).map((e) => ({
|
|
10588
10624
|
offset: e.offset,
|
|
10589
10625
|
run: {
|
|
10590
10626
|
text: "",
|
|
10591
10627
|
comment: e.marker
|
|
10592
10628
|
}
|
|
10593
10629
|
}))];
|
|
10594
|
-
if (
|
|
10595
|
-
|
|
10630
|
+
if (k.length > 0 && !v && !y) {
|
|
10631
|
+
k.sort((e, t) => e.offset - t.offset);
|
|
10596
10632
|
let e = 0;
|
|
10597
|
-
for (const r of
|
|
10598
|
-
const t =
|
|
10633
|
+
for (const r of k) {
|
|
10634
|
+
const t = b.slice(e, r.offset);
|
|
10599
10635
|
t.length > 0 && l.push({
|
|
10600
10636
|
text: t,
|
|
10601
|
-
...
|
|
10637
|
+
...N ? { styles: N } : {}
|
|
10602
10638
|
}), l.push(r.run), e = r.offset;
|
|
10603
10639
|
}
|
|
10604
|
-
const t =
|
|
10640
|
+
const t = b.slice(e);
|
|
10605
10641
|
t.length > 0 && l.push({
|
|
10606
10642
|
text: t,
|
|
10607
|
-
...
|
|
10643
|
+
...N ? { styles: N } : {}
|
|
10608
10644
|
});
|
|
10609
10645
|
continue;
|
|
10610
10646
|
}
|
|
10611
|
-
if (0 ===
|
|
10647
|
+
if (0 === b.length && !v && !y) continue;
|
|
10612
10648
|
if (l.push({
|
|
10613
|
-
text:
|
|
10614
|
-
...
|
|
10615
|
-
...
|
|
10616
|
-
...
|
|
10617
|
-
...
|
|
10618
|
-
}),
|
|
10649
|
+
text: b,
|
|
10650
|
+
...v ? { image: v } : {},
|
|
10651
|
+
...y ? { textBox: y } : {},
|
|
10652
|
+
...S ? { sym: S } : {},
|
|
10653
|
+
...N ? { styles: N } : {}
|
|
10654
|
+
}), x) for (const r of x) l.push({
|
|
10619
10655
|
text: "",
|
|
10620
10656
|
bookmark: r.marker
|
|
10621
10657
|
});
|