oasis-editor 0.0.35 → 0.0.37
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-s0BpEyzt.js → OasisEditorApp-_Y9wmRVS.js} +31 -13
- package/dist/assets/{importDocxWorker-xRrspiYv.js → importDocxWorker-CMMv6C-7.js} +1 -1
- package/dist/export/docx/text/runXml.d.ts +3 -2
- package/dist/export/docx/text/textBoxRunXml.d.ts +9 -2
- package/dist/import/docx/nestedBlocks.d.ts +8 -0
- package/dist/import/docx/paragraphs.d.ts +3 -2
- package/dist/import/docx/tables.d.ts +2 -1
- package/dist/{index-BOYdiFMb.js → index-CXQHbZ10.js} +266 -216
- 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 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, q as createEditorParagraph, r as getBlockParagraphs, s as findParagraphTableLocation, t as buildTableCellLayout, u as createEditorTableCell, v as createEditorTableRow, w as createEditorTable, x as underlineStyleToCssDecorationStyle, y as resolveImageSrc, z as createEditorFootnote, A as createFootnoteReferenceRun, B as renumberFootnotes, C as iterateFootnoteReferenceRuns, D as getFootnoteDisplayMarker, E as createSignal, F as createEffect, G as onCleanup, H as buildCanvasLayoutSnapshot, I as on, J as onMount, K as debounce, L as unwrap, M as getDocumentParagraphs, N as getDocumentSectionsCanonical, O as createEditorDocument, P as getPageContentWidth, Q as getDocumentPageSettings, R as getTableCellContentWidthForParagraph, S as resolveResizedDimensions, T as resolveTextBoxRenderHeight, U as resolveEffectiveParagraphStyle, V as resolveEffectiveTextStyleForParagraph, W as iterateEndnoteReferenceRuns, X as JSZip, Y as imageContentTypeDefaults, Z as imageExtensionFromMime, _ as pxToPt$1, $ as buildSegmentTable, a0 as buildCanvasTableLayout, a1 as resolveFloatingObjectRect, a2 as getTextBoxFloatingGeometry, a3 as getPresetPathSegments, a4 as projectBlocksLayout, a5 as buildListLabels, a6 as textStyleToFontSizePt, a7 as PX_PER_POINT, a8 as DEFAULT_FONT_SIZE_PX, a9 as isDoubleUnderlineStyle, aa as isWavyUnderlineStyle, ab as underlineStyleLineWidthPx, ac as underlineStyleDashArray, ad as resolveListLabel, ae as getListLabelInset, af as getAlignedListLabelInset, ag as getParagraphBorderInsets, ah as normalizeFamily, ai as ROBOTO_FONT_FILES, aj as loadFontAsset, ak as OFFICE_COMPAT_FONT_FAMILIES, al as buildSfnt, am as defaultFontDecoderRegistry, an as SfntFontProgram, ao as collectPdfFontFamilies, ap as projectDocumentLayout, aq as getPageHeaderZoneTop, ar as getPageBodyTop, as as getPageColumnRects, at as findFootnoteReference, au as FOOTNOTE_MARKER_GUTTER_PX, av as resolveImporterForFile, aw as createEditorStateFromDocument, ax as getDocumentParagraphsCanonical, ay as getToolbarStyleState, az as STANDARD_FONT_SIZES_PT, aA as fontSizePxToPt, aB as probeLocalFontFamilies, aC as createInitialEditorState, aD as parseFontSizePtToPx, aE as formatFontSizePt, aF as listKindForTag, aG as isParagraphTag, aH as collectInlineRuns, aI as parseParagraphStyle, aJ as getHeadingLevel, aK as preciseFontModeVersion, aL as isPreciseFontModeEnabled, aM as togglePreciseFontMode, aN as nextFontSizePt, aO as previousFontSizePt, aP as fontSizePtToPx, aQ as createDefaultToolbarPreset, aR as MenuRegistry, aS as createToolbarRegistry, aT as Editor, aU as resolveCommandRef, aV as commandRefName, aW as InlineShell, aX as BalloonShell, aY as DocumentShell, aZ as createMemo, a_ as getCaretRectFromSnapshot, a$ as getParagraphRectFromSnapshot, b0 as createComponent, b1 as CaretOverlay, b2 as Show, b3 as createRenderEffect, b4 as style, b5 as setAttribute, b6 as setStyleProperty, b7 as memo, b8 as template, b9 as useI18n, ba as insert, bb as use, bc as addEventListener, bd as Dialog, be as delegateEvents, bf as className, bg as For, bh as UNDERLINE_STYLE_OPTIONS, bi as Tabs, bj as measureParagraphMinContentWidthPx, bk as getEditableBlocksForZone, bl as findParagraphLocation, bm as createSectionBoundaryParagraph, bn as normalizePageSettings, bo as DEFAULT_EDITOR_PAGE_SETTINGS, bp as markStart, bq as markEnd, br as getParagraphEntries, bs as getParagraphById, bt as PluginUiHost, bu as OasisEditorEditor, bv as perfTimer, bw as OasisBrandMark, bx as setPreciseFontPreference, by as setWelcomeSeen, bz as enablePreciseFontMode, bA as createOasisEditorClient, bB as createEditorZoom, bC as startLongTaskObserver, bD as installGlobalReport, bE as applyStoredPreciseFontPreference, bF as getWelcomeSeen, bG as isLocalFontAccessSupported, bH as EDITOR_SCROLL_PADDING_PX, bI as Toolbar, bJ as OasisEditorLoading, bK as I18nProvider, bL as createEditorLogger, bM as createTranslator, bN as getCachedCanvasImage, bO 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, q as createEditorParagraph, r as getBlockParagraphs, s as findParagraphTableLocation, t as buildTableCellLayout, u as createEditorTableCell, v as createEditorTableRow, w as createEditorTable, x as underlineStyleToCssDecorationStyle, y as resolveImageSrc, z as createEditorFootnote, A as createFootnoteReferenceRun, B as renumberFootnotes, C as iterateFootnoteReferenceRuns, D as getFootnoteDisplayMarker, E as createSignal, F as createEffect, G as onCleanup, H as buildCanvasLayoutSnapshot, I as on, J as onMount, K as debounce, L as unwrap, M as getDocumentParagraphs, N as getDocumentSectionsCanonical, O as createEditorDocument, P as getPageContentWidth, Q as getDocumentPageSettings, R as getTableCellContentWidthForParagraph, S as resolveResizedDimensions, T as resolveTextBoxRenderHeight, U as resolveEffectiveParagraphStyle, V as resolveEffectiveTextStyleForParagraph, W as iterateEndnoteReferenceRuns, X as JSZip, Y as imageContentTypeDefaults, Z as imageExtensionFromMime, _ as pxToPt$1, $ as buildSegmentTable, a0 as buildCanvasTableLayout, a1 as resolveFloatingObjectRect, a2 as getTextBoxFloatingGeometry, a3 as getPresetPathSegments, a4 as projectBlocksLayout, a5 as buildListLabels, a6 as textStyleToFontSizePt, a7 as PX_PER_POINT, a8 as DEFAULT_FONT_SIZE_PX, a9 as isDoubleUnderlineStyle, aa as isWavyUnderlineStyle, ab as underlineStyleLineWidthPx, ac as underlineStyleDashArray, ad as resolveListLabel, ae as getListLabelInset, af as getAlignedListLabelInset, ag as getParagraphBorderInsets, ah as normalizeFamily, ai as ROBOTO_FONT_FILES, aj as loadFontAsset, ak as OFFICE_COMPAT_FONT_FAMILIES, al as buildSfnt, am as defaultFontDecoderRegistry, an as SfntFontProgram, ao as collectPdfFontFamilies, ap as projectDocumentLayout, aq as getPageHeaderZoneTop, ar as getPageBodyTop, as as getPageColumnRects, at as findFootnoteReference, au as FOOTNOTE_MARKER_GUTTER_PX, av as resolveImporterForFile, aw as createEditorStateFromDocument, ax as getDocumentParagraphsCanonical, ay as getToolbarStyleState, az as STANDARD_FONT_SIZES_PT, aA as fontSizePxToPt, aB as probeLocalFontFamilies, aC as createInitialEditorState, aD as parseFontSizePtToPx, aE as formatFontSizePt, aF as listKindForTag, aG as isParagraphTag, aH as collectInlineRuns, aI as parseParagraphStyle, aJ as getHeadingLevel, aK as preciseFontModeVersion, aL as isPreciseFontModeEnabled, aM as togglePreciseFontMode, aN as nextFontSizePt, aO as previousFontSizePt, aP as fontSizePtToPx, aQ as createDefaultToolbarPreset, aR as MenuRegistry, aS as createToolbarRegistry, aT as Editor, aU as resolveCommandRef, aV as commandRefName, aW as InlineShell, aX as BalloonShell, aY as DocumentShell, aZ as createMemo, a_ as getCaretRectFromSnapshot, a$ as getParagraphRectFromSnapshot, b0 as createComponent, b1 as CaretOverlay, b2 as Show, b3 as createRenderEffect, b4 as style, b5 as setAttribute, b6 as setStyleProperty, b7 as memo, b8 as template, b9 as useI18n, ba as insert, bb as use, bc as addEventListener, bd as Dialog, be as delegateEvents, bf as className, bg as For, bh as UNDERLINE_STYLE_OPTIONS, bi as Tabs, bj as measureParagraphMinContentWidthPx, bk as getEditableBlocksForZone, bl as findParagraphLocation, bm as createSectionBoundaryParagraph, bn as normalizePageSettings, bo as DEFAULT_EDITOR_PAGE_SETTINGS, bp as markStart, bq as markEnd, br as getParagraphEntries, bs as getParagraphById, bt as PluginUiHost, bu as OasisEditorEditor, bv as perfTimer, bw as OasisBrandMark, bx as setPreciseFontPreference, by as setWelcomeSeen, bz as enablePreciseFontMode, bA as createOasisEditorClient, bB as createEditorZoom, bC as startLongTaskObserver, bD as installGlobalReport, bE as applyStoredPreciseFontPreference, bF as getWelcomeSeen, bG as isLocalFontAccessSupported, bH as EDITOR_SCROLL_PADDING_PX, bI as Toolbar, bJ as OasisEditorLoading, bK as I18nProvider, bL as createEditorLogger, bM as createTranslator, bN as getCachedCanvasImage, bO as registerDomStatsSurface } from "./index-CXQHbZ10.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) {
|
|
@@ -8913,7 +8913,7 @@ function serializeImageRun(runId, rId, context, rPrXml) {
|
|
|
8913
8913
|
const drawing = buildDrawingXml(img, docPrId, altAttr, picXml);
|
|
8914
8914
|
return `<w:r>${rPrXml}${drawing}</w:r>`;
|
|
8915
8915
|
}
|
|
8916
|
-
function buildTextBoxGraphicXml(textBox, cx, cy, context, styles) {
|
|
8916
|
+
function buildTextBoxGraphicXml(textBox, cx, cy, context, styles, serializeBlocksXml2) {
|
|
8917
8917
|
const shape = textBox.shape;
|
|
8918
8918
|
const preset = escapeXml((shape == null ? void 0 : shape.preset) ?? "rect");
|
|
8919
8919
|
const rotValue = textBox.rotation ? Math.round(textBox.rotation * OOXML_ROTATION_UNITS) : 0;
|
|
@@ -8947,18 +8947,25 @@ function buildTextBoxGraphicXml(textBox, cx, cy, context, styles) {
|
|
|
8947
8947
|
bodyAttrs.push('anchorCtr="0"');
|
|
8948
8948
|
const autoFitXml = (body == null ? void 0 : body.autoFit) ? "<a:spAutoFit/>" : "";
|
|
8949
8949
|
const hasTextBoxContent = textBox.blocks.length > 0;
|
|
8950
|
-
const innerXml = hasTextBoxContent ?
|
|
8950
|
+
const innerXml = hasTextBoxContent ? serializeBlocksXml2(textBox.blocks, context, styles) : "";
|
|
8951
8951
|
const cNvSpPrXml = hasTextBoxContent ? '<wps:cNvSpPr txBox="1"><a:spLocks noChangeArrowheads="1"/></wps:cNvSpPr>' : "<wps:cNvSpPr/>";
|
|
8952
8952
|
const txbxXml = hasTextBoxContent ? `<wps:txbx><w:txbxContent>${innerXml}</w:txbxContent></wps:txbx>` : "";
|
|
8953
8953
|
return '<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:graphicData uri="http://schemas.microsoft.com/office/word/2010/wordprocessingShape"><wps:wsp>' + cNvSpPrXml + `<wps:spPr bwMode="auto"><a:xfrm${xfrmRotAttr}><a:off x="0" y="0"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm><a:prstGeom prst="${preset}"><a:avLst/></a:prstGeom>` + fillXml + lnXml + "</wps:spPr>" + txbxXml + `<wps:bodyPr ${bodyAttrs.join(" ")}>${autoFitXml}</wps:bodyPr></wps:wsp></a:graphicData></a:graphic>`;
|
|
8954
8954
|
}
|
|
8955
|
-
function serializeTextBoxRun(run, textBox, context, styles, rPrXml) {
|
|
8955
|
+
function serializeTextBoxRun(run, textBox, context, styles, rPrXml, serializeBlocksXml2) {
|
|
8956
8956
|
const cx = Math.round(textBox.width * EMU_PER_PX);
|
|
8957
8957
|
const cy = Math.round(textBox.height * EMU_PER_PX);
|
|
8958
8958
|
const docPrId = context.textBoxDocPrIds.get(run.id) ?? 1;
|
|
8959
8959
|
const docPrName = textBox.name ?? "Text Box";
|
|
8960
8960
|
const altAttr = textBox.alt !== void 0 ? ` descr="${escapeXml(textBox.alt)}" title="${escapeXml(textBox.alt)}"` : "";
|
|
8961
|
-
const graphicXml = buildTextBoxGraphicXml(
|
|
8961
|
+
const graphicXml = buildTextBoxGraphicXml(
|
|
8962
|
+
textBox,
|
|
8963
|
+
cx,
|
|
8964
|
+
cy,
|
|
8965
|
+
context,
|
|
8966
|
+
styles,
|
|
8967
|
+
serializeBlocksXml2
|
|
8968
|
+
);
|
|
8962
8969
|
const drawing = buildDrawingContainerXml({
|
|
8963
8970
|
cx,
|
|
8964
8971
|
cy,
|
|
@@ -9027,7 +9034,7 @@ function wrapRunWithHyperlink(runXml, link, context) {
|
|
|
9027
9034
|
}
|
|
9028
9035
|
return `<w:hyperlink r:id="${rId}">${runXml}</w:hyperlink>`;
|
|
9029
9036
|
}
|
|
9030
|
-
function serializeRun(run, context, paragraphStyleId, styles) {
|
|
9037
|
+
function serializeRun(run, context, paragraphStyleId, styles, serializeBlocksXml2) {
|
|
9031
9038
|
if (run.__isFootnoteRefMarker) {
|
|
9032
9039
|
return serializeFootnoteRefMarker();
|
|
9033
9040
|
}
|
|
@@ -9083,7 +9090,8 @@ function serializeRun(run, context, paragraphStyleId, styles) {
|
|
|
9083
9090
|
run.textBox,
|
|
9084
9091
|
context,
|
|
9085
9092
|
styles,
|
|
9086
|
-
serializeRunProperties(materializedRunStyle)
|
|
9093
|
+
serializeRunProperties(materializedRunStyle),
|
|
9094
|
+
serializeBlocksXml2
|
|
9087
9095
|
);
|
|
9088
9096
|
}
|
|
9089
9097
|
if (run.image) {
|
|
@@ -9106,9 +9114,15 @@ function serializeRun(run, context, paragraphStyleId, styles) {
|
|
|
9106
9114
|
}
|
|
9107
9115
|
return `<w:r>${serializeRunProperties(materializedRunStyle)}${serializeRunText(run.text)}</w:r>`;
|
|
9108
9116
|
}
|
|
9109
|
-
function serializeRunWithRelationships(run, context, paragraphStyleId, styles) {
|
|
9117
|
+
function serializeRunWithRelationships(run, context, paragraphStyleId, styles, serializeBlocksXml2) {
|
|
9110
9118
|
var _a;
|
|
9111
|
-
const runXml = serializeRun(
|
|
9119
|
+
const runXml = serializeRun(
|
|
9120
|
+
run,
|
|
9121
|
+
context,
|
|
9122
|
+
paragraphStyleId,
|
|
9123
|
+
styles,
|
|
9124
|
+
serializeBlocksXml2
|
|
9125
|
+
);
|
|
9112
9126
|
const href = (_a = run.styles) == null ? void 0 : _a.link;
|
|
9113
9127
|
if (!href) {
|
|
9114
9128
|
return runXml;
|
|
@@ -9156,7 +9170,8 @@ function serializeRunsWithBoundaries(runs, tokens, context, paragraphStyleId, st
|
|
|
9156
9170
|
},
|
|
9157
9171
|
context,
|
|
9158
9172
|
paragraphStyleId,
|
|
9159
|
-
styles
|
|
9173
|
+
styles,
|
|
9174
|
+
serializeBlocksXml
|
|
9160
9175
|
);
|
|
9161
9176
|
}
|
|
9162
9177
|
out += token.xml;
|
|
@@ -9168,7 +9183,8 @@ function serializeRunsWithBoundaries(runs, tokens, context, paragraphStyleId, st
|
|
|
9168
9183
|
{ ...run, text: run.text.slice(cursor - runStart) },
|
|
9169
9184
|
context,
|
|
9170
9185
|
paragraphStyleId,
|
|
9171
|
-
styles
|
|
9186
|
+
styles,
|
|
9187
|
+
serializeBlocksXml
|
|
9172
9188
|
);
|
|
9173
9189
|
}
|
|
9174
9190
|
} else {
|
|
@@ -9176,7 +9192,8 @@ function serializeRunsWithBoundaries(runs, tokens, context, paragraphStyleId, st
|
|
|
9176
9192
|
run,
|
|
9177
9193
|
context,
|
|
9178
9194
|
paragraphStyleId,
|
|
9179
|
-
styles
|
|
9195
|
+
styles,
|
|
9196
|
+
serializeBlocksXml
|
|
9180
9197
|
);
|
|
9181
9198
|
}
|
|
9182
9199
|
pos = runEnd;
|
|
@@ -9233,7 +9250,8 @@ function serializeParagraphXml(paragraph, context, styles, overrides) {
|
|
|
9233
9250
|
run,
|
|
9234
9251
|
context,
|
|
9235
9252
|
(_a2 = paragraph.style) == null ? void 0 : _a2.styleId,
|
|
9236
|
-
styles
|
|
9253
|
+
styles,
|
|
9254
|
+
serializeBlocksXml
|
|
9237
9255
|
);
|
|
9238
9256
|
}
|
|
9239
9257
|
).join("");
|