oasis-editor 0.0.6 → 0.0.7
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-Co_pXhKM.js → OasisEditorApp-Ck4oFAf-.js} +46 -5
- package/dist/assets/{importDocxWorker-CtfvrAfg.js → importDocxWorker-DbiKelzX.js} +1 -1
- package/dist/import/docx/settings.d.ts +4 -0
- package/dist/{index-BYewCj77.js → index-BGcbqj0Q.js} +57 -4
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +4 -4
- 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 createEditorStyledRun, b as getParagraphLength, d as getParagraphText, e as getActiveZone, f as getDocumentSections, h as getActiveSectionIndex, p as positionToParagraphOffset, i as paragraphOffsetToPosition, j as clampPosition, k as findParagraphIndex, l as createCollapsedSelection, m as isSelectionCollapsed, o as createEditorParagraph, q as getBlockParagraphs, r as findParagraphTableLocation, s as buildTableCellLayout, t as createEditorTableCell, u as createEditorTable, v as createEditorTableRow, w as underlineStyleToCssDecorationStyle, x as resolveImageSrc, y as createEditorFootnote, z as createFootnoteReferenceRun, A as renumberFootnotes, B as iterateFootnoteReferenceRuns, C as getFootnoteDisplayMarker, D as createSignal, E as createEffect, F as onCleanup, G as buildCanvasLayoutSnapshot, H as on, I as onMount, J as debounce, K as unwrap, L as getDocumentParagraphs, M as getDocumentSectionsCanonical, N as createEditorDocument, O as getPageContentWidth, P as getDocumentPageSettings, Q as getTableCellContentWidthForParagraph, R as resolveResizedDimensions, S as resolveTextBoxRenderHeight, T as resolveEffectiveParagraphStyle, U as resolveEffectiveTextStyleForParagraph, V as iterateEndnoteReferenceRuns, W as JSZip, X as imageContentTypeDefaults, Y as imageExtensionFromMime, Z as pxToPt$1, _ as textStyleToFontSizePt, $ as PX_PER_POINT, a0 as DEFAULT_FONT_SIZE_PX, a1 as isDoubleUnderlineStyle, a2 as isWavyUnderlineStyle, a3 as underlineStyleLineWidthPx, a4 as underlineStyleDashArray, a5 as getListLabelInset, a6 as getParagraphBorderInsets, a7 as buildSegmentTable, a8 as buildCanvasTableLayout, a9 as normalizeFamily, aa as ROBOTO_FONT_FILES, ab as loadFontAsset, ac as OFFICE_COMPAT_FONT_FAMILIES, ad as buildSfnt, ae as defaultFontDecoderRegistry, af as SfntFontProgram, ag as collectPdfFontFamilies, ah as projectDocumentLayout, ai as getPageHeaderZoneTop, aj as getPageBodyTop, ak as findFootnoteReference, al as FOOTNOTE_MARKER_GUTTER_PX, am as resolveImporterForFile, an as createEditorStateFromDocument, ao as getDocumentParagraphsCanonical, ap as getToolbarStyleState, aq as STANDARD_FONT_SIZES_PT, ar as fontSizePxToPt, as as probeLocalFontFamilies, at as createInitialEditorState, au as parseFontSizePtToPx, av as formatFontSizePt, aw as listKindForTag, ax as isParagraphTag, ay as collectInlineRuns, az as parseParagraphStyle, aA as t, aB as preciseFontModeVersion, aC as isPreciseFontModeEnabled, aD as togglePreciseFontMode, aE as createDefaultToolbarPreset, aF as defaultMenuItems, aG as MenuRegistry, aH as createToolbarRegistry, aI as Editor, aJ as resolveCommandRef, aK as commandRefName, aL as InlineShell, aM as BalloonShell, aN as DocumentShell, aO as createMemo, aP as getCaretRectFromSnapshot, aQ as getParagraphRectFromSnapshot, aR as createComponent, aS as CaretOverlay, aT as Show, aU as createRenderEffect, aV as style, aW as setAttribute, aX as setStyleProperty, aY as memo, aZ as template, a_ as insert, a$ as use, b0 as addEventListener, b1 as Dialog, b2 as delegateEvents, b3 as className, b4 as For, b5 as UNDERLINE_STYLE_OPTIONS, b6 as Tabs, b7 as measureParagraphMinContentWidthPx, b8 as getEditableBlocksForZone, b9 as findParagraphLocation, ba as createSectionBoundaryParagraph, bb as normalizePageSettings, bc as DEFAULT_EDITOR_PAGE_SETTINGS, bd as markStart, be as markEnd, bf as getParagraphEntries, bg as getParagraphById, bh as PluginUiHost, bi as OasisEditorEditor, bj as perfTimer, bk as OasisBrandMark, bl as setPreciseFontPreference, bm as setWelcomeSeen, bn as enablePreciseFontMode, bo as createOasisEditorClient, bp as setLocale, bq as startLongTaskObserver, br as installGlobalReport, bs as applyStoredPreciseFontPreference, bt as getWelcomeSeen, bu as isLocalFontAccessSupported, bv as EDITOR_SCROLL_PADDING_PX, bw as Toolbar, bx as OasisEditorLoading, by as createEditorLogger, bz as getCachedCanvasImage, bA as registerDomStatsSurface } from "./index-
|
|
4
|
+
import { n as normalizeSelection, g as getParagraphs, c as createEditorParagraphFromRuns, a as createEditorStyledRun, b as getParagraphLength, d as getParagraphText, e as getActiveZone, f as getDocumentSections, h as getActiveSectionIndex, p as positionToParagraphOffset, i as paragraphOffsetToPosition, j as clampPosition, k as findParagraphIndex, l as createCollapsedSelection, m as isSelectionCollapsed, o as createEditorParagraph, q as getBlockParagraphs, r as findParagraphTableLocation, s as buildTableCellLayout, t as createEditorTableCell, u as createEditorTable, v as createEditorTableRow, w as underlineStyleToCssDecorationStyle, x as resolveImageSrc, y as createEditorFootnote, z as createFootnoteReferenceRun, A as renumberFootnotes, B as iterateFootnoteReferenceRuns, C as getFootnoteDisplayMarker, D as createSignal, E as createEffect, F as onCleanup, G as buildCanvasLayoutSnapshot, H as on, I as onMount, J as debounce, K as unwrap, L as getDocumentParagraphs, M as getDocumentSectionsCanonical, N as createEditorDocument, O as getPageContentWidth, P as getDocumentPageSettings, Q as getTableCellContentWidthForParagraph, R as resolveResizedDimensions, S as resolveTextBoxRenderHeight, T as resolveEffectiveParagraphStyle, U as resolveEffectiveTextStyleForParagraph, V as iterateEndnoteReferenceRuns, W as JSZip, X as imageContentTypeDefaults, Y as imageExtensionFromMime, Z as pxToPt$1, _ as textStyleToFontSizePt, $ as PX_PER_POINT, a0 as DEFAULT_FONT_SIZE_PX, a1 as isDoubleUnderlineStyle, a2 as isWavyUnderlineStyle, a3 as underlineStyleLineWidthPx, a4 as underlineStyleDashArray, a5 as getListLabelInset, a6 as getParagraphBorderInsets, a7 as buildSegmentTable, a8 as buildCanvasTableLayout, a9 as normalizeFamily, aa as ROBOTO_FONT_FILES, ab as loadFontAsset, ac as OFFICE_COMPAT_FONT_FAMILIES, ad as buildSfnt, ae as defaultFontDecoderRegistry, af as SfntFontProgram, ag as collectPdfFontFamilies, ah as projectDocumentLayout, ai as getPageHeaderZoneTop, aj as getPageBodyTop, ak as findFootnoteReference, al as FOOTNOTE_MARKER_GUTTER_PX, am as resolveImporterForFile, an as createEditorStateFromDocument, ao as getDocumentParagraphsCanonical, ap as getToolbarStyleState, aq as STANDARD_FONT_SIZES_PT, ar as fontSizePxToPt, as as probeLocalFontFamilies, at as createInitialEditorState, au as parseFontSizePtToPx, av as formatFontSizePt, aw as listKindForTag, ax as isParagraphTag, ay as collectInlineRuns, az as parseParagraphStyle, aA as t, aB as preciseFontModeVersion, aC as isPreciseFontModeEnabled, aD as togglePreciseFontMode, aE as createDefaultToolbarPreset, aF as defaultMenuItems, aG as MenuRegistry, aH as createToolbarRegistry, aI as Editor, aJ as resolveCommandRef, aK as commandRefName, aL as InlineShell, aM as BalloonShell, aN as DocumentShell, aO as createMemo, aP as getCaretRectFromSnapshot, aQ as getParagraphRectFromSnapshot, aR as createComponent, aS as CaretOverlay, aT as Show, aU as createRenderEffect, aV as style, aW as setAttribute, aX as setStyleProperty, aY as memo, aZ as template, a_ as insert, a$ as use, b0 as addEventListener, b1 as Dialog, b2 as delegateEvents, b3 as className, b4 as For, b5 as UNDERLINE_STYLE_OPTIONS, b6 as Tabs, b7 as measureParagraphMinContentWidthPx, b8 as getEditableBlocksForZone, b9 as findParagraphLocation, ba as createSectionBoundaryParagraph, bb as normalizePageSettings, bc as DEFAULT_EDITOR_PAGE_SETTINGS, bd as markStart, be as markEnd, bf as getParagraphEntries, bg as getParagraphById, bh as PluginUiHost, bi as OasisEditorEditor, bj as perfTimer, bk as OasisBrandMark, bl as setPreciseFontPreference, bm as setWelcomeSeen, bn as enablePreciseFontMode, bo as createOasisEditorClient, bp as setLocale, bq as startLongTaskObserver, br as installGlobalReport, bs as applyStoredPreciseFontPreference, bt as getWelcomeSeen, bu as isLocalFontAccessSupported, bv as EDITOR_SCROLL_PADDING_PX, bw as Toolbar, bx as OasisEditorLoading, by as createEditorLogger, bz as getCachedCanvasImage, bA as registerDomStatsSurface } from "./index-BGcbqj0Q.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) {
|
|
@@ -9206,17 +9206,53 @@ function buildDocumentRelationshipsXml(hasNumbering, hasSettings, images, hyperl
|
|
|
9206
9206
|
}
|
|
9207
9207
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${PACKAGE_REL_NS}">${rels}</Relationships>`;
|
|
9208
9208
|
}
|
|
9209
|
-
function buildSettingsXml(hasEvenAndOddHeaders, defaultTabStop) {
|
|
9209
|
+
function buildSettingsXml(hasEvenAndOddHeaders, defaultTabStop, footnoteSettings, endnoteSettings) {
|
|
9210
9210
|
const parts = [];
|
|
9211
9211
|
const defaultTabStopTwips = pointsToTwips(defaultTabStop);
|
|
9212
9212
|
if (defaultTabStopTwips !== null) {
|
|
9213
9213
|
parts.push(`<w:defaultTabStop w:val="${defaultTabStopTwips}"/>`);
|
|
9214
9214
|
}
|
|
9215
|
+
const footnotePr = serializeNoteSettings("footnotePr", footnoteSettings);
|
|
9216
|
+
if (footnotePr) {
|
|
9217
|
+
parts.push(footnotePr);
|
|
9218
|
+
}
|
|
9219
|
+
const endnotePr = serializeNoteSettings("endnotePr", endnoteSettings);
|
|
9220
|
+
if (endnotePr) {
|
|
9221
|
+
parts.push(endnotePr);
|
|
9222
|
+
}
|
|
9215
9223
|
if (hasEvenAndOddHeaders) {
|
|
9216
9224
|
parts.push("<w:evenAndOddHeaders/>");
|
|
9217
9225
|
}
|
|
9218
9226
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:settings xmlns:w="${WORD_NS$1}">${parts.join("")}</w:settings>`;
|
|
9219
9227
|
}
|
|
9228
|
+
const NOTE_NUMBER_FORMATS = {
|
|
9229
|
+
decimal: "decimal",
|
|
9230
|
+
lowerRoman: "lowerRoman",
|
|
9231
|
+
upperRoman: "upperRoman",
|
|
9232
|
+
lowerLetter: "lowerLetter",
|
|
9233
|
+
upperLetter: "upperLetter",
|
|
9234
|
+
symbol: "symbol"
|
|
9235
|
+
};
|
|
9236
|
+
const NOTE_RESTARTS = {
|
|
9237
|
+
continuous: "continuous",
|
|
9238
|
+
eachSection: "eachSect"
|
|
9239
|
+
};
|
|
9240
|
+
function serializeNoteSettings(tagName, settings) {
|
|
9241
|
+
if (!settings) return null;
|
|
9242
|
+
const parts = [];
|
|
9243
|
+
if (settings.numberFormat) {
|
|
9244
|
+
parts.push(
|
|
9245
|
+
`<w:numFmt w:val="${NOTE_NUMBER_FORMATS[settings.numberFormat]}"/>`
|
|
9246
|
+
);
|
|
9247
|
+
}
|
|
9248
|
+
if (settings.startAt !== void 0) {
|
|
9249
|
+
parts.push(`<w:numStart w:val="${Math.max(1, settings.startAt)}"/>`);
|
|
9250
|
+
}
|
|
9251
|
+
if (settings.restart) {
|
|
9252
|
+
parts.push(`<w:numRestart w:val="${NOTE_RESTARTS[settings.restart]}"/>`);
|
|
9253
|
+
}
|
|
9254
|
+
return parts.length > 0 ? `<w:${tagName}>${parts.join("")}</w:${tagName}>` : null;
|
|
9255
|
+
}
|
|
9220
9256
|
function buildPartRelationshipsXml(images, hyperlinks) {
|
|
9221
9257
|
let rels = "";
|
|
9222
9258
|
for (const hyperlink of hyperlinks) {
|
|
@@ -9229,7 +9265,7 @@ function buildPartRelationshipsXml(images, hyperlinks) {
|
|
|
9229
9265
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${PACKAGE_REL_NS}">${rels}</Relationships>`;
|
|
9230
9266
|
}
|
|
9231
9267
|
async function exportEditorDocumentToDocx(document2) {
|
|
9232
|
-
var _a, _b;
|
|
9268
|
+
var _a, _b, _c, _d, _e, _f;
|
|
9233
9269
|
const zip = new JSZip();
|
|
9234
9270
|
const numberingContext = buildNumberingContext(document2);
|
|
9235
9271
|
const buildState = {
|
|
@@ -9309,7 +9345,7 @@ async function exportEditorDocumentToDocx(document2) {
|
|
|
9309
9345
|
return (((_a2 = section.evenPageHeader) == null ? void 0 : _a2.length) ?? 0) > 0 || (((_b2 = section.evenPageFooter) == null ? void 0 : _b2.length) ?? 0) > 0;
|
|
9310
9346
|
}
|
|
9311
9347
|
);
|
|
9312
|
-
const hasDocumentSettings = hasEvenAndOddHeaders || ((_a = document2.settings) == null ? void 0 : _a.defaultTabStop) !== void 0;
|
|
9348
|
+
const hasDocumentSettings = hasEvenAndOddHeaders || ((_a = document2.settings) == null ? void 0 : _a.defaultTabStop) !== void 0 || ((_b = document2.footnotes) == null ? void 0 : _b.settings) !== void 0 || ((_c = document2.endnotes) == null ? void 0 : _c.settings) !== void 0;
|
|
9313
9349
|
const allImages = [
|
|
9314
9350
|
...bodyContext.images,
|
|
9315
9351
|
...parts.flatMap((part) => part.context.images)
|
|
@@ -9387,7 +9423,12 @@ async function exportEditorDocumentToDocx(document2) {
|
|
|
9387
9423
|
if (hasDocumentSettings) {
|
|
9388
9424
|
zip.file(
|
|
9389
9425
|
"word/settings.xml",
|
|
9390
|
-
buildSettingsXml(
|
|
9426
|
+
buildSettingsXml(
|
|
9427
|
+
hasEvenAndOddHeaders,
|
|
9428
|
+
(_d = document2.settings) == null ? void 0 : _d.defaultTabStop,
|
|
9429
|
+
(_e = document2.footnotes) == null ? void 0 : _e.settings,
|
|
9430
|
+
(_f = document2.endnotes) == null ? void 0 : _f.settings
|
|
9431
|
+
)
|
|
9391
9432
|
);
|
|
9392
9433
|
}
|
|
9393
9434
|
for (const part of parts) {
|