oasis-editor 0.0.166 → 0.0.168
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-C1GkmD_B.js → OasisEditorApp-CUrnWD1d.js} +1 -1
- package/dist/assets/{importDocxWorker-C5IkKe2t.js → importDocxWorker-CJWh6Ie7.js} +1 -1
- package/dist/core/model/index.d.ts +1 -1
- package/dist/core/model/types/document.d.ts +15 -2
- package/dist/import/docx/sectionProperties.d.ts +2 -1
- package/dist/{index-BvpHK9s2.js → index-Dq6Yxrd4.js} +76 -5
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +4 -4
- package/package.json +1 -1
|
@@ -18,7 +18,7 @@ export type { EditorEndnote } from './types/documentEndnotes.js';
|
|
|
18
18
|
export type { EditorBookmark, EditorBookmarkAnchor, EditorBookmarks, } from './types/documentBookmarks.js';
|
|
19
19
|
export type { EditorComment, EditorCommentAnchor, EditorComments, } from './types/documentComments.js';
|
|
20
20
|
export type { EditorOpcPartKind, EditorOpcPartEncoding, EditorOpcRelationship, EditorOpcContentTypes, EditorOpcPart, EditorDocxDiagnostic, EditorDocxSourcePackage, } from './types/docxSourcePackage.js';
|
|
21
|
-
export type { EditorPageMargins, EditorPageSettings, EditorColumnsSettings, EditorSection, EditorPageNumbering, EditorSectionVerticalAlign, EditorFontInfo, EditorFootnoteSettings, EditorFootnotes, EditorEndnoteSettings, EditorEndnotes, EditorDocumentDesign, EditorThemeData, EditorWatermark, EditorPageBorder, EditorDocument, } from './types/document.js';
|
|
21
|
+
export type { EditorPageMargins, EditorPageSettings, EditorColumnsSettings, EditorSection, EditorSectionBreakType, EditorSectionPropertiesSnapshot, EditorPageNumbering, EditorSectionVerticalAlign, EditorFontInfo, EditorFootnoteSettings, EditorFootnotes, EditorEndnoteSettings, EditorEndnotes, EditorDocumentDesign, EditorThemeData, EditorWatermark, EditorPageBorder, EditorDocument, } from './types/document.js';
|
|
22
22
|
export type { EditorPosition, EditorSelection, EditorEditingZone, } from './types/selection.js';
|
|
23
23
|
export type { EditorCaretSlot, EditorLayoutFragmentChar, EditorLayoutFragment, EditorLayoutLine, EditorLayoutParagraph, EditorLayoutBlock, TableCellBlockPosition, EditorLayoutPage, EditorLayoutDocument, } from './types/layout.js';
|
|
24
24
|
export type { EditorState } from './editorState.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EditorAsset, EditorFootnoteNumberFormat, EditorFootnoteRestart } from './primitives.js';
|
|
1
|
+
import { EditorAsset, EditorFootnoteNumberFormat, EditorFootnoteRestart, EditorPropertyRevision } from './primitives.js';
|
|
2
2
|
import { EditorBlockNode } from './nodes.js';
|
|
3
3
|
import { EditorFootnote } from './documentFootnotes.js';
|
|
4
4
|
import { EditorEndnote } from './documentEndnotes.js';
|
|
@@ -105,6 +105,17 @@ export interface EditorPageNumbering {
|
|
|
105
105
|
* `top` is the Word default and is omitted on export.
|
|
106
106
|
*/
|
|
107
107
|
export type EditorSectionVerticalAlign = "top" | "center" | "both" | "bottom";
|
|
108
|
+
export type EditorSectionBreakType = "nextPage" | "continuous" | "evenPage" | "oddPage" | "nextColumn";
|
|
109
|
+
/** Previous semantic section properties stored by `w:sectPrChange`. */
|
|
110
|
+
export interface EditorSectionPropertiesSnapshot {
|
|
111
|
+
pageSettings: EditorPageSettings;
|
|
112
|
+
pageBorder?: EditorPageBorder | null;
|
|
113
|
+
pageNumbering?: EditorPageNumbering;
|
|
114
|
+
verticalAlignment?: EditorSectionVerticalAlign;
|
|
115
|
+
bidi?: boolean;
|
|
116
|
+
/** Previous `w:type`; semantically this controls how the following section begins. */
|
|
117
|
+
nextBreakType?: EditorSectionBreakType;
|
|
118
|
+
}
|
|
108
119
|
export interface EditorSection {
|
|
109
120
|
id: string;
|
|
110
121
|
blocks: EditorBlockNode[];
|
|
@@ -124,13 +135,15 @@ export interface EditorSection {
|
|
|
124
135
|
* is omitted on export. Only `continuous` currently affects layout rendering;
|
|
125
136
|
* `evenPage`/`oddPage`/`nextColumn` are preserved for round-trip.
|
|
126
137
|
*/
|
|
127
|
-
breakType?:
|
|
138
|
+
breakType?: EditorSectionBreakType;
|
|
128
139
|
/** `w:pgNumType` — page numbering format/start/chapter. Round-trip only. */
|
|
129
140
|
pageNumbering?: EditorPageNumbering;
|
|
130
141
|
/** `w:vAlign` — vertical justification of page contents. Round-trip only. */
|
|
131
142
|
verticalAlignment?: EditorSectionVerticalAlign;
|
|
132
143
|
/** `w:bidi` — right-to-left section layout. Round-trip only. */
|
|
133
144
|
bidi?: boolean;
|
|
145
|
+
/** Previous section-property snapshot from `w:sectPrChange`. */
|
|
146
|
+
propertyRevision?: EditorPropertyRevision<EditorSectionPropertiesSnapshot>;
|
|
134
147
|
}
|
|
135
148
|
/**
|
|
136
149
|
* One `w:font` entry from `word/fontTable.xml`: the document's declaration of a
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Element as XmlElement } from '@xmldom/xmldom';
|
|
2
|
-
import { EditorBlockNode, EditorNamedStyle, EditorPageNumbering, EditorPageSettings, EditorPageBorder, EditorParagraphNode, EditorSectionVerticalAlign } from '../../core/model.js';
|
|
2
|
+
import { EditorBlockNode, EditorNamedStyle, EditorPageNumbering, EditorPageSettings, EditorPageBorder, EditorParagraphNode, EditorSectionVerticalAlign, EditorSectionPropertiesSnapshot, EditorPropertyRevision } from '../../core/model.js';
|
|
3
3
|
import { DocxSettings } from './settings.js';
|
|
4
4
|
|
|
5
5
|
export interface SectionProperties {
|
|
@@ -22,6 +22,7 @@ export interface SectionProperties {
|
|
|
22
22
|
verticalAlignment?: EditorSectionVerticalAlign;
|
|
23
23
|
/** `w:bidi` — right-to-left section layout. Round-trip only. */
|
|
24
24
|
bidi?: boolean;
|
|
25
|
+
propertyRevision?: EditorPropertyRevision<EditorSectionPropertiesSnapshot>;
|
|
25
26
|
}
|
|
26
27
|
export declare function parseSectionProperties(sectPr: XmlElement): SectionProperties;
|
|
27
28
|
export declare function parsePageSettings(body: XmlElement | undefined): EditorPageSettings | undefined;
|
|
@@ -2863,7 +2863,7 @@ function OasisEditorAppLazy(props = {}) {
|
|
|
2863
2863
|
onCleanup(() => {
|
|
2864
2864
|
cancelled = true;
|
|
2865
2865
|
});
|
|
2866
|
-
import("./OasisEditorApp-
|
|
2866
|
+
import("./OasisEditorApp-CUrnWD1d.js").then((m) => {
|
|
2867
2867
|
cancelled = true;
|
|
2868
2868
|
setProgress(1);
|
|
2869
2869
|
setTimeout(() => setApp(() => m.OasisEditorApp), 180);
|
|
@@ -38582,6 +38582,30 @@ function parseFontTable(xml) {
|
|
|
38582
38582
|
}
|
|
38583
38583
|
return fonts.length > 0 ? fonts : void 0;
|
|
38584
38584
|
}
|
|
38585
|
+
const DEFAULT_SECTION_PAGE_SETTINGS = {
|
|
38586
|
+
width: 816,
|
|
38587
|
+
height: 1056,
|
|
38588
|
+
orientation: "portrait",
|
|
38589
|
+
margins: {
|
|
38590
|
+
top: 96,
|
|
38591
|
+
right: 96,
|
|
38592
|
+
bottom: 96,
|
|
38593
|
+
left: 96,
|
|
38594
|
+
header: 48,
|
|
38595
|
+
footer: 48,
|
|
38596
|
+
gutter: 0
|
|
38597
|
+
}
|
|
38598
|
+
};
|
|
38599
|
+
function sectionPropertiesSnapshot(properties, fallbackPageSettings) {
|
|
38600
|
+
return {
|
|
38601
|
+
pageSettings: properties.pageSettings ?? fallbackPageSettings ?? DEFAULT_SECTION_PAGE_SETTINGS,
|
|
38602
|
+
...properties.pageBorder ? { pageBorder: properties.pageBorder } : {},
|
|
38603
|
+
...properties.pageNumbering ? { pageNumbering: properties.pageNumbering } : {},
|
|
38604
|
+
...properties.verticalAlignment ? { verticalAlignment: properties.verticalAlignment } : {},
|
|
38605
|
+
...properties.bidi !== void 0 ? { bidi: properties.bidi } : {},
|
|
38606
|
+
...properties.breakType ? { nextBreakType: properties.breakType } : {}
|
|
38607
|
+
};
|
|
38608
|
+
}
|
|
38585
38609
|
function isXmlTrue(value2) {
|
|
38586
38610
|
return value2 === "1" || value2 === "true" || value2 === "on";
|
|
38587
38611
|
}
|
|
@@ -38696,6 +38720,25 @@ function parseSectionProperties(sectPr) {
|
|
|
38696
38720
|
const vAlignValue = getAttributeValue(vAlignElement, "val");
|
|
38697
38721
|
const verticalAlignment = vAlignValue === "center" || vAlignValue === "both" || vAlignValue === "bottom" ? vAlignValue : void 0;
|
|
38698
38722
|
const bidi = parseOnOffProperty(sectPr, "bidi");
|
|
38723
|
+
const propertyChange = getFirstChildByTagNameNS(
|
|
38724
|
+
sectPr,
|
|
38725
|
+
WORD_NS$3,
|
|
38726
|
+
"sectPrChange"
|
|
38727
|
+
);
|
|
38728
|
+
const revisionMetadata = parseRevisionMetadata$1(propertyChange);
|
|
38729
|
+
const previousSectPr = getFirstChildByTagNameNS(
|
|
38730
|
+
propertyChange,
|
|
38731
|
+
WORD_NS$3,
|
|
38732
|
+
"sectPr"
|
|
38733
|
+
);
|
|
38734
|
+
const propertyRevision = revisionMetadata && previousSectPr ? {
|
|
38735
|
+
...revisionMetadata,
|
|
38736
|
+
type: "property",
|
|
38737
|
+
previous: sectionPropertiesSnapshot(
|
|
38738
|
+
parseSectionProperties(previousSectPr),
|
|
38739
|
+
pageSettings
|
|
38740
|
+
)
|
|
38741
|
+
} : void 0;
|
|
38699
38742
|
return {
|
|
38700
38743
|
pageSettings,
|
|
38701
38744
|
...pageBorder ? { pageBorder } : {},
|
|
@@ -38712,7 +38755,8 @@ function parseSectionProperties(sectPr) {
|
|
|
38712
38755
|
breakType,
|
|
38713
38756
|
pageNumbering,
|
|
38714
38757
|
verticalAlignment,
|
|
38715
|
-
bidi
|
|
38758
|
+
bidi,
|
|
38759
|
+
propertyRevision
|
|
38716
38760
|
};
|
|
38717
38761
|
}
|
|
38718
38762
|
function parsePageSettings(body) {
|
|
@@ -42009,6 +42053,15 @@ async function importDocxToEditorDocument(buffer, options = {}) {
|
|
|
42009
42053
|
const pageNumbering = props.pageNumbering;
|
|
42010
42054
|
const verticalAlignment = props.verticalAlignment;
|
|
42011
42055
|
const bidi = props.bidi;
|
|
42056
|
+
const propertyRevision = props.propertyRevision ? {
|
|
42057
|
+
...props.propertyRevision,
|
|
42058
|
+
previous: {
|
|
42059
|
+
...props.propertyRevision.previous,
|
|
42060
|
+
pageSettings: normalizePageSettings(
|
|
42061
|
+
props.propertyRevision.previous.pageSettings
|
|
42062
|
+
)
|
|
42063
|
+
}
|
|
42064
|
+
} : void 0;
|
|
42012
42065
|
sections.push({
|
|
42013
42066
|
id: `section:${i + 1}`,
|
|
42014
42067
|
blocks: blocks.length > 0 ? blocks : [createEditorParagraphFromRuns([{ text: "" }])],
|
|
@@ -42023,7 +42076,8 @@ async function importDocxToEditorDocument(buffer, options = {}) {
|
|
|
42023
42076
|
...breakType ? { breakType } : {},
|
|
42024
42077
|
...pageNumbering ? { pageNumbering } : {},
|
|
42025
42078
|
...verticalAlignment ? { verticalAlignment } : {},
|
|
42026
|
-
...bidi ? { bidi } : {}
|
|
42079
|
+
...bidi ? { bidi } : {},
|
|
42080
|
+
...propertyRevision ? { propertyRevision } : {}
|
|
42027
42081
|
});
|
|
42028
42082
|
}
|
|
42029
42083
|
const footnotesXml = await ((_l = zip.file("word/footnotes.xml")) == null ? void 0 : _l.async("string")) ?? null;
|
|
@@ -46751,6 +46805,17 @@ function buildNumberingXml(definitions) {
|
|
|
46751
46805
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:numbering xmlns:w="${WORD_NS$1}">${abstractNums}${nums}</w:numbering>`;
|
|
46752
46806
|
}
|
|
46753
46807
|
const DOCUMENT_XMLNS = `xmlns:w="${WORD_NS$1}" xmlns:w14="${WORD14_NS}" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:r="${OFFICE_REL_NS}"`;
|
|
46808
|
+
function sectionFromSnapshot(snapshot) {
|
|
46809
|
+
return {
|
|
46810
|
+
id: "section:revision",
|
|
46811
|
+
blocks: [],
|
|
46812
|
+
pageSettings: snapshot.pageSettings,
|
|
46813
|
+
...snapshot.pageBorder !== void 0 ? { pageBorder: snapshot.pageBorder } : {},
|
|
46814
|
+
...snapshot.pageNumbering ? { pageNumbering: snapshot.pageNumbering } : {},
|
|
46815
|
+
...snapshot.verticalAlignment ? { verticalAlignment: snapshot.verticalAlignment } : {},
|
|
46816
|
+
...snapshot.bidi !== void 0 ? { bidi: snapshot.bidi } : {}
|
|
46817
|
+
};
|
|
46818
|
+
}
|
|
46754
46819
|
function serializeSectionPropertiesWithReferences(pageSettings, references, section, nextBreakType) {
|
|
46755
46820
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
|
|
46756
46821
|
const width = pxToTwips(pageSettings.width, 12240);
|
|
@@ -46800,7 +46865,13 @@ function serializeSectionPropertiesWithReferences(pageSettings, references, sect
|
|
|
46800
46865
|
const border = section.pageBorder;
|
|
46801
46866
|
const borderColor = border == null ? void 0 : border.color.replace("#", "").toUpperCase();
|
|
46802
46867
|
const borderXml = border ? `<w:pgBorders w:offsetFrom="page"><w:top w:val="${border.style}" w:sz="${Math.max(1, Math.round(border.width * 8))}" w:space="${Math.max(0, Math.round(border.distance ?? 0))}" w:color="${borderColor}"/><w:left w:val="${border.style}" w:sz="${Math.max(1, Math.round(border.width * 8))}" w:space="${Math.max(0, Math.round(border.distance ?? 0))}" w:color="${borderColor}"/><w:bottom w:val="${border.style}" w:sz="${Math.max(1, Math.round(border.width * 8))}" w:space="${Math.max(0, Math.round(border.distance ?? 0))}" w:color="${borderColor}"/><w:right w:val="${border.style}" w:sz="${Math.max(1, Math.round(border.width * 8))}" w:space="${Math.max(0, Math.round(border.distance ?? 0))}" w:color="${borderColor}"/></w:pgBorders>` : "";
|
|
46803
|
-
|
|
46868
|
+
const propertyRevisionXml = section.propertyRevision ? `<w:sectPrChange ${serializeRevisionMetadataAttributes(section.propertyRevision)}>${serializeSectionPropertiesWithReferences(
|
|
46869
|
+
section.propertyRevision.previous.pageSettings,
|
|
46870
|
+
void 0,
|
|
46871
|
+
sectionFromSnapshot(section.propertyRevision.previous),
|
|
46872
|
+
section.propertyRevision.previous.nextBreakType
|
|
46873
|
+
)}</w:sectPrChange>` : "";
|
|
46874
|
+
return `<w:sectPr>${referencesXml}${titlePageXml}${typeXml}<w:pgSz w:w="${width}" w:h="${height}"${orientationAttr}/><w:pgMar w:top="${pxToTwips(margins.top, 1440)}" w:right="${pxToTwips(margins.right, 1440)}" w:bottom="${pxToTwips(margins.bottom, 1440)}" w:left="${pxToTwips(margins.left, 1440)}" w:header="${pxToTwips(margins.header, 720)}" w:footer="${pxToTwips(margins.footer, 720)}" w:gutter="${pxToTwips(margins.gutter, 0)}"/>${pgNumTypeXml}${columnsXml}${vAlignXml}${bidiXml}${borderXml}${propertyRevisionXml}</w:sectPr>`;
|
|
46804
46875
|
}
|
|
46805
46876
|
function buildDocumentXml(document2, context2, sectionReferences) {
|
|
46806
46877
|
var _a2, _b2;
|
|
@@ -47893,7 +47964,7 @@ async function importDocxInWorker(buffer, options = {}) {
|
|
|
47893
47964
|
const worker = new Worker(
|
|
47894
47965
|
new URL(
|
|
47895
47966
|
/* @vite-ignore */
|
|
47896
|
-
"" + new URL("assets/importDocxWorker-
|
|
47967
|
+
"" + new URL("assets/importDocxWorker-CJWh6Ie7.js", import.meta.url).href,
|
|
47897
47968
|
import.meta.url
|
|
47898
47969
|
),
|
|
47899
47970
|
{
|
package/dist/oasis-editor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dK, ah, aw, aM, aG, dL, dM, dN, aA, dO, ai, dP, dt, aN, dQ, dR, aL, aD, dS, dT, dU, ag, dV, dr, aP, dW, dX, dY, dZ, d_, dF, d$, e0, e1, aU, aT, e2, aE, e3, e4, e5, e6, e7, e8, aI, aF, e9, b3, aO, b2, aV, az, aK, dE, ea, dL as dL2, dS as dS2, dV as dV2, e2 as e22, e3 as e32, e8 as e82, eb, ec, dv, dq, ed, ee, ef, eg, eh, ei, ej, ds, ek, el, em, du, en } from "./index-
|
|
1
|
+
import { dK, ah, aw, aM, aG, dL, dM, dN, aA, dO, ai, dP, dt, aN, dQ, dR, aL, aD, dS, dT, dU, ag, dV, dr, aP, dW, dX, dY, dZ, d_, dF, d$, e0, e1, aU, aT, e2, aE, e3, e4, e5, e6, e7, e8, aI, aF, e9, b3, aO, b2, aV, az, aK, dE, ea, dL as dL2, dS as dS2, dV as dV2, e2 as e22, e3 as e32, e8 as e82, eb, ec, dv, dq, ed, ee, ef, eg, eh, ei, ej, ds, ek, el, em, du, en } from "./index-Dq6Yxrd4.js";
|
|
2
2
|
export {
|
|
3
3
|
dK as ActionRow,
|
|
4
4
|
ah as BalloonShell,
|