oasis-editor 0.0.36 → 0.0.38
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-gZEDGfQL.js → OasisEditorApp-Bq6fZsEX.js} +128 -107
- package/dist/assets/{importDocxWorker-xRrspiYv.js → importDocxWorker-CMMv6C-7.js} +1 -1
- package/dist/export/pdf/draw/blockDrawers.d.ts +19 -0
- package/dist/export/pdf/draw/drawFragment.d.ts +2 -1
- package/dist/export/pdf/draw/drawParagraph.d.ts +2 -1
- package/dist/export/pdf/draw/drawTable.d.ts +2 -1
- package/dist/export/pdf/draw/drawTextBoxShape.d.ts +3 -1
- package/dist/import/docx/nestedBlocks.d.ts +8 -0
- package/dist/import/docx/paragraphs.d.ts +3 -2
- package/dist/import/docx/tables.d.ts +2 -1
- package/dist/{index-BrL9FzT-.js → index-lzzJKBU1.js} +284 -234
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +4 -4
- package/package.json +1 -1
|
@@ -2483,7 +2483,7 @@ function OasisEditorAppLazy(props = {}) {
|
|
|
2483
2483
|
onCleanup(() => {
|
|
2484
2484
|
cancelled = true;
|
|
2485
2485
|
});
|
|
2486
|
-
import("./OasisEditorApp-
|
|
2486
|
+
import("./OasisEditorApp-Bq6fZsEX.js").then((m) => {
|
|
2487
2487
|
cancelled = true;
|
|
2488
2488
|
setProgress(1);
|
|
2489
2489
|
setTimeout(() => setApp(() => m.OasisEditorApp), 180);
|
|
@@ -33603,6 +33603,207 @@ async function parseRunsContainer(container, numberingMaps, zip, relsMap, assets
|
|
|
33603
33603
|
}
|
|
33604
33604
|
return runs;
|
|
33605
33605
|
}
|
|
33606
|
+
function parseDropCapFrame(paragraphProperties, runs) {
|
|
33607
|
+
var _a;
|
|
33608
|
+
const framePr = getFirstChildByTagNameNS(
|
|
33609
|
+
paragraphProperties,
|
|
33610
|
+
WORD_NS,
|
|
33611
|
+
"framePr"
|
|
33612
|
+
);
|
|
33613
|
+
if (!framePr) {
|
|
33614
|
+
return null;
|
|
33615
|
+
}
|
|
33616
|
+
const dropCap = getAttributeValue(framePr, "dropCap");
|
|
33617
|
+
if (!dropCap || dropCap === "none") {
|
|
33618
|
+
return null;
|
|
33619
|
+
}
|
|
33620
|
+
const text = runs.map((run) => run.text).join("");
|
|
33621
|
+
if (text.length === 0) {
|
|
33622
|
+
return null;
|
|
33623
|
+
}
|
|
33624
|
+
const lines = Number(getAttributeValue(framePr, "lines"));
|
|
33625
|
+
return {
|
|
33626
|
+
text,
|
|
33627
|
+
lines: Number.isFinite(lines) && lines > 0 ? lines : 3,
|
|
33628
|
+
type: dropCap === "margin" ? "margin" : "drop",
|
|
33629
|
+
style: (_a = runs[0]) == null ? void 0 : _a.styles
|
|
33630
|
+
};
|
|
33631
|
+
}
|
|
33632
|
+
function createImportedParagraph(runs, paragraphStyle, list, markRunStyle) {
|
|
33633
|
+
var _a;
|
|
33634
|
+
const paragraph = createEditorParagraphFromRuns(
|
|
33635
|
+
runs.length > 0 ? runs.map((run) => ({
|
|
33636
|
+
text: run.text,
|
|
33637
|
+
styles: run.styles,
|
|
33638
|
+
image: run.image
|
|
33639
|
+
})) : (
|
|
33640
|
+
// An empty paragraph still carries the formatting of its paragraph mark
|
|
33641
|
+
// (`w:pPr/w:rPr`), which Word uses to render the blank line's font/size.
|
|
33642
|
+
// Apply it so empty lines match Word instead of falling back to defaults.
|
|
33643
|
+
[{ text: "", styles: markRunStyle }]
|
|
33644
|
+
)
|
|
33645
|
+
);
|
|
33646
|
+
runs.forEach((run, index) => {
|
|
33647
|
+
if (run.field) {
|
|
33648
|
+
paragraph.runs[index].field = { ...run.field };
|
|
33649
|
+
}
|
|
33650
|
+
if (run.fieldChar) {
|
|
33651
|
+
paragraph.runs[index].fieldChar = { ...run.fieldChar };
|
|
33652
|
+
}
|
|
33653
|
+
if (run.fieldInstruction !== void 0) {
|
|
33654
|
+
paragraph.runs[index].fieldInstruction = run.fieldInstruction;
|
|
33655
|
+
}
|
|
33656
|
+
if (run.textBox) {
|
|
33657
|
+
paragraph.runs[index].textBox = run.textBox;
|
|
33658
|
+
}
|
|
33659
|
+
if (run.footnoteReference) {
|
|
33660
|
+
paragraph.runs[index].__importedFootnoteRef = {
|
|
33661
|
+
...run.footnoteReference
|
|
33662
|
+
};
|
|
33663
|
+
}
|
|
33664
|
+
if (run.endnoteReference) {
|
|
33665
|
+
paragraph.runs[index].__importedEndnoteRef = {
|
|
33666
|
+
...run.endnoteReference
|
|
33667
|
+
};
|
|
33668
|
+
}
|
|
33669
|
+
if (run.bookmark) {
|
|
33670
|
+
paragraph.runs[index].__importedBookmark = { ...run.bookmark };
|
|
33671
|
+
}
|
|
33672
|
+
if (run.comment) {
|
|
33673
|
+
paragraph.runs[index].__importedComment = { ...run.comment };
|
|
33674
|
+
}
|
|
33675
|
+
if (run.sym) {
|
|
33676
|
+
paragraph.runs[index].sym = { ...run.sym };
|
|
33677
|
+
}
|
|
33678
|
+
});
|
|
33679
|
+
paragraph.style = paragraphStyle ? { ...paragraphStyle } : void 0;
|
|
33680
|
+
for (const run of paragraph.runs) {
|
|
33681
|
+
run.styles = normalizeImportedRunStyle(
|
|
33682
|
+
run.styles,
|
|
33683
|
+
(_a = paragraph.style) == null ? void 0 : _a.styleId
|
|
33684
|
+
);
|
|
33685
|
+
}
|
|
33686
|
+
paragraph.list = list ? { ...list } : void 0;
|
|
33687
|
+
return paragraph;
|
|
33688
|
+
}
|
|
33689
|
+
function splitRunsAtPageBreaks(runs) {
|
|
33690
|
+
const segments = [[]];
|
|
33691
|
+
let hasPageBreak = false;
|
|
33692
|
+
const appendRun = (run, text) => {
|
|
33693
|
+
if (text.length === 0 && !run.image && !run.textBox && !run.field && !run.fieldChar && run.fieldInstruction === void 0 && !run.bookmark && !run.comment) {
|
|
33694
|
+
return;
|
|
33695
|
+
}
|
|
33696
|
+
segments[segments.length - 1].push({
|
|
33697
|
+
...run,
|
|
33698
|
+
text
|
|
33699
|
+
});
|
|
33700
|
+
};
|
|
33701
|
+
for (const run of runs) {
|
|
33702
|
+
if (!run.text.includes(PAGE_BREAK_MARKER)) {
|
|
33703
|
+
appendRun(run, run.text);
|
|
33704
|
+
continue;
|
|
33705
|
+
}
|
|
33706
|
+
const parts = run.text.split(PAGE_BREAK_MARKER);
|
|
33707
|
+
parts.forEach((part, index) => {
|
|
33708
|
+
appendRun(run, part);
|
|
33709
|
+
if (index < parts.length - 1) {
|
|
33710
|
+
hasPageBreak = true;
|
|
33711
|
+
segments.push([]);
|
|
33712
|
+
}
|
|
33713
|
+
});
|
|
33714
|
+
}
|
|
33715
|
+
return { segments, hasPageBreak };
|
|
33716
|
+
}
|
|
33717
|
+
function paragraphHasVisibleContent(runs) {
|
|
33718
|
+
return runs.some(
|
|
33719
|
+
(run) => run.image || run.textBox || run.field || run.fieldChar || run.fieldInstruction !== void 0 || run.bookmark || run.comment || run.text.replace(/\s/g, "").length > 0
|
|
33720
|
+
);
|
|
33721
|
+
}
|
|
33722
|
+
async function parseParagraphNodes(paragraphNode, numberingMaps, zip, relsMap, assets, theme, parseNestedBlocks, inheritedStyle) {
|
|
33723
|
+
const paragraphProperties = getFirstChildByTagNameNS(
|
|
33724
|
+
paragraphNode,
|
|
33725
|
+
WORD_NS,
|
|
33726
|
+
"pPr"
|
|
33727
|
+
);
|
|
33728
|
+
const runs = await parseRunsContainer(
|
|
33729
|
+
paragraphNode,
|
|
33730
|
+
numberingMaps,
|
|
33731
|
+
zip,
|
|
33732
|
+
relsMap,
|
|
33733
|
+
assets,
|
|
33734
|
+
theme,
|
|
33735
|
+
void 0,
|
|
33736
|
+
parseNestedBlocks
|
|
33737
|
+
);
|
|
33738
|
+
const parsedStyle = withDocxImplicitSingleLineHeight(
|
|
33739
|
+
parseParagraphStyle$1(paragraphProperties)
|
|
33740
|
+
);
|
|
33741
|
+
const markRunStyle = parseRunStyle(
|
|
33742
|
+
getFirstChildByTagNameNS(paragraphProperties, WORD_NS, "rPr"),
|
|
33743
|
+
theme
|
|
33744
|
+
);
|
|
33745
|
+
const listResult = parseParagraphList(paragraphProperties, numberingMaps);
|
|
33746
|
+
const list = listResult == null ? void 0 : listResult.list;
|
|
33747
|
+
let styleWithListIndent = parsedStyle;
|
|
33748
|
+
if (listResult == null ? void 0 : listResult.indent) {
|
|
33749
|
+
const { left, hanging } = listResult.indent;
|
|
33750
|
+
const base = parsedStyle ?? {};
|
|
33751
|
+
styleWithListIndent = {
|
|
33752
|
+
...base,
|
|
33753
|
+
...base.indentLeft === void 0 && left !== void 0 ? { indentLeft: left } : {},
|
|
33754
|
+
...base.indentHanging === void 0 && hanging !== void 0 ? { indentHanging: hanging } : {}
|
|
33755
|
+
};
|
|
33756
|
+
}
|
|
33757
|
+
const paragraphStyle = normalizeImportedParagraphStyle(
|
|
33758
|
+
inheritedStyle ? { ...inheritedStyle, ...styleWithListIndent ?? {} } : styleWithListIndent
|
|
33759
|
+
);
|
|
33760
|
+
const dropCapFrame = parseDropCapFrame(paragraphProperties, runs);
|
|
33761
|
+
if (dropCapFrame) {
|
|
33762
|
+
return { paragraphs: [], pageBreakAfter: false, dropCapFrame };
|
|
33763
|
+
}
|
|
33764
|
+
const { segments, hasPageBreak } = splitRunsAtPageBreaks(runs);
|
|
33765
|
+
if (!hasPageBreak) {
|
|
33766
|
+
return {
|
|
33767
|
+
paragraphs: [
|
|
33768
|
+
createImportedParagraph(runs, paragraphStyle, list, markRunStyle)
|
|
33769
|
+
],
|
|
33770
|
+
pageBreakAfter: false
|
|
33771
|
+
};
|
|
33772
|
+
}
|
|
33773
|
+
const paragraphs = [];
|
|
33774
|
+
let pendingPageBreakBefore = false;
|
|
33775
|
+
for (let index = 0; index < segments.length; index += 1) {
|
|
33776
|
+
const segment = segments[index];
|
|
33777
|
+
if (index > 0) {
|
|
33778
|
+
pendingPageBreakBefore = true;
|
|
33779
|
+
}
|
|
33780
|
+
if (!paragraphHasVisibleContent(segment)) {
|
|
33781
|
+
continue;
|
|
33782
|
+
}
|
|
33783
|
+
const style2 = pendingPageBreakBefore ? { ...paragraphStyle ?? {}, pageBreakBefore: true } : paragraphStyle;
|
|
33784
|
+
paragraphs.push(
|
|
33785
|
+
createImportedParagraph(segment, style2, list, markRunStyle)
|
|
33786
|
+
);
|
|
33787
|
+
pendingPageBreakBefore = false;
|
|
33788
|
+
}
|
|
33789
|
+
return {
|
|
33790
|
+
paragraphs,
|
|
33791
|
+
pageBreakAfter: pendingPageBreakBefore
|
|
33792
|
+
};
|
|
33793
|
+
}
|
|
33794
|
+
async function parseParagraphNode(paragraphNode, numberingMaps, zip, relsMap, assets, theme, parseNestedBlocks, inheritedStyle) {
|
|
33795
|
+
const parsed = await parseParagraphNodes(
|
|
33796
|
+
paragraphNode,
|
|
33797
|
+
numberingMaps,
|
|
33798
|
+
zip,
|
|
33799
|
+
relsMap,
|
|
33800
|
+
assets,
|
|
33801
|
+
theme,
|
|
33802
|
+
parseNestedBlocks,
|
|
33803
|
+
inheritedStyle
|
|
33804
|
+
);
|
|
33805
|
+
return parsed.paragraphs[0] ?? createEditorParagraphFromRuns([{ text: "" }]);
|
|
33806
|
+
}
|
|
33606
33807
|
function parseDocxWidthValue(element) {
|
|
33607
33808
|
if (!element) {
|
|
33608
33809
|
return void 0;
|
|
@@ -34131,7 +34332,7 @@ function tableStyleParagraphInheritance(tableStylePPr, paragraphStyleId, styles)
|
|
|
34131
34332
|
}
|
|
34132
34333
|
return emptyOrUndefined(filtered);
|
|
34133
34334
|
}
|
|
34134
|
-
async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, theme, styles) {
|
|
34335
|
+
async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, theme, parseNestedBlocks, styles) {
|
|
34135
34336
|
var _a, _b;
|
|
34136
34337
|
const gridCols = [];
|
|
34137
34338
|
const tblGrid = getFirstChildByTagNameNS(tableNode, WORD_NS, "tblGrid");
|
|
@@ -34224,6 +34425,7 @@ async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, th
|
|
|
34224
34425
|
relsMap,
|
|
34225
34426
|
assets,
|
|
34226
34427
|
theme,
|
|
34428
|
+
parseNestedBlocks,
|
|
34227
34429
|
cellInheritedStyle
|
|
34228
34430
|
)
|
|
34229
34431
|
);
|
|
@@ -34364,7 +34566,24 @@ async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, th
|
|
|
34364
34566
|
}
|
|
34365
34567
|
return table;
|
|
34366
34568
|
}
|
|
34569
|
+
function createNestedBlockParser(numberingMaps, zip, relsMap, assets, theme) {
|
|
34570
|
+
return (container) => parseTxbxContentBlocks(
|
|
34571
|
+
container,
|
|
34572
|
+
numberingMaps,
|
|
34573
|
+
zip,
|
|
34574
|
+
relsMap,
|
|
34575
|
+
assets,
|
|
34576
|
+
theme
|
|
34577
|
+
);
|
|
34578
|
+
}
|
|
34367
34579
|
async function parseTxbxContentBlocks(container, numberingMaps, zip, relsMap, assets, theme) {
|
|
34580
|
+
const parseNestedBlocks = createNestedBlockParser(
|
|
34581
|
+
numberingMaps,
|
|
34582
|
+
zip,
|
|
34583
|
+
relsMap,
|
|
34584
|
+
assets,
|
|
34585
|
+
theme
|
|
34586
|
+
);
|
|
34368
34587
|
const blocks = [];
|
|
34369
34588
|
for (let index = 0; index < container.childNodes.length; index += 1) {
|
|
34370
34589
|
const node = container.childNodes[index];
|
|
@@ -34382,7 +34601,8 @@ async function parseTxbxContentBlocks(container, numberingMaps, zip, relsMap, as
|
|
|
34382
34601
|
zip,
|
|
34383
34602
|
relsMap,
|
|
34384
34603
|
assets,
|
|
34385
|
-
theme
|
|
34604
|
+
theme,
|
|
34605
|
+
parseNestedBlocks
|
|
34386
34606
|
);
|
|
34387
34607
|
for (const paragraph of parsed.paragraphs) {
|
|
34388
34608
|
blocks.push(paragraph);
|
|
@@ -34395,220 +34615,14 @@ async function parseTxbxContentBlocks(container, numberingMaps, zip, relsMap, as
|
|
|
34395
34615
|
zip,
|
|
34396
34616
|
relsMap,
|
|
34397
34617
|
assets,
|
|
34398
|
-
theme
|
|
34618
|
+
theme,
|
|
34619
|
+
parseNestedBlocks
|
|
34399
34620
|
)
|
|
34400
34621
|
);
|
|
34401
34622
|
}
|
|
34402
34623
|
}
|
|
34403
34624
|
return blocks;
|
|
34404
34625
|
}
|
|
34405
|
-
function parseDropCapFrame(paragraphProperties, runs) {
|
|
34406
|
-
var _a;
|
|
34407
|
-
const framePr = getFirstChildByTagNameNS(
|
|
34408
|
-
paragraphProperties,
|
|
34409
|
-
WORD_NS,
|
|
34410
|
-
"framePr"
|
|
34411
|
-
);
|
|
34412
|
-
if (!framePr) {
|
|
34413
|
-
return null;
|
|
34414
|
-
}
|
|
34415
|
-
const dropCap = getAttributeValue(framePr, "dropCap");
|
|
34416
|
-
if (!dropCap || dropCap === "none") {
|
|
34417
|
-
return null;
|
|
34418
|
-
}
|
|
34419
|
-
const text = runs.map((run) => run.text).join("");
|
|
34420
|
-
if (text.length === 0) {
|
|
34421
|
-
return null;
|
|
34422
|
-
}
|
|
34423
|
-
const lines = Number(getAttributeValue(framePr, "lines"));
|
|
34424
|
-
return {
|
|
34425
|
-
text,
|
|
34426
|
-
lines: Number.isFinite(lines) && lines > 0 ? lines : 3,
|
|
34427
|
-
type: dropCap === "margin" ? "margin" : "drop",
|
|
34428
|
-
style: (_a = runs[0]) == null ? void 0 : _a.styles
|
|
34429
|
-
};
|
|
34430
|
-
}
|
|
34431
|
-
function createImportedParagraph(runs, paragraphStyle, list, markRunStyle) {
|
|
34432
|
-
var _a;
|
|
34433
|
-
const paragraph = createEditorParagraphFromRuns(
|
|
34434
|
-
runs.length > 0 ? runs.map((run) => ({
|
|
34435
|
-
text: run.text,
|
|
34436
|
-
styles: run.styles,
|
|
34437
|
-
image: run.image
|
|
34438
|
-
})) : (
|
|
34439
|
-
// An empty paragraph still carries the formatting of its paragraph mark
|
|
34440
|
-
// (`w:pPr/w:rPr`), which Word uses to render the blank line's font/size.
|
|
34441
|
-
// Apply it so empty lines match Word instead of falling back to defaults.
|
|
34442
|
-
[{ text: "", styles: markRunStyle }]
|
|
34443
|
-
)
|
|
34444
|
-
);
|
|
34445
|
-
runs.forEach((run, index) => {
|
|
34446
|
-
if (run.field) {
|
|
34447
|
-
paragraph.runs[index].field = { ...run.field };
|
|
34448
|
-
}
|
|
34449
|
-
if (run.fieldChar) {
|
|
34450
|
-
paragraph.runs[index].fieldChar = { ...run.fieldChar };
|
|
34451
|
-
}
|
|
34452
|
-
if (run.fieldInstruction !== void 0) {
|
|
34453
|
-
paragraph.runs[index].fieldInstruction = run.fieldInstruction;
|
|
34454
|
-
}
|
|
34455
|
-
if (run.textBox) {
|
|
34456
|
-
paragraph.runs[index].textBox = run.textBox;
|
|
34457
|
-
}
|
|
34458
|
-
if (run.footnoteReference) {
|
|
34459
|
-
paragraph.runs[index].__importedFootnoteRef = {
|
|
34460
|
-
...run.footnoteReference
|
|
34461
|
-
};
|
|
34462
|
-
}
|
|
34463
|
-
if (run.endnoteReference) {
|
|
34464
|
-
paragraph.runs[index].__importedEndnoteRef = {
|
|
34465
|
-
...run.endnoteReference
|
|
34466
|
-
};
|
|
34467
|
-
}
|
|
34468
|
-
if (run.bookmark) {
|
|
34469
|
-
paragraph.runs[index].__importedBookmark = { ...run.bookmark };
|
|
34470
|
-
}
|
|
34471
|
-
if (run.comment) {
|
|
34472
|
-
paragraph.runs[index].__importedComment = { ...run.comment };
|
|
34473
|
-
}
|
|
34474
|
-
if (run.sym) {
|
|
34475
|
-
paragraph.runs[index].sym = { ...run.sym };
|
|
34476
|
-
}
|
|
34477
|
-
});
|
|
34478
|
-
paragraph.style = paragraphStyle ? { ...paragraphStyle } : void 0;
|
|
34479
|
-
for (const run of paragraph.runs) {
|
|
34480
|
-
run.styles = normalizeImportedRunStyle(
|
|
34481
|
-
run.styles,
|
|
34482
|
-
(_a = paragraph.style) == null ? void 0 : _a.styleId
|
|
34483
|
-
);
|
|
34484
|
-
}
|
|
34485
|
-
paragraph.list = list ? { ...list } : void 0;
|
|
34486
|
-
return paragraph;
|
|
34487
|
-
}
|
|
34488
|
-
function splitRunsAtPageBreaks(runs) {
|
|
34489
|
-
const segments = [[]];
|
|
34490
|
-
let hasPageBreak = false;
|
|
34491
|
-
const appendRun = (run, text) => {
|
|
34492
|
-
if (text.length === 0 && !run.image && !run.textBox && !run.field && !run.fieldChar && run.fieldInstruction === void 0 && !run.bookmark && !run.comment) {
|
|
34493
|
-
return;
|
|
34494
|
-
}
|
|
34495
|
-
segments[segments.length - 1].push({
|
|
34496
|
-
...run,
|
|
34497
|
-
text
|
|
34498
|
-
});
|
|
34499
|
-
};
|
|
34500
|
-
for (const run of runs) {
|
|
34501
|
-
if (!run.text.includes(PAGE_BREAK_MARKER)) {
|
|
34502
|
-
appendRun(run, run.text);
|
|
34503
|
-
continue;
|
|
34504
|
-
}
|
|
34505
|
-
const parts = run.text.split(PAGE_BREAK_MARKER);
|
|
34506
|
-
parts.forEach((part, index) => {
|
|
34507
|
-
appendRun(run, part);
|
|
34508
|
-
if (index < parts.length - 1) {
|
|
34509
|
-
hasPageBreak = true;
|
|
34510
|
-
segments.push([]);
|
|
34511
|
-
}
|
|
34512
|
-
});
|
|
34513
|
-
}
|
|
34514
|
-
return { segments, hasPageBreak };
|
|
34515
|
-
}
|
|
34516
|
-
function paragraphHasVisibleContent(runs) {
|
|
34517
|
-
return runs.some(
|
|
34518
|
-
(run) => run.image || run.textBox || run.field || run.fieldChar || run.fieldInstruction !== void 0 || run.bookmark || run.comment || run.text.replace(/\s/g, "").length > 0
|
|
34519
|
-
);
|
|
34520
|
-
}
|
|
34521
|
-
async function parseParagraphNodes(paragraphNode, numberingMaps, zip, relsMap, assets, theme, inheritedStyle) {
|
|
34522
|
-
const paragraphProperties = getFirstChildByTagNameNS(
|
|
34523
|
-
paragraphNode,
|
|
34524
|
-
WORD_NS,
|
|
34525
|
-
"pPr"
|
|
34526
|
-
);
|
|
34527
|
-
const runs = await parseRunsContainer(
|
|
34528
|
-
paragraphNode,
|
|
34529
|
-
numberingMaps,
|
|
34530
|
-
zip,
|
|
34531
|
-
relsMap,
|
|
34532
|
-
assets,
|
|
34533
|
-
theme,
|
|
34534
|
-
void 0,
|
|
34535
|
-
(container) => parseTxbxContentBlocks(
|
|
34536
|
-
container,
|
|
34537
|
-
numberingMaps,
|
|
34538
|
-
zip,
|
|
34539
|
-
relsMap,
|
|
34540
|
-
assets,
|
|
34541
|
-
theme
|
|
34542
|
-
)
|
|
34543
|
-
);
|
|
34544
|
-
const parsedStyle = withDocxImplicitSingleLineHeight(
|
|
34545
|
-
parseParagraphStyle$1(paragraphProperties)
|
|
34546
|
-
);
|
|
34547
|
-
const markRunStyle = parseRunStyle(
|
|
34548
|
-
getFirstChildByTagNameNS(paragraphProperties, WORD_NS, "rPr"),
|
|
34549
|
-
theme
|
|
34550
|
-
);
|
|
34551
|
-
const listResult = parseParagraphList(paragraphProperties, numberingMaps);
|
|
34552
|
-
const list = listResult == null ? void 0 : listResult.list;
|
|
34553
|
-
let styleWithListIndent = parsedStyle;
|
|
34554
|
-
if (listResult == null ? void 0 : listResult.indent) {
|
|
34555
|
-
const { left, hanging } = listResult.indent;
|
|
34556
|
-
const base = parsedStyle ?? {};
|
|
34557
|
-
styleWithListIndent = {
|
|
34558
|
-
...base,
|
|
34559
|
-
...base.indentLeft === void 0 && left !== void 0 ? { indentLeft: left } : {},
|
|
34560
|
-
...base.indentHanging === void 0 && hanging !== void 0 ? { indentHanging: hanging } : {}
|
|
34561
|
-
};
|
|
34562
|
-
}
|
|
34563
|
-
const paragraphStyle = normalizeImportedParagraphStyle(
|
|
34564
|
-
inheritedStyle ? { ...inheritedStyle, ...styleWithListIndent ?? {} } : styleWithListIndent
|
|
34565
|
-
);
|
|
34566
|
-
const dropCapFrame = parseDropCapFrame(paragraphProperties, runs);
|
|
34567
|
-
if (dropCapFrame) {
|
|
34568
|
-
return { paragraphs: [], pageBreakAfter: false, dropCapFrame };
|
|
34569
|
-
}
|
|
34570
|
-
const { segments, hasPageBreak } = splitRunsAtPageBreaks(runs);
|
|
34571
|
-
if (!hasPageBreak) {
|
|
34572
|
-
return {
|
|
34573
|
-
paragraphs: [
|
|
34574
|
-
createImportedParagraph(runs, paragraphStyle, list, markRunStyle)
|
|
34575
|
-
],
|
|
34576
|
-
pageBreakAfter: false
|
|
34577
|
-
};
|
|
34578
|
-
}
|
|
34579
|
-
const paragraphs = [];
|
|
34580
|
-
let pendingPageBreakBefore = false;
|
|
34581
|
-
for (let index = 0; index < segments.length; index += 1) {
|
|
34582
|
-
const segment = segments[index];
|
|
34583
|
-
if (index > 0) {
|
|
34584
|
-
pendingPageBreakBefore = true;
|
|
34585
|
-
}
|
|
34586
|
-
if (!paragraphHasVisibleContent(segment)) {
|
|
34587
|
-
continue;
|
|
34588
|
-
}
|
|
34589
|
-
const style2 = pendingPageBreakBefore ? { ...paragraphStyle ?? {}, pageBreakBefore: true } : paragraphStyle;
|
|
34590
|
-
paragraphs.push(
|
|
34591
|
-
createImportedParagraph(segment, style2, list, markRunStyle)
|
|
34592
|
-
);
|
|
34593
|
-
pendingPageBreakBefore = false;
|
|
34594
|
-
}
|
|
34595
|
-
return {
|
|
34596
|
-
paragraphs,
|
|
34597
|
-
pageBreakAfter: pendingPageBreakBefore
|
|
34598
|
-
};
|
|
34599
|
-
}
|
|
34600
|
-
async function parseParagraphNode(paragraphNode, numberingMaps, zip, relsMap, assets, theme, inheritedStyle) {
|
|
34601
|
-
const parsed = await parseParagraphNodes(
|
|
34602
|
-
paragraphNode,
|
|
34603
|
-
numberingMaps,
|
|
34604
|
-
zip,
|
|
34605
|
-
relsMap,
|
|
34606
|
-
assets,
|
|
34607
|
-
theme,
|
|
34608
|
-
inheritedStyle
|
|
34609
|
-
);
|
|
34610
|
-
return parsed.paragraphs[0] ?? createEditorParagraphFromRuns([{ text: "" }]);
|
|
34611
|
-
}
|
|
34612
34626
|
async function parseHeaderFooterXml(xmlContent, numberingMaps, zip, relsMap, assets, theme, styles) {
|
|
34613
34627
|
if (!xmlContent) {
|
|
34614
34628
|
return [];
|
|
@@ -34618,6 +34632,13 @@ async function parseHeaderFooterXml(xmlContent, numberingMaps, zip, relsMap, ass
|
|
|
34618
34632
|
if (!root) {
|
|
34619
34633
|
return [];
|
|
34620
34634
|
}
|
|
34635
|
+
const parseNestedBlocks = createNestedBlockParser(
|
|
34636
|
+
numberingMaps,
|
|
34637
|
+
zip,
|
|
34638
|
+
relsMap,
|
|
34639
|
+
assets,
|
|
34640
|
+
theme
|
|
34641
|
+
);
|
|
34621
34642
|
const blocks = [];
|
|
34622
34643
|
for (let index = 0; index < root.childNodes.length; index += 1) {
|
|
34623
34644
|
const node = root.childNodes[index];
|
|
@@ -34633,7 +34654,8 @@ async function parseHeaderFooterXml(xmlContent, numberingMaps, zip, relsMap, ass
|
|
|
34633
34654
|
zip,
|
|
34634
34655
|
relsMap,
|
|
34635
34656
|
assets,
|
|
34636
|
-
theme
|
|
34657
|
+
theme,
|
|
34658
|
+
parseNestedBlocks
|
|
34637
34659
|
)
|
|
34638
34660
|
);
|
|
34639
34661
|
} else if (element.localName === "tbl" && element.namespaceURI === WORD_NS) {
|
|
@@ -34645,6 +34667,7 @@ async function parseHeaderFooterXml(xmlContent, numberingMaps, zip, relsMap, ass
|
|
|
34645
34667
|
relsMap,
|
|
34646
34668
|
assets,
|
|
34647
34669
|
theme,
|
|
34670
|
+
parseNestedBlocks,
|
|
34648
34671
|
styles
|
|
34649
34672
|
)
|
|
34650
34673
|
);
|
|
@@ -34676,6 +34699,13 @@ async function parseFootnotesXml(xmlContent, numberingMaps, zip, relsMap, assets
|
|
|
34676
34699
|
let continuationSeparator;
|
|
34677
34700
|
const footnoteElements = getChildrenByTagNameNS(root, WORD_NS, "footnote");
|
|
34678
34701
|
let counter2 = 0;
|
|
34702
|
+
const parseNestedBlocks = createNestedBlockParser(
|
|
34703
|
+
numberingMaps,
|
|
34704
|
+
zip,
|
|
34705
|
+
relsMap,
|
|
34706
|
+
assets,
|
|
34707
|
+
theme
|
|
34708
|
+
);
|
|
34679
34709
|
for (const footnoteEl of footnoteElements) {
|
|
34680
34710
|
const idAttr = getAttributeValue(footnoteEl, "id") ?? "";
|
|
34681
34711
|
const type = getAttributeValue(footnoteEl, "type") ?? "";
|
|
@@ -34693,7 +34723,8 @@ async function parseFootnotesXml(xmlContent, numberingMaps, zip, relsMap, assets
|
|
|
34693
34723
|
zip,
|
|
34694
34724
|
relsMap,
|
|
34695
34725
|
assets,
|
|
34696
|
-
theme
|
|
34726
|
+
theme,
|
|
34727
|
+
parseNestedBlocks
|
|
34697
34728
|
)
|
|
34698
34729
|
);
|
|
34699
34730
|
} else if (element.localName === "tbl") {
|
|
@@ -34705,6 +34736,7 @@ async function parseFootnotesXml(xmlContent, numberingMaps, zip, relsMap, assets
|
|
|
34705
34736
|
relsMap,
|
|
34706
34737
|
assets,
|
|
34707
34738
|
theme,
|
|
34739
|
+
parseNestedBlocks,
|
|
34708
34740
|
styles
|
|
34709
34741
|
)
|
|
34710
34742
|
);
|
|
@@ -34766,6 +34798,13 @@ async function parseEndnotesXml(xmlContent, numberingMaps, zip, relsMap, assets,
|
|
|
34766
34798
|
let continuationSeparator;
|
|
34767
34799
|
const endnoteElements = getChildrenByTagNameNS(root, WORD_NS, "endnote");
|
|
34768
34800
|
let counter2 = 0;
|
|
34801
|
+
const parseNestedBlocks = createNestedBlockParser(
|
|
34802
|
+
numberingMaps,
|
|
34803
|
+
zip,
|
|
34804
|
+
relsMap,
|
|
34805
|
+
assets,
|
|
34806
|
+
theme
|
|
34807
|
+
);
|
|
34769
34808
|
for (const endnoteEl of endnoteElements) {
|
|
34770
34809
|
const idAttr = getAttributeValue(endnoteEl, "id") ?? "";
|
|
34771
34810
|
const type = getAttributeValue(endnoteEl, "type") ?? "";
|
|
@@ -34783,7 +34822,8 @@ async function parseEndnotesXml(xmlContent, numberingMaps, zip, relsMap, assets,
|
|
|
34783
34822
|
zip,
|
|
34784
34823
|
relsMap,
|
|
34785
34824
|
assets,
|
|
34786
|
-
theme
|
|
34825
|
+
theme,
|
|
34826
|
+
parseNestedBlocks
|
|
34787
34827
|
)
|
|
34788
34828
|
);
|
|
34789
34829
|
} else if (element.localName === "tbl") {
|
|
@@ -34795,6 +34835,7 @@ async function parseEndnotesXml(xmlContent, numberingMaps, zip, relsMap, assets,
|
|
|
34795
34835
|
relsMap,
|
|
34796
34836
|
assets,
|
|
34797
34837
|
theme,
|
|
34838
|
+
parseNestedBlocks,
|
|
34798
34839
|
styles
|
|
34799
34840
|
)
|
|
34800
34841
|
);
|
|
@@ -35153,6 +35194,13 @@ async function importDocxToEditorDocument(buffer, options = {}) {
|
|
|
35153
35194
|
);
|
|
35154
35195
|
}
|
|
35155
35196
|
};
|
|
35197
|
+
const parseNestedBlocks = createNestedBlockParser(
|
|
35198
|
+
numberingMaps,
|
|
35199
|
+
zip,
|
|
35200
|
+
relsMap,
|
|
35201
|
+
assets,
|
|
35202
|
+
theme
|
|
35203
|
+
);
|
|
35156
35204
|
for (let index = 0; index < body.childNodes.length; index += 1) {
|
|
35157
35205
|
const node = body.childNodes[index];
|
|
35158
35206
|
if ((node == null ? void 0 : node.nodeType) !== node.ELEMENT_NODE) {
|
|
@@ -35173,7 +35221,8 @@ async function importDocxToEditorDocument(buffer, options = {}) {
|
|
|
35173
35221
|
zip,
|
|
35174
35222
|
relsMap,
|
|
35175
35223
|
assets,
|
|
35176
|
-
theme
|
|
35224
|
+
theme,
|
|
35225
|
+
parseNestedBlocks
|
|
35177
35226
|
);
|
|
35178
35227
|
for (const paragraph of parsedParagraph.paragraphs) {
|
|
35179
35228
|
appendBodyBlock(paragraph);
|
|
@@ -35194,6 +35243,7 @@ async function importDocxToEditorDocument(buffer, options = {}) {
|
|
|
35194
35243
|
relsMap,
|
|
35195
35244
|
assets,
|
|
35196
35245
|
theme,
|
|
35246
|
+
parseNestedBlocks,
|
|
35197
35247
|
importedStyles
|
|
35198
35248
|
)
|
|
35199
35249
|
);
|
|
@@ -35539,7 +35589,7 @@ function importDocxInWorker(buffer, options = {}) {
|
|
|
35539
35589
|
const worker = new Worker(
|
|
35540
35590
|
new URL(
|
|
35541
35591
|
/* @vite-ignore */
|
|
35542
|
-
"" + new URL("assets/importDocxWorker-
|
|
35592
|
+
"" + new URL("assets/importDocxWorker-CMMv6C-7.js", import.meta.url).href,
|
|
35543
35593
|
import.meta.url
|
|
35544
35594
|
),
|
|
35545
35595
|
{
|
|
@@ -39876,7 +39926,7 @@ const OASIS_MENU_ITEMS = {
|
|
|
39876
39926
|
formatListsNumbered: "format_lists_numbered"
|
|
39877
39927
|
};
|
|
39878
39928
|
export {
|
|
39879
|
-
|
|
39929
|
+
resolveFloatingObjectRect as $,
|
|
39880
39930
|
createFootnoteReferenceRun as A,
|
|
39881
39931
|
renumberFootnotes as B,
|
|
39882
39932
|
iterateFootnoteReferenceRuns as C,
|
|
@@ -39906,16 +39956,16 @@ export {
|
|
|
39906
39956
|
pxToPt as _,
|
|
39907
39957
|
getParagraphLength as a,
|
|
39908
39958
|
getParagraphRectFromSnapshot as a$,
|
|
39909
|
-
|
|
39910
|
-
|
|
39911
|
-
|
|
39912
|
-
|
|
39913
|
-
|
|
39914
|
-
|
|
39915
|
-
|
|
39916
|
-
|
|
39917
|
-
|
|
39918
|
-
|
|
39959
|
+
getTextBoxFloatingGeometry as a0,
|
|
39960
|
+
getPresetPathSegments as a1,
|
|
39961
|
+
projectBlocksLayout as a2,
|
|
39962
|
+
buildListLabels as a3,
|
|
39963
|
+
textStyleToFontSizePt as a4,
|
|
39964
|
+
PX_PER_POINT$2 as a5,
|
|
39965
|
+
DEFAULT_FONT_SIZE_PX as a6,
|
|
39966
|
+
isDoubleUnderlineStyle as a7,
|
|
39967
|
+
isWavyUnderlineStyle as a8,
|
|
39968
|
+
underlineStyleLineWidthPx as a9,
|
|
39919
39969
|
fontSizePxToPt as aA,
|
|
39920
39970
|
probeLocalFontFamilies as aB,
|
|
39921
39971
|
createInitialEditorState as aC,
|
|
@@ -39943,13 +39993,13 @@ export {
|
|
|
39943
39993
|
DocumentShell as aY,
|
|
39944
39994
|
createMemo as aZ,
|
|
39945
39995
|
getCaretRectFromSnapshot as a_,
|
|
39946
|
-
|
|
39947
|
-
|
|
39948
|
-
|
|
39949
|
-
|
|
39950
|
-
|
|
39951
|
-
|
|
39952
|
-
|
|
39996
|
+
underlineStyleDashArray as aa,
|
|
39997
|
+
resolveListLabel as ab,
|
|
39998
|
+
getListLabelInset as ac,
|
|
39999
|
+
getAlignedListLabelInset as ad,
|
|
40000
|
+
getParagraphBorderInsets as ae,
|
|
40001
|
+
buildSegmentTable as af,
|
|
40002
|
+
buildCanvasTableLayout as ag,
|
|
39953
40003
|
normalizeFamily as ah,
|
|
39954
40004
|
ROBOTO_FONT_FILES as ai,
|
|
39955
40005
|
loadFontAsset as aj,
|
package/dist/oasis-editor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { aX, bP, bQ, bR, bS, bT, bd, bU, aY, aT, bV, bW, bX, aW, bY, aR, bZ, b_, b$, c0, c1, bJ, c2, c3, c4, c5, c6, c7, c8, c9, ca, cb, cc, bi, cd, bI, ce, bR as bR2, bW as bW2, bY as bY2, c5 as c52, c7 as c72, cc as cc2, cf, aV, aQ, cg, ch, ci, aS, cj, ck, aU } from "./index-
|
|
1
|
+
import { aX, bP, bQ, bR, bS, bT, bd, bU, aY, aT, bV, bW, bX, aW, bY, aR, bZ, b_, b$, c0, c1, bJ, c2, c3, c4, c5, c6, c7, c8, c9, ca, cb, cc, bi, cd, bI, ce, bR as bR2, bW as bW2, bY as bY2, c5 as c52, c7 as c72, cc as cc2, cf, aV, aQ, cg, ch, ci, aS, cj, ck, aU } from "./index-lzzJKBU1.js";
|
|
2
2
|
export {
|
|
3
3
|
aX as BalloonShell,
|
|
4
4
|
bP as Button,
|