oasis-editor 0.0.49 → 0.0.51
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.
|
@@ -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
|
|
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-UmNr3ynm.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) {
|
|
@@ -8990,6 +8990,107 @@ function buildStylesXml(styles) {
|
|
|
8990
8990
|
const styleElements = Object.values(styles).map(serializeNamedStyle).join("");
|
|
8991
8991
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:styles xmlns:w="${WORD_NS}" xmlns:w14="${WORD14_NS}">${styleElements}</w:styles>`;
|
|
8992
8992
|
}
|
|
8993
|
+
function buildContentTypesXml(hasNumbering, imageExtensions, hasSettings, parts, hasFootnotes, hasEndnotes, hasStyles, hasComments) {
|
|
8994
|
+
const overrides = parts.map((part) => {
|
|
8995
|
+
const contentType = part.kind === "header" ? "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml" : "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml";
|
|
8996
|
+
return `<Override PartName="/word/${part.path}" ContentType="${contentType}"/>`;
|
|
8997
|
+
}).join("");
|
|
8998
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/>${imageContentTypeDefaults(
|
|
8999
|
+
imageExtensions
|
|
9000
|
+
)}<Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/>${hasStyles ? '<Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/>' : ""}${hasNumbering ? '<Override PartName="/word/numbering.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"/>' : ""}${hasSettings ? '<Override PartName="/word/settings.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"/>' : ""}${hasFootnotes ? '<Override PartName="/word/footnotes.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml"/>' : ""}${hasEndnotes ? '<Override PartName="/word/endnotes.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml"/>' : ""}${hasComments ? '<Override PartName="/word/comments.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml"/><Override PartName="/word/commentsExtended.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml"/>' : ""}${overrides}</Types>`;
|
|
9001
|
+
}
|
|
9002
|
+
function buildRootRelationshipsXml() {
|
|
9003
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${PACKAGE_REL_NS}"><Relationship Id="rId1" Type="${OFFICE_REL_NS}/officeDocument" Target="word/document.xml"/></Relationships>`;
|
|
9004
|
+
}
|
|
9005
|
+
function buildDocumentRelationshipsXml(hasNumbering, hasSettings, images, hyperlinks, parts, hasFootnotes, hasEndnotes, hasStyles, hasComments) {
|
|
9006
|
+
let rels = "";
|
|
9007
|
+
if (hasStyles)
|
|
9008
|
+
rels += `<Relationship Id="rIdStyles" Type="${OFFICE_REL_NS}/styles" Target="styles.xml"/>`;
|
|
9009
|
+
if (hasNumbering)
|
|
9010
|
+
rels += `<Relationship Id="rIdNum" Type="${OFFICE_REL_NS}/numbering" Target="numbering.xml"/>`;
|
|
9011
|
+
if (hasSettings)
|
|
9012
|
+
rels += `<Relationship Id="rIdSettings" Type="${OFFICE_REL_NS}/settings" Target="settings.xml"/>`;
|
|
9013
|
+
for (const hyperlink of hyperlinks) {
|
|
9014
|
+
rels += `<Relationship Id="${hyperlink.rId}" Type="${OFFICE_REL_NS}/hyperlink" Target="${escapeXml(hyperlink.href)}" TargetMode="External"/>`;
|
|
9015
|
+
}
|
|
9016
|
+
for (const img of images) {
|
|
9017
|
+
const targetMode = img.kind === "linked" ? ' TargetMode="External"' : "";
|
|
9018
|
+
rels += `<Relationship Id="${img.rId}" Type="${OFFICE_REL_NS}/image" Target="${escapeXml(img.target)}"${targetMode}/>`;
|
|
9019
|
+
}
|
|
9020
|
+
for (const part of parts) {
|
|
9021
|
+
const relType = part.kind === "header" ? "header" : "footer";
|
|
9022
|
+
rels += `<Relationship Id="${part.relId}" Type="${OFFICE_REL_NS}/${relType}" Target="${part.path}"/>`;
|
|
9023
|
+
}
|
|
9024
|
+
if (hasFootnotes) {
|
|
9025
|
+
rels += `<Relationship Id="rIdFootnotes" Type="${OFFICE_REL_NS}/footnotes" Target="footnotes.xml"/>`;
|
|
9026
|
+
}
|
|
9027
|
+
if (hasEndnotes) {
|
|
9028
|
+
rels += `<Relationship Id="rIdEndnotes" Type="${OFFICE_REL_NS}/endnotes" Target="endnotes.xml"/>`;
|
|
9029
|
+
}
|
|
9030
|
+
if (hasComments) {
|
|
9031
|
+
rels += `<Relationship Id="rIdComments" Type="${OFFICE_REL_NS}/comments" Target="comments.xml"/>`;
|
|
9032
|
+
rels += `<Relationship Id="rIdCommentsExtended" Type="http://schemas.microsoft.com/office/2011/relationships/commentsExtended" Target="commentsExtended.xml"/>`;
|
|
9033
|
+
}
|
|
9034
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${PACKAGE_REL_NS}">${rels}</Relationships>`;
|
|
9035
|
+
}
|
|
9036
|
+
const NOTE_NUMBER_FORMATS = {
|
|
9037
|
+
decimal: "decimal",
|
|
9038
|
+
lowerRoman: "lowerRoman",
|
|
9039
|
+
upperRoman: "upperRoman",
|
|
9040
|
+
lowerLetter: "lowerLetter",
|
|
9041
|
+
upperLetter: "upperLetter",
|
|
9042
|
+
symbol: "symbol"
|
|
9043
|
+
};
|
|
9044
|
+
const NOTE_RESTARTS = {
|
|
9045
|
+
continuous: "continuous",
|
|
9046
|
+
eachSection: "eachSect"
|
|
9047
|
+
};
|
|
9048
|
+
function serializeNoteSettings(tagName, settings) {
|
|
9049
|
+
if (!settings) return null;
|
|
9050
|
+
const parts = [];
|
|
9051
|
+
if (settings.numberFormat) {
|
|
9052
|
+
parts.push(
|
|
9053
|
+
`<w:numFmt w:val="${NOTE_NUMBER_FORMATS[settings.numberFormat]}"/>`
|
|
9054
|
+
);
|
|
9055
|
+
}
|
|
9056
|
+
if (settings.startAt !== void 0) {
|
|
9057
|
+
parts.push(`<w:numStart w:val="${Math.max(1, settings.startAt)}"/>`);
|
|
9058
|
+
}
|
|
9059
|
+
if (settings.restart) {
|
|
9060
|
+
parts.push(`<w:numRestart w:val="${NOTE_RESTARTS[settings.restart]}"/>`);
|
|
9061
|
+
}
|
|
9062
|
+
return parts.length > 0 ? `<w:${tagName}>${parts.join("")}</w:${tagName}>` : null;
|
|
9063
|
+
}
|
|
9064
|
+
function buildSettingsXml(hasEvenAndOddHeaders, defaultTabStop, footnoteSettings, endnoteSettings) {
|
|
9065
|
+
const parts = [];
|
|
9066
|
+
const defaultTabStopTwips = pointsToTwips(defaultTabStop);
|
|
9067
|
+
if (defaultTabStopTwips !== null) {
|
|
9068
|
+
parts.push(`<w:defaultTabStop w:val="${defaultTabStopTwips}"/>`);
|
|
9069
|
+
}
|
|
9070
|
+
const footnotePr = serializeNoteSettings("footnotePr", footnoteSettings);
|
|
9071
|
+
if (footnotePr) {
|
|
9072
|
+
parts.push(footnotePr);
|
|
9073
|
+
}
|
|
9074
|
+
const endnotePr = serializeNoteSettings("endnotePr", endnoteSettings);
|
|
9075
|
+
if (endnotePr) {
|
|
9076
|
+
parts.push(endnotePr);
|
|
9077
|
+
}
|
|
9078
|
+
if (hasEvenAndOddHeaders) {
|
|
9079
|
+
parts.push("<w:evenAndOddHeaders/>");
|
|
9080
|
+
}
|
|
9081
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:settings xmlns:w="${WORD_NS$1}">${parts.join("")}</w:settings>`;
|
|
9082
|
+
}
|
|
9083
|
+
function buildPartRelationshipsXml(images, hyperlinks) {
|
|
9084
|
+
let rels = "";
|
|
9085
|
+
for (const hyperlink of hyperlinks) {
|
|
9086
|
+
rels += `<Relationship Id="${hyperlink.rId}" Type="${OFFICE_REL_NS}/hyperlink" Target="${escapeXml(hyperlink.href)}" TargetMode="External"/>`;
|
|
9087
|
+
}
|
|
9088
|
+
for (const img of images) {
|
|
9089
|
+
const targetMode = img.kind === "linked" ? ' TargetMode="External"' : "";
|
|
9090
|
+
rels += `<Relationship Id="${img.rId}" Type="${OFFICE_REL_NS}/image" Target="${escapeXml(img.target)}"${targetMode}/>`;
|
|
9091
|
+
}
|
|
9092
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${PACKAGE_REL_NS}">${rels}</Relationships>`;
|
|
9093
|
+
}
|
|
8993
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}"`;
|
|
8994
9095
|
function serializeSectionPropertiesWithReferences(pageSettings, references) {
|
|
8995
9096
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
@@ -9238,107 +9339,6 @@ function buildHeaderFooterXml(kind, blocks, context, styles) {
|
|
|
9238
9339
|
const tag = kind === "header" ? "hdr" : "ftr";
|
|
9239
9340
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:${tag} ${DOCUMENT_XMLNS}>${serializeBlocksXml(blocks, context, styles)}</w:${tag}>`;
|
|
9240
9341
|
}
|
|
9241
|
-
function buildContentTypesXml(hasNumbering, imageExtensions, hasSettings, parts, hasFootnotes, hasEndnotes, hasStyles, hasComments) {
|
|
9242
|
-
const overrides = parts.map((part) => {
|
|
9243
|
-
const contentType = part.kind === "header" ? "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml" : "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml";
|
|
9244
|
-
return `<Override PartName="/word/${part.path}" ContentType="${contentType}"/>`;
|
|
9245
|
-
}).join("");
|
|
9246
|
-
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/>${imageContentTypeDefaults(
|
|
9247
|
-
imageExtensions
|
|
9248
|
-
)}<Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/>${hasStyles ? '<Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/>' : ""}${hasNumbering ? '<Override PartName="/word/numbering.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"/>' : ""}${hasSettings ? '<Override PartName="/word/settings.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"/>' : ""}${hasFootnotes ? '<Override PartName="/word/footnotes.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml"/>' : ""}${hasEndnotes ? '<Override PartName="/word/endnotes.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml"/>' : ""}${hasComments ? '<Override PartName="/word/comments.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml"/><Override PartName="/word/commentsExtended.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml"/>' : ""}${overrides}</Types>`;
|
|
9249
|
-
}
|
|
9250
|
-
function buildRootRelationshipsXml() {
|
|
9251
|
-
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${PACKAGE_REL_NS}"><Relationship Id="rId1" Type="${OFFICE_REL_NS}/officeDocument" Target="word/document.xml"/></Relationships>`;
|
|
9252
|
-
}
|
|
9253
|
-
function buildDocumentRelationshipsXml(hasNumbering, hasSettings, images, hyperlinks, parts, hasFootnotes, hasEndnotes, hasStyles, hasComments) {
|
|
9254
|
-
let rels = "";
|
|
9255
|
-
if (hasStyles)
|
|
9256
|
-
rels += `<Relationship Id="rIdStyles" Type="${OFFICE_REL_NS}/styles" Target="styles.xml"/>`;
|
|
9257
|
-
if (hasNumbering)
|
|
9258
|
-
rels += `<Relationship Id="rIdNum" Type="${OFFICE_REL_NS}/numbering" Target="numbering.xml"/>`;
|
|
9259
|
-
if (hasSettings)
|
|
9260
|
-
rels += `<Relationship Id="rIdSettings" Type="${OFFICE_REL_NS}/settings" Target="settings.xml"/>`;
|
|
9261
|
-
for (const hyperlink of hyperlinks) {
|
|
9262
|
-
rels += `<Relationship Id="${hyperlink.rId}" Type="${OFFICE_REL_NS}/hyperlink" Target="${escapeXml(hyperlink.href)}" TargetMode="External"/>`;
|
|
9263
|
-
}
|
|
9264
|
-
for (const img of images) {
|
|
9265
|
-
const targetMode = img.kind === "linked" ? ' TargetMode="External"' : "";
|
|
9266
|
-
rels += `<Relationship Id="${img.rId}" Type="${OFFICE_REL_NS}/image" Target="${escapeXml(img.target)}"${targetMode}/>`;
|
|
9267
|
-
}
|
|
9268
|
-
for (const part of parts) {
|
|
9269
|
-
const relType = part.kind === "header" ? "header" : "footer";
|
|
9270
|
-
rels += `<Relationship Id="${part.relId}" Type="${OFFICE_REL_NS}/${relType}" Target="${part.path}"/>`;
|
|
9271
|
-
}
|
|
9272
|
-
if (hasFootnotes) {
|
|
9273
|
-
rels += `<Relationship Id="rIdFootnotes" Type="${OFFICE_REL_NS}/footnotes" Target="footnotes.xml"/>`;
|
|
9274
|
-
}
|
|
9275
|
-
if (hasEndnotes) {
|
|
9276
|
-
rels += `<Relationship Id="rIdEndnotes" Type="${OFFICE_REL_NS}/endnotes" Target="endnotes.xml"/>`;
|
|
9277
|
-
}
|
|
9278
|
-
if (hasComments) {
|
|
9279
|
-
rels += `<Relationship Id="rIdComments" Type="${OFFICE_REL_NS}/comments" Target="comments.xml"/>`;
|
|
9280
|
-
rels += `<Relationship Id="rIdCommentsExtended" Type="http://schemas.microsoft.com/office/2011/relationships/commentsExtended" Target="commentsExtended.xml"/>`;
|
|
9281
|
-
}
|
|
9282
|
-
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${PACKAGE_REL_NS}">${rels}</Relationships>`;
|
|
9283
|
-
}
|
|
9284
|
-
function buildSettingsXml(hasEvenAndOddHeaders, defaultTabStop, footnoteSettings, endnoteSettings) {
|
|
9285
|
-
const parts = [];
|
|
9286
|
-
const defaultTabStopTwips = pointsToTwips(defaultTabStop);
|
|
9287
|
-
if (defaultTabStopTwips !== null) {
|
|
9288
|
-
parts.push(`<w:defaultTabStop w:val="${defaultTabStopTwips}"/>`);
|
|
9289
|
-
}
|
|
9290
|
-
const footnotePr = serializeNoteSettings("footnotePr", footnoteSettings);
|
|
9291
|
-
if (footnotePr) {
|
|
9292
|
-
parts.push(footnotePr);
|
|
9293
|
-
}
|
|
9294
|
-
const endnotePr = serializeNoteSettings("endnotePr", endnoteSettings);
|
|
9295
|
-
if (endnotePr) {
|
|
9296
|
-
parts.push(endnotePr);
|
|
9297
|
-
}
|
|
9298
|
-
if (hasEvenAndOddHeaders) {
|
|
9299
|
-
parts.push("<w:evenAndOddHeaders/>");
|
|
9300
|
-
}
|
|
9301
|
-
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:settings xmlns:w="${WORD_NS$1}">${parts.join("")}</w:settings>`;
|
|
9302
|
-
}
|
|
9303
|
-
const NOTE_NUMBER_FORMATS = {
|
|
9304
|
-
decimal: "decimal",
|
|
9305
|
-
lowerRoman: "lowerRoman",
|
|
9306
|
-
upperRoman: "upperRoman",
|
|
9307
|
-
lowerLetter: "lowerLetter",
|
|
9308
|
-
upperLetter: "upperLetter",
|
|
9309
|
-
symbol: "symbol"
|
|
9310
|
-
};
|
|
9311
|
-
const NOTE_RESTARTS = {
|
|
9312
|
-
continuous: "continuous",
|
|
9313
|
-
eachSection: "eachSect"
|
|
9314
|
-
};
|
|
9315
|
-
function serializeNoteSettings(tagName, settings) {
|
|
9316
|
-
if (!settings) return null;
|
|
9317
|
-
const parts = [];
|
|
9318
|
-
if (settings.numberFormat) {
|
|
9319
|
-
parts.push(
|
|
9320
|
-
`<w:numFmt w:val="${NOTE_NUMBER_FORMATS[settings.numberFormat]}"/>`
|
|
9321
|
-
);
|
|
9322
|
-
}
|
|
9323
|
-
if (settings.startAt !== void 0) {
|
|
9324
|
-
parts.push(`<w:numStart w:val="${Math.max(1, settings.startAt)}"/>`);
|
|
9325
|
-
}
|
|
9326
|
-
if (settings.restart) {
|
|
9327
|
-
parts.push(`<w:numRestart w:val="${NOTE_RESTARTS[settings.restart]}"/>`);
|
|
9328
|
-
}
|
|
9329
|
-
return parts.length > 0 ? `<w:${tagName}>${parts.join("")}</w:${tagName}>` : null;
|
|
9330
|
-
}
|
|
9331
|
-
function buildPartRelationshipsXml(images, hyperlinks) {
|
|
9332
|
-
let rels = "";
|
|
9333
|
-
for (const hyperlink of hyperlinks) {
|
|
9334
|
-
rels += `<Relationship Id="${hyperlink.rId}" Type="${OFFICE_REL_NS}/hyperlink" Target="${escapeXml(hyperlink.href)}" TargetMode="External"/>`;
|
|
9335
|
-
}
|
|
9336
|
-
for (const img of images) {
|
|
9337
|
-
const targetMode = img.kind === "linked" ? ' TargetMode="External"' : "";
|
|
9338
|
-
rels += `<Relationship Id="${img.rId}" Type="${OFFICE_REL_NS}/image" Target="${escapeXml(img.target)}"${targetMode}/>`;
|
|
9339
|
-
}
|
|
9340
|
-
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${PACKAGE_REL_NS}">${rels}</Relationships>`;
|
|
9341
|
-
}
|
|
9342
9342
|
async function exportEditorDocumentToDocx(document2) {
|
|
9343
9343
|
var _a, _b, _c, _d, _e, _f;
|
|
9344
9344
|
document2 = renumberImageCaptionsInDocument(document2);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EditorFootnoteSettings } from '../../core/model.js';
|
|
2
|
+
import { DocContext, PartDefinition } from './docxTypes.js';
|
|
3
|
+
|
|
4
|
+
export declare function buildContentTypesXml(hasNumbering: boolean, imageExtensions: Iterable<string>, hasSettings: boolean, parts: PartDefinition[], hasFootnotes: boolean, hasEndnotes: boolean, hasStyles: boolean, hasComments: boolean): string;
|
|
5
|
+
export declare function buildRootRelationshipsXml(): string;
|
|
6
|
+
export declare function buildDocumentRelationshipsXml(hasNumbering: boolean, hasSettings: boolean, images: DocContext["images"], hyperlinks: DocContext["hyperlinks"], parts: PartDefinition[], hasFootnotes: boolean, hasEndnotes: boolean, hasStyles: boolean, hasComments: boolean): string;
|
|
7
|
+
export declare function buildSettingsXml(hasEvenAndOddHeaders: boolean, defaultTabStop?: number, footnoteSettings?: EditorFootnoteSettings, endnoteSettings?: EditorFootnoteSettings): string;
|
|
8
|
+
export declare function buildPartRelationshipsXml(images: DocContext["images"], hyperlinks: DocContext["hyperlinks"]): string;
|
|
@@ -2483,7 +2483,7 @@ function OasisEditorAppLazy(props = {}) {
|
|
|
2483
2483
|
onCleanup(() => {
|
|
2484
2484
|
cancelled = true;
|
|
2485
2485
|
});
|
|
2486
|
-
import("./OasisEditorApp-
|
|
2486
|
+
import("./OasisEditorApp-eGw3ren4.js").then((m) => {
|
|
2487
2487
|
cancelled = true;
|
|
2488
2488
|
setProgress(1);
|
|
2489
2489
|
setTimeout(() => setApp(() => m.OasisEditorApp), 180);
|
|
@@ -39898,8 +39898,8 @@ export {
|
|
|
39898
39898
|
EMU_PER_PT as _,
|
|
39899
39899
|
getParagraphLength as a,
|
|
39900
39900
|
resolveCommandRef as a$,
|
|
39901
|
-
|
|
39902
|
-
|
|
39901
|
+
imageContentTypeDefaults as a0,
|
|
39902
|
+
JSZip as a1,
|
|
39903
39903
|
imageExtensionFromMime as a2,
|
|
39904
39904
|
pxToPt as a3,
|
|
39905
39905
|
resolveFloatingObjectRect as a4,
|
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-UmNr3ynm.js";
|
|
2
2
|
export {
|
|
3
3
|
b2 as BalloonShell,
|
|
4
4
|
bV as Button,
|