oasis-editor 0.0.51 → 0.0.52
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-eGw3ren4.js → OasisEditorApp-2ji5OaBy.js} +65 -65
- package/dist/export/docx/docxBlockVisitor.d.ts +10 -0
- package/dist/export/docx/docxNumbering.d.ts +10 -0
- package/dist/{index-UmNr3ynm.js → index-BMJs8egS.js} +1 -1
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { n as normalizeSelection, g as getParagraphs, c as createEditorParagraphFromRuns, a as getParagraphLength, b as createEditorRun, d as getDocumentSections, e as createEditorStyledRun, f as getParagraphText, h as getActiveZone, i as getActiveSectionIndex, p as positionToParagraphOffset, j as paragraphOffsetToPosition, k as clampPosition, l as findParagraphIndex, m as createCollapsedSelection, o as isSelectionCollapsed, E as EMU_PER_PX, q as createEditorParagraph, r as getBlockParagraphs, s as createEditorFootnote, t as createFootnoteReferenceRun, u as renumberFootnotes, v as iterateFootnoteReferenceRuns, w as getFootnoteDisplayMarker, x as findParagraphTableLocation, y as buildTableCellLayout, z as createSignal, A as createEffect, B as onCleanup, C as buildCanvasLayoutSnapshot, D as on, F as onMount, G as debounce, H as unwrap, I as getDocumentParagraphs, P as PT_PER_PX, J as createEditorTableCell, K as createEditorTableRow, L as createEditorTable, M as getDocumentSectionsCanonical, N as createEditorDocument, O as getPageContentWidth, Q as getDocumentPageSettings, R as getTableCellContentWidthForParagraph, S as resolveResizedDimensions, T as resolveImageSrc, U as resolveTextBoxRenderHeight, V as TWIPS_PER_POINT, W as PX_PER_INCH, X as TWIPS_PER_INCH, Y as resolveEffectiveParagraphStyle, Z as resolveEffectiveTextStyleForParagraph, _ as EMU_PER_PT, $ as iterateEndnoteReferenceRuns, a0 as imageContentTypeDefaults, a1 as JSZip, a2 as imageExtensionFromMime, a3 as pxToPt$1, a4 as resolveFloatingObjectRect, a5 as getTextBoxFloatingGeometry, a6 as getPresetPathSegments, a7 as projectBlocksLayout, a8 as buildListLabels, a9 as textStyleToFontSizePt, aa as PX_PER_POINT, ab as DEFAULT_FONT_SIZE_PX, ac as isDoubleUnderlineStyle, ad as isWavyUnderlineStyle, ae as underlineStyleLineWidthPx, af as underlineStyleDashArray, ag as resolveListLabel, ah as getListLabelInset, ai as getAlignedListLabelInset, aj as getParagraphBorderInsets, ak as buildSegmentTable, al as buildCanvasTableLayout, am as normalizeFamily, an as ROBOTO_FONT_FILES, ao as loadFontAsset, ap as OFFICE_COMPAT_FONT_FAMILIES, aq as buildSfnt, ar as defaultFontDecoderRegistry, as as SfntFontProgram, at as collectPdfFontFamilies, au as projectDocumentLayout, av as getPageHeaderZoneTop, aw as getPageBodyTop, ax as getPageColumnRects, ay as findFootnoteReference, az as FOOTNOTE_MARKER_GUTTER_PX, aA as resolveImporterForFile, aB as createEditorStateFromDocument, aC as getDocumentParagraphsCanonical, aD as getToolbarStyleState, aE as STANDARD_FONT_SIZES_PT, aF as fontSizePxToPt, aG as probeLocalFontFamilies, aH as createInitialEditorState, aI as parseFontSizePtToPx, aJ as formatFontSizePt, aK as underlineStyleToCssDecorationStyle, aL as listKindForTag, aM as isParagraphTag, aN as collectInlineRuns, aO as parseParagraphStyle, aP as getCachedCanvasImage, aQ as getHeadingLevel, aR as preciseFontModeVersion, aS as isPreciseFontModeEnabled, aT as togglePreciseFontMode, aU as nextFontSizePt, aV as previousFontSizePt, aW as fontSizePtToPx, aX as createDefaultToolbarPreset, aY as MenuRegistry, aZ as createToolbarRegistry, a_ as Editor, a$ as resolveCommandRef, b0 as commandRefName, b1 as InlineShell, b2 as BalloonShell, b3 as DocumentShell, b4 as createMemo, b5 as getCaretRectFromSnapshot, b6 as getParagraphRectFromSnapshot, b7 as createComponent, b8 as CaretOverlay, b9 as Show, ba as createRenderEffect, bb as style, bc as setAttribute, bd as setStyleProperty, be as memo, bf as template, bg as useI18n, bh as insert, bi as use, bj as addEventListener, bk as Dialog, bl as delegateEvents, bm as className, bn as For, bo as UNDERLINE_STYLE_OPTIONS, bp as Tabs, bq as measureParagraphMinContentWidthPx, br as getEditableBlocksForZone, bs as findParagraphLocation, bt as createSectionBoundaryParagraph, bu as normalizePageSettings, bv as DEFAULT_EDITOR_PAGE_SETTINGS, bw as markStart, bx as markEnd, by as getParagraphEntries, bz as getParagraphById, bA as PluginUiHost, bB as OasisEditorEditor, bC as perfTimer, bD as OasisBrandMark, bE as setPreciseFontPreference, bF as setWelcomeSeen, bG as enablePreciseFontMode, bH as createOasisEditorClient, bI as createEditorZoom, bJ as startLongTaskObserver, bK as installGlobalReport, bL as applyStoredPreciseFontPreference, bM as getWelcomeSeen, bN as isLocalFontAccessSupported, bO as EDITOR_SCROLL_PADDING_PX, bP as Toolbar, bQ as OasisEditorLoading, bR as I18nProvider, bS as createEditorLogger, bT as createTranslator, bU as registerDomStatsSurface } from "./index-
|
|
4
|
+
import { n as normalizeSelection, g as getParagraphs, c as createEditorParagraphFromRuns, a as getParagraphLength, b as createEditorRun, d as getDocumentSections, e as createEditorStyledRun, f as getParagraphText, h as getActiveZone, i as getActiveSectionIndex, p as positionToParagraphOffset, j as paragraphOffsetToPosition, k as clampPosition, l as findParagraphIndex, m as createCollapsedSelection, o as isSelectionCollapsed, E as EMU_PER_PX, q as createEditorParagraph, r as getBlockParagraphs, s as createEditorFootnote, t as createFootnoteReferenceRun, u as renumberFootnotes, v as iterateFootnoteReferenceRuns, w as getFootnoteDisplayMarker, x as findParagraphTableLocation, y as buildTableCellLayout, z as createSignal, A as createEffect, B as onCleanup, C as buildCanvasLayoutSnapshot, D as on, F as onMount, G as debounce, H as unwrap, I as getDocumentParagraphs, P as PT_PER_PX, J as createEditorTableCell, K as createEditorTableRow, L as createEditorTable, M as getDocumentSectionsCanonical, N as createEditorDocument, O as getPageContentWidth, Q as getDocumentPageSettings, R as getTableCellContentWidthForParagraph, S as resolveResizedDimensions, T as resolveImageSrc, U as resolveTextBoxRenderHeight, V as TWIPS_PER_POINT, W as PX_PER_INCH, X as TWIPS_PER_INCH, Y as resolveEffectiveParagraphStyle, Z as resolveEffectiveTextStyleForParagraph, _ as EMU_PER_PT, $ as iterateEndnoteReferenceRuns, a0 as imageContentTypeDefaults, a1 as JSZip, a2 as imageExtensionFromMime, a3 as pxToPt$1, a4 as resolveFloatingObjectRect, a5 as getTextBoxFloatingGeometry, a6 as getPresetPathSegments, a7 as projectBlocksLayout, a8 as buildListLabels, a9 as textStyleToFontSizePt, aa as PX_PER_POINT, ab as DEFAULT_FONT_SIZE_PX, ac as isDoubleUnderlineStyle, ad as isWavyUnderlineStyle, ae as underlineStyleLineWidthPx, af as underlineStyleDashArray, ag as resolveListLabel, ah as getListLabelInset, ai as getAlignedListLabelInset, aj as getParagraphBorderInsets, ak as buildSegmentTable, al as buildCanvasTableLayout, am as normalizeFamily, an as ROBOTO_FONT_FILES, ao as loadFontAsset, ap as OFFICE_COMPAT_FONT_FAMILIES, aq as buildSfnt, ar as defaultFontDecoderRegistry, as as SfntFontProgram, at as collectPdfFontFamilies, au as projectDocumentLayout, av as getPageHeaderZoneTop, aw as getPageBodyTop, ax as getPageColumnRects, ay as findFootnoteReference, az as FOOTNOTE_MARKER_GUTTER_PX, aA as resolveImporterForFile, aB as createEditorStateFromDocument, aC as getDocumentParagraphsCanonical, aD as getToolbarStyleState, aE as STANDARD_FONT_SIZES_PT, aF as fontSizePxToPt, aG as probeLocalFontFamilies, aH as createInitialEditorState, aI as parseFontSizePtToPx, aJ as formatFontSizePt, aK as underlineStyleToCssDecorationStyle, aL as listKindForTag, aM as isParagraphTag, aN as collectInlineRuns, aO as parseParagraphStyle, aP as getCachedCanvasImage, aQ as getHeadingLevel, aR as preciseFontModeVersion, aS as isPreciseFontModeEnabled, aT as togglePreciseFontMode, aU as nextFontSizePt, aV as previousFontSizePt, aW as fontSizePtToPx, aX as createDefaultToolbarPreset, aY as MenuRegistry, aZ as createToolbarRegistry, a_ as Editor, a$ as resolveCommandRef, b0 as commandRefName, b1 as InlineShell, b2 as BalloonShell, b3 as DocumentShell, b4 as createMemo, b5 as getCaretRectFromSnapshot, b6 as getParagraphRectFromSnapshot, b7 as createComponent, b8 as CaretOverlay, b9 as Show, ba as createRenderEffect, bb as style, bc as setAttribute, bd as setStyleProperty, be as memo, bf as template, bg as useI18n, bh as insert, bi as use, bj as addEventListener, bk as Dialog, bl as delegateEvents, bm as className, bn as For, bo as UNDERLINE_STYLE_OPTIONS, bp as Tabs, bq as measureParagraphMinContentWidthPx, br as getEditableBlocksForZone, bs as findParagraphLocation, bt as createSectionBoundaryParagraph, bu as normalizePageSettings, bv as DEFAULT_EDITOR_PAGE_SETTINGS, bw as markStart, bx as markEnd, by as getParagraphEntries, bz as getParagraphById, bA as PluginUiHost, bB as OasisEditorEditor, bC as perfTimer, bD as OasisBrandMark, bE as setPreciseFontPreference, bF as setWelcomeSeen, bG as enablePreciseFontMode, bH as createOasisEditorClient, bI as createEditorZoom, bJ as startLongTaskObserver, bK as installGlobalReport, bL as applyStoredPreciseFontPreference, bM as getWelcomeSeen, bN as isLocalFontAccessSupported, bO as EDITOR_SCROLL_PADDING_PX, bP as Toolbar, bQ as OasisEditorLoading, bR as I18nProvider, bS as createEditorLogger, bT as createTranslator, bU as registerDomStatsSurface } from "./index-BMJs8egS.js";
|
|
5
5
|
function getSelectedObjectRun(state, predicate) {
|
|
6
6
|
const normalized = normalizeSelection(state);
|
|
7
7
|
if (normalized.isCollapsed || normalized.startIndex !== normalized.endIndex || normalized.endParagraphOffset - normalized.startParagraphOffset !== 1) {
|
|
@@ -9091,38 +9091,6 @@ function buildPartRelationshipsXml(images, hyperlinks) {
|
|
|
9091
9091
|
}
|
|
9092
9092
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${PACKAGE_REL_NS}">${rels}</Relationships>`;
|
|
9093
9093
|
}
|
|
9094
|
-
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}"`;
|
|
9095
|
-
function serializeSectionPropertiesWithReferences(pageSettings, references) {
|
|
9096
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
9097
|
-
const width = pxToTwips(pageSettings.width, 12240);
|
|
9098
|
-
const height = pxToTwips(pageSettings.height, 15840);
|
|
9099
|
-
const margins = pageSettings.margins;
|
|
9100
|
-
const orientationAttr = pageSettings.orientation === "landscape" ? ' w:orient="landscape"' : "";
|
|
9101
|
-
const referencesXml = [
|
|
9102
|
-
((_a = references == null ? void 0 : references.header) == null ? void 0 : _a.first) ? `<w:headerReference w:type="first" r:id="${references.header.first.relId}"/>` : "",
|
|
9103
|
-
((_b = references == null ? void 0 : references.header) == null ? void 0 : _b.even) ? `<w:headerReference w:type="even" r:id="${references.header.even.relId}"/>` : "",
|
|
9104
|
-
((_c = references == null ? void 0 : references.header) == null ? void 0 : _c.default) ? `<w:headerReference w:type="default" r:id="${references.header.default.relId}"/>` : "",
|
|
9105
|
-
((_d = references == null ? void 0 : references.footer) == null ? void 0 : _d.first) ? `<w:footerReference w:type="first" r:id="${references.footer.first.relId}"/>` : "",
|
|
9106
|
-
((_e = references == null ? void 0 : references.footer) == null ? void 0 : _e.even) ? `<w:footerReference w:type="even" r:id="${references.footer.even.relId}"/>` : "",
|
|
9107
|
-
((_f = references == null ? void 0 : references.footer) == null ? void 0 : _f.default) ? `<w:footerReference w:type="default" r:id="${references.footer.default.relId}"/>` : ""
|
|
9108
|
-
].join("");
|
|
9109
|
-
const titlePageXml = ((_g = references == null ? void 0 : references.header) == null ? void 0 : _g.first) || ((_h = references == null ? void 0 : references.footer) == null ? void 0 : _h.first) ? "<w:titlePg/>" : "";
|
|
9110
|
-
const columns = pageSettings.columns;
|
|
9111
|
-
let columnsXml = "";
|
|
9112
|
-
if (columns && columns.count > 1) {
|
|
9113
|
-
const space = pxToTwips(columns.space, 0);
|
|
9114
|
-
const sepAttr = columns.separator ? ' w:sep="1"' : "";
|
|
9115
|
-
if (columns.equalWidth === false && ((_i = columns.columns) == null ? void 0 : _i.length)) {
|
|
9116
|
-
const colsXml = columns.columns.map(
|
|
9117
|
-
(col) => `<w:col w:w="${pxToTwips(col.width, 0)}" w:space="${pxToTwips(col.space, 0)}"/>`
|
|
9118
|
-
).join("");
|
|
9119
|
-
columnsXml = `<w:cols w:num="${columns.count}" w:space="${space}" w:equalWidth="0"${sepAttr}>${colsXml}</w:cols>`;
|
|
9120
|
-
} else {
|
|
9121
|
-
columnsXml = `<w:cols w:num="${columns.count}" w:space="${space}"${sepAttr}/>`;
|
|
9122
|
-
}
|
|
9123
|
-
}
|
|
9124
|
-
return `<w:sectPr>${referencesXml}${titlePageXml}<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)}"/>${columnsXml}</w:sectPr>`;
|
|
9125
|
-
}
|
|
9126
9094
|
function visitParagraphDeep(paragraph, callback) {
|
|
9127
9095
|
callback(paragraph);
|
|
9128
9096
|
for (const run of paragraph.runs) {
|
|
@@ -9208,6 +9176,70 @@ function buildNumberingContext(document2) {
|
|
|
9208
9176
|
}
|
|
9209
9177
|
return { numberingInfo, definitions };
|
|
9210
9178
|
}
|
|
9179
|
+
function buildNumberingXml(definitions) {
|
|
9180
|
+
const abstractNums = definitions.map(({ abstractNumId, levels }) => {
|
|
9181
|
+
const levelsXml = levels.sort((a, b) => a.level - b.level).map(
|
|
9182
|
+
({
|
|
9183
|
+
kind,
|
|
9184
|
+
level,
|
|
9185
|
+
format,
|
|
9186
|
+
startAt,
|
|
9187
|
+
levelText,
|
|
9188
|
+
suffix,
|
|
9189
|
+
alignment,
|
|
9190
|
+
legal,
|
|
9191
|
+
bulletGlyph,
|
|
9192
|
+
bulletFont
|
|
9193
|
+
}) => {
|
|
9194
|
+
const numFmtVal = kind === "bullet" ? "bullet" : format ?? "decimal";
|
|
9195
|
+
const effectiveLevelText = levelText ?? (kind === "bullet" ? bulletGlyph ?? "" : `%${level + 1}.`);
|
|
9196
|
+
const startVal = startAt ?? 1;
|
|
9197
|
+
const fontName = kind === "bullet" ? bulletFont ?? "Symbol" : void 0;
|
|
9198
|
+
const runFonts = fontName ? `<w:rPr><w:rFonts w:ascii="${escapeXml(fontName)}" w:hAnsi="${escapeXml(fontName)}" w:hint="default"/></w:rPr>` : "";
|
|
9199
|
+
const suffixXml = suffix && suffix !== "tab" ? `<w:suff w:val="${suffix}"/>` : "";
|
|
9200
|
+
const legalXml = legal ? "<w:isLgl/>" : "";
|
|
9201
|
+
return `<w:lvl w:ilvl="${level}"><w:start w:val="${startVal}"/><w:numFmt w:val="${numFmtVal}"/><w:lvlText w:val="${escapeXml(effectiveLevelText)}"/><w:lvlJc w:val="${alignment ?? "left"}"/>${suffixXml}${legalXml}${runFonts}</w:lvl>`;
|
|
9202
|
+
}
|
|
9203
|
+
).join("");
|
|
9204
|
+
return `<w:abstractNum w:abstractNumId="${abstractNumId}">${levelsXml}</w:abstractNum>`;
|
|
9205
|
+
}).join("");
|
|
9206
|
+
const nums = definitions.map(
|
|
9207
|
+
({ abstractNumId, numId }) => `<w:num w:numId="${numId}"><w:abstractNumId w:val="${abstractNumId}"/></w:num>`
|
|
9208
|
+
).join("");
|
|
9209
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:numbering xmlns:w="${WORD_NS$1}">${abstractNums}${nums}</w:numbering>`;
|
|
9210
|
+
}
|
|
9211
|
+
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}"`;
|
|
9212
|
+
function serializeSectionPropertiesWithReferences(pageSettings, references) {
|
|
9213
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
9214
|
+
const width = pxToTwips(pageSettings.width, 12240);
|
|
9215
|
+
const height = pxToTwips(pageSettings.height, 15840);
|
|
9216
|
+
const margins = pageSettings.margins;
|
|
9217
|
+
const orientationAttr = pageSettings.orientation === "landscape" ? ' w:orient="landscape"' : "";
|
|
9218
|
+
const referencesXml = [
|
|
9219
|
+
((_a = references == null ? void 0 : references.header) == null ? void 0 : _a.first) ? `<w:headerReference w:type="first" r:id="${references.header.first.relId}"/>` : "",
|
|
9220
|
+
((_b = references == null ? void 0 : references.header) == null ? void 0 : _b.even) ? `<w:headerReference w:type="even" r:id="${references.header.even.relId}"/>` : "",
|
|
9221
|
+
((_c = references == null ? void 0 : references.header) == null ? void 0 : _c.default) ? `<w:headerReference w:type="default" r:id="${references.header.default.relId}"/>` : "",
|
|
9222
|
+
((_d = references == null ? void 0 : references.footer) == null ? void 0 : _d.first) ? `<w:footerReference w:type="first" r:id="${references.footer.first.relId}"/>` : "",
|
|
9223
|
+
((_e = references == null ? void 0 : references.footer) == null ? void 0 : _e.even) ? `<w:footerReference w:type="even" r:id="${references.footer.even.relId}"/>` : "",
|
|
9224
|
+
((_f = references == null ? void 0 : references.footer) == null ? void 0 : _f.default) ? `<w:footerReference w:type="default" r:id="${references.footer.default.relId}"/>` : ""
|
|
9225
|
+
].join("");
|
|
9226
|
+
const titlePageXml = ((_g = references == null ? void 0 : references.header) == null ? void 0 : _g.first) || ((_h = references == null ? void 0 : references.footer) == null ? void 0 : _h.first) ? "<w:titlePg/>" : "";
|
|
9227
|
+
const columns = pageSettings.columns;
|
|
9228
|
+
let columnsXml = "";
|
|
9229
|
+
if (columns && columns.count > 1) {
|
|
9230
|
+
const space = pxToTwips(columns.space, 0);
|
|
9231
|
+
const sepAttr = columns.separator ? ' w:sep="1"' : "";
|
|
9232
|
+
if (columns.equalWidth === false && ((_i = columns.columns) == null ? void 0 : _i.length)) {
|
|
9233
|
+
const colsXml = columns.columns.map(
|
|
9234
|
+
(col) => `<w:col w:w="${pxToTwips(col.width, 0)}" w:space="${pxToTwips(col.space, 0)}"/>`
|
|
9235
|
+
).join("");
|
|
9236
|
+
columnsXml = `<w:cols w:num="${columns.count}" w:space="${space}" w:equalWidth="0"${sepAttr}>${colsXml}</w:cols>`;
|
|
9237
|
+
} else {
|
|
9238
|
+
columnsXml = `<w:cols w:num="${columns.count}" w:space="${space}"${sepAttr}/>`;
|
|
9239
|
+
}
|
|
9240
|
+
}
|
|
9241
|
+
return `<w:sectPr>${referencesXml}${titlePageXml}<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)}"/>${columnsXml}</w:sectPr>`;
|
|
9242
|
+
}
|
|
9211
9243
|
function buildPartContext(blocks, numberingContext, state, document2) {
|
|
9212
9244
|
const images = [];
|
|
9213
9245
|
const imageMap = /* @__PURE__ */ new Map();
|
|
@@ -9287,38 +9319,6 @@ function buildPartContext(blocks, numberingContext, state, document2) {
|
|
|
9287
9319
|
hyperlinkMap
|
|
9288
9320
|
};
|
|
9289
9321
|
}
|
|
9290
|
-
function buildNumberingXml(definitions) {
|
|
9291
|
-
const abstractNums = definitions.map(({ abstractNumId, levels }) => {
|
|
9292
|
-
const levelsXml = levels.sort((a, b) => a.level - b.level).map(
|
|
9293
|
-
({
|
|
9294
|
-
kind,
|
|
9295
|
-
level,
|
|
9296
|
-
format,
|
|
9297
|
-
startAt,
|
|
9298
|
-
levelText,
|
|
9299
|
-
suffix,
|
|
9300
|
-
alignment,
|
|
9301
|
-
legal,
|
|
9302
|
-
bulletGlyph,
|
|
9303
|
-
bulletFont
|
|
9304
|
-
}) => {
|
|
9305
|
-
const numFmtVal = kind === "bullet" ? "bullet" : format ?? "decimal";
|
|
9306
|
-
const effectiveLevelText = levelText ?? (kind === "bullet" ? bulletGlyph ?? "" : `%${level + 1}.`);
|
|
9307
|
-
const startVal = startAt ?? 1;
|
|
9308
|
-
const fontName = kind === "bullet" ? bulletFont ?? "Symbol" : void 0;
|
|
9309
|
-
const runFonts = fontName ? `<w:rPr><w:rFonts w:ascii="${escapeXml(fontName)}" w:hAnsi="${escapeXml(fontName)}" w:hint="default"/></w:rPr>` : "";
|
|
9310
|
-
const suffixXml = suffix && suffix !== "tab" ? `<w:suff w:val="${suffix}"/>` : "";
|
|
9311
|
-
const legalXml = legal ? "<w:isLgl/>" : "";
|
|
9312
|
-
return `<w:lvl w:ilvl="${level}"><w:start w:val="${startVal}"/><w:numFmt w:val="${numFmtVal}"/><w:lvlText w:val="${escapeXml(effectiveLevelText)}"/><w:lvlJc w:val="${alignment ?? "left"}"/>${suffixXml}${legalXml}${runFonts}</w:lvl>`;
|
|
9313
|
-
}
|
|
9314
|
-
).join("");
|
|
9315
|
-
return `<w:abstractNum w:abstractNumId="${abstractNumId}">${levelsXml}</w:abstractNum>`;
|
|
9316
|
-
}).join("");
|
|
9317
|
-
const nums = definitions.map(
|
|
9318
|
-
({ abstractNumId, numId }) => `<w:num w:numId="${numId}"><w:abstractNumId w:val="${abstractNumId}"/></w:num>`
|
|
9319
|
-
).join("");
|
|
9320
|
-
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:numbering xmlns:w="${WORD_NS$1}">${abstractNums}${nums}</w:numbering>`;
|
|
9321
|
-
}
|
|
9322
9322
|
function buildDocumentXml(document2, context, sectionReferences) {
|
|
9323
9323
|
const sections = getDocumentSections(document2);
|
|
9324
9324
|
const sectionsXml = sections.map((section, sectionIndex) => {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EditorBlockNode, EditorParagraphNode } from '../../core/model.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Depth-first paragraph traversal used by the DOCX export to register numbering
|
|
5
|
+
* definitions and image/hyperlink relationships. Recurses into text-box bodies
|
|
6
|
+
* and table cells so nested content participates too. Shared leaf so both the
|
|
7
|
+
* numbering-context and part-context builders can use it.
|
|
8
|
+
*/
|
|
9
|
+
export declare function visitParagraphDeep(paragraph: EditorParagraphNode, callback: (paragraph: EditorParagraphNode) => void): void;
|
|
10
|
+
export declare function visitBlocks(blocks: EditorBlockNode[], callback: (paragraph: EditorParagraphNode) => void): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EditorDocument } from '../../core/model.js';
|
|
2
|
+
import { NumberingContext, NumberingDefinition } from './docxTypes.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Walks the document (including headers/footers and nested content) collecting
|
|
6
|
+
* list paragraphs into abstract numbering definitions and a per-paragraph
|
|
7
|
+
* numId/level map. Extracted from exportEditorDocumentToDocx (S2).
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildNumberingContext(document: EditorDocument): NumberingContext;
|
|
10
|
+
export declare function buildNumberingXml(definitions: NumberingDefinition[]): string;
|
|
@@ -2483,7 +2483,7 @@ function OasisEditorAppLazy(props = {}) {
|
|
|
2483
2483
|
onCleanup(() => {
|
|
2484
2484
|
cancelled = true;
|
|
2485
2485
|
});
|
|
2486
|
-
import("./OasisEditorApp-
|
|
2486
|
+
import("./OasisEditorApp-2ji5OaBy.js").then((m) => {
|
|
2487
2487
|
cancelled = true;
|
|
2488
2488
|
setProgress(1);
|
|
2489
2489
|
setTimeout(() => setApp(() => m.OasisEditorApp), 180);
|
package/dist/oasis-editor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b2, bV, bW, bX, bY, bZ, bk, b_, b3, a_, b$, c0, c1, b1, c2, aY, c3, c4, c5, c6, c7, bQ, c8, c9, ca, cb, cc, cd, ce, cf, cg, ch, ci, bp, cj, bP, ck, bX as bX2, c0 as c02, c2 as c22, cb as cb2, cd as cd2, ci as ci2, cl, b0, aX, cm, cn, co, aZ, cp, cq, a$ } from "./index-
|
|
1
|
+
import { b2, bV, bW, bX, bY, bZ, bk, b_, b3, a_, b$, c0, c1, b1, c2, aY, c3, c4, c5, c6, c7, bQ, c8, c9, ca, cb, cc, cd, ce, cf, cg, ch, ci, bp, cj, bP, ck, bX as bX2, c0 as c02, c2 as c22, cb as cb2, cd as cd2, ci as ci2, cl, b0, aX, cm, cn, co, aZ, cp, cq, a$ } from "./index-BMJs8egS.js";
|
|
2
2
|
export {
|
|
3
3
|
b2 as BalloonShell,
|
|
4
4
|
bV as Button,
|