oasis-editor 0.0.5 → 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--PhUmweO.js → OasisEditorApp-Ck4oFAf-.js} +54 -6
- package/dist/assets/{importDocxWorker-C6O0dO38.js → importDocxWorker-DbiKelzX.js} +1 -1
- package/dist/core/model/types/styles.d.ts +2 -0
- package/dist/import/docx/settings.d.ts +4 -0
- package/dist/{index-Buc11g2W.js → index-BGcbqj0Q.js} +73 -6
- 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) {
|
|
@@ -7755,7 +7755,8 @@ function materializeParagraphStyle(paragraph, styles) {
|
|
|
7755
7755
|
borderBottom: effective.borderBottom,
|
|
7756
7756
|
borderLeft: effective.borderLeft,
|
|
7757
7757
|
tabs: effective.tabs,
|
|
7758
|
-
textDirection: effective.textDirection
|
|
7758
|
+
textDirection: effective.textDirection,
|
|
7759
|
+
outlineLevel: effective.outlineLevel
|
|
7759
7760
|
};
|
|
7760
7761
|
}
|
|
7761
7762
|
function materializeRunStyle(run, paragraphStyleId, styles) {
|
|
@@ -7875,6 +7876,9 @@ function serializeParagraphStyleXml(style2) {
|
|
|
7875
7876
|
if (style2.textDirection) {
|
|
7876
7877
|
parts.push(`<w:textDirection w:val="${style2.textDirection}"/>`);
|
|
7877
7878
|
}
|
|
7879
|
+
if (style2.outlineLevel != null) {
|
|
7880
|
+
parts.push(`<w:outlineLvl w:val="${style2.outlineLevel}"/>`);
|
|
7881
|
+
}
|
|
7878
7882
|
return parts.length > 0 ? `<w:pPr>${parts.join("")}</w:pPr>` : "";
|
|
7879
7883
|
}
|
|
7880
7884
|
function serializeParagraphProperties(paragraph, numberingInfo, styles, overrides) {
|
|
@@ -7933,6 +7937,9 @@ function serializeParagraphProperties(paragraph, numberingInfo, styles, override
|
|
|
7933
7937
|
if (style2.textDirection) {
|
|
7934
7938
|
parts.push(`<w:textDirection w:val="${style2.textDirection}"/>`);
|
|
7935
7939
|
}
|
|
7940
|
+
if (style2.outlineLevel != null) {
|
|
7941
|
+
parts.push(`<w:outlineLvl w:val="${style2.outlineLevel}"/>`);
|
|
7942
|
+
}
|
|
7936
7943
|
const numbering = numberingInfo.get(paragraph.id);
|
|
7937
7944
|
if (numbering) {
|
|
7938
7945
|
parts.push(
|
|
@@ -9199,17 +9206,53 @@ function buildDocumentRelationshipsXml(hasNumbering, hasSettings, images, hyperl
|
|
|
9199
9206
|
}
|
|
9200
9207
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${PACKAGE_REL_NS}">${rels}</Relationships>`;
|
|
9201
9208
|
}
|
|
9202
|
-
function buildSettingsXml(hasEvenAndOddHeaders, defaultTabStop) {
|
|
9209
|
+
function buildSettingsXml(hasEvenAndOddHeaders, defaultTabStop, footnoteSettings, endnoteSettings) {
|
|
9203
9210
|
const parts = [];
|
|
9204
9211
|
const defaultTabStopTwips = pointsToTwips(defaultTabStop);
|
|
9205
9212
|
if (defaultTabStopTwips !== null) {
|
|
9206
9213
|
parts.push(`<w:defaultTabStop w:val="${defaultTabStopTwips}"/>`);
|
|
9207
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
|
+
}
|
|
9208
9223
|
if (hasEvenAndOddHeaders) {
|
|
9209
9224
|
parts.push("<w:evenAndOddHeaders/>");
|
|
9210
9225
|
}
|
|
9211
9226
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:settings xmlns:w="${WORD_NS$1}">${parts.join("")}</w:settings>`;
|
|
9212
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
|
+
}
|
|
9213
9256
|
function buildPartRelationshipsXml(images, hyperlinks) {
|
|
9214
9257
|
let rels = "";
|
|
9215
9258
|
for (const hyperlink of hyperlinks) {
|
|
@@ -9222,7 +9265,7 @@ function buildPartRelationshipsXml(images, hyperlinks) {
|
|
|
9222
9265
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${PACKAGE_REL_NS}">${rels}</Relationships>`;
|
|
9223
9266
|
}
|
|
9224
9267
|
async function exportEditorDocumentToDocx(document2) {
|
|
9225
|
-
var _a, _b;
|
|
9268
|
+
var _a, _b, _c, _d, _e, _f;
|
|
9226
9269
|
const zip = new JSZip();
|
|
9227
9270
|
const numberingContext = buildNumberingContext(document2);
|
|
9228
9271
|
const buildState = {
|
|
@@ -9302,7 +9345,7 @@ async function exportEditorDocumentToDocx(document2) {
|
|
|
9302
9345
|
return (((_a2 = section.evenPageHeader) == null ? void 0 : _a2.length) ?? 0) > 0 || (((_b2 = section.evenPageFooter) == null ? void 0 : _b2.length) ?? 0) > 0;
|
|
9303
9346
|
}
|
|
9304
9347
|
);
|
|
9305
|
-
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;
|
|
9306
9349
|
const allImages = [
|
|
9307
9350
|
...bodyContext.images,
|
|
9308
9351
|
...parts.flatMap((part) => part.context.images)
|
|
@@ -9380,7 +9423,12 @@ async function exportEditorDocumentToDocx(document2) {
|
|
|
9380
9423
|
if (hasDocumentSettings) {
|
|
9381
9424
|
zip.file(
|
|
9382
9425
|
"word/settings.xml",
|
|
9383
|
-
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
|
+
)
|
|
9384
9432
|
);
|
|
9385
9433
|
}
|
|
9386
9434
|
for (const part of parts) {
|