oasis-editor 0.0.91 → 0.0.92
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-Cwd5XBHr.js → OasisEditorApp-C_Ao4zIF.js} +36 -11
- package/dist/assets/{importDocxWorker-6DqfSWfq.js → importDocxWorker-DAbfLHtp.js} +1 -1
- package/dist/core/engine.d.ts +16 -0
- package/dist/core/model/types/document.d.ts +8 -0
- package/dist/core/model/types/layout.d.ts +9 -0
- package/dist/export/docx/docxPackageXml.d.ts +7 -1
- package/dist/import/docx/settings.d.ts +4 -0
- package/dist/{index-C2DlzueH.js → index-BQEtsRa0.js} +438 -49
- package/dist/layoutProjection/paragraphPagination.d.ts +2 -1
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/ui/textMeasurement/hyphenation.d.ts +33 -0
- package/dist/ui/textMeasurement/types.d.ts +9 -2
- package/package.json +4 -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 { v as visitRun, a as assertNever, c as createSignal, b as createEditorStateFromDocument, d as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, f as fontSizePxToPt, p as probeLocalFontFamilies, e as createEditorParagraphFromRuns, i as isInlineObjectRun, g as createEditorStyledRun, h as getParagraphLength, j as getParagraphText, k as getActiveZone, l as getDocumentSections, m as getActiveSectionIndex, n as getParagraphs, o as normalizeSelection, q as positionToParagraphOffset, r as paragraphOffsetToPosition, s as clampPosition, t as findParagraphIndex, u as createCollapsedSelection, w as isSelectionCollapsed, x as parseFontSizePtToPx, y as formatFontSizePt, z as createEditorParagraph, A as getBlockParagraphs, B as findParagraphTableLocation, C as buildTableCellLayout, P as PT_PER_PX, D as createEditorTableCell, E as createEditorTableRow, F as createEditorTable, G as underlineStyleToCssDecorationStyle, H as resolveImageSrc, I as listKindForTag, J as isParagraphTag, K as collectInlineRuns, L as parseParagraphStyle, M as getRunImage, N as InlineShell, O as BalloonShell, Q as DocumentShell, R as createMemo, T as buildCanvasLayoutSnapshot, U as getCaretRectFromSnapshot, V as getParagraphRectFromSnapshot, W as createComponent, X as CaretOverlay, Y as Show, Z as createRenderEffect, _ as style, $ as setAttribute, a0 as setStyleProperty, a1 as memo, a2 as template, a3 as useI18n, a4 as createEffect, a5 as insert, a6 as use, a7 as addEventListener, a8 as Dialog, a9 as delegateEvents, aa as className, ab as For, ac as UNDERLINE_STYLE_OPTIONS, ad as Tabs, ae as onMount, af as onCleanup, ag as PluginUiHost, ah as OasisEditorEditor, ai as OasisBrandMark, aj as setPreciseFontPreference, ak as setWelcomeSeen, al as enablePreciseFontMode, am as TWIPS_PER_POINT, an as PX_PER_INCH, ao as TWIPS_PER_INCH, ap as resolveEffectiveParagraphStyle, aq as resolveEffectiveTextStyleForParagraph, ar as EMU_PER_PX, as as EMU_PER_PT, at as getRunFootnoteReference, au as getRunEndnoteReference, av as iterateFootnoteReferenceRuns, aw as iterateEndnoteReferenceRuns, ax as imageContentTypeDefaults, ay as getRunFieldChar, az as getRunFieldInstruction, aA as createEditorRun, aB as JSZip, aC as imageExtensionFromMime, aD as pxToPt$1, aE as resolveFloatingObjectRect, aF as getTextBoxFloatingGeometry, aG as getPresetPathSegments, aH as projectBlocksLayout, aI as buildListLabels, aJ as getImageFloatingGeometry, aK as textStyleToFontSizePt, aL as PX_PER_POINT, aM as DEFAULT_FONT_SIZE_PX, aN as isDoubleUnderlineStyle, aO as isWavyUnderlineStyle, aP as underlineStyleLineWidthPx, aQ as underlineStyleDashArray, aR as resolveListLabel, aS as getListLabelInset, aT as getAlignedListLabelInset, aU as getParagraphBorderInsets, aV as buildSegmentTable, aW as buildCanvasTableLayout, aX as resolveCanvasTableWidth, aY as resolveFloatingTableRect, aZ as normalizeFamily, a_ as ROBOTO_FONT_FILES, a$ as loadFontAsset, b0 as OFFICE_COMPAT_FONT_FAMILIES, b1 as buildSfnt, b2 as defaultFontDecoderRegistry, b3 as SfntFontProgram, b4 as collectPdfFontFamilies, b5 as projectDocumentLayout, b6 as getPageContentWidth, b7 as getPageHeaderZoneTop, b8 as getPageBodyTop, b9 as getPageColumnRects, ba as findFootnoteReference, bb as FOOTNOTE_MARKER_GUTTER_PX, bc as resolveImporterForFile, bd as getDocumentSectionsCanonical, be as getDocumentParagraphsCanonical, bf as getDocumentParagraphs, bg as getDocumentPageSettings, bh as getTableCellContentWidthForParagraph, bi as on, bj as debounce, bk as unwrap, bl as perfTimer, bm as getRunTextBox, bn as createEditorDocument, bo as resolveResizedDimensions, bp as resolveTextBoxRenderHeight, bq as getToolbarStyleState, br as getCachedCanvasImage, bs as measureParagraphMinContentWidthPx, bt as getEditableBlocksForZone, bu as findParagraphLocation, bv as createSectionBoundaryParagraph, bw as normalizePageSettings, bx as DEFAULT_EDITOR_PAGE_SETTINGS, by as markStart, bz as markEnd, bA as getParagraphEntries, bB as getParagraphById, bC as createEditorFootnote, bD as createFootnoteReferenceRun, bE as renumberFootnotes, bF as getFootnoteDisplayMarker, bG as getHeadingLevel, bH as preciseFontModeVersion, bI as isPreciseFontModeEnabled, bJ as resolveNamedTextStyle, bK as togglePreciseFontMode, bL as nextFontSizePt, bM as previousFontSizePt, bN as fontSizePtToPx, bO as createDefaultToolbarPreset, bP as MenuRegistry, bQ as createToolbarRegistry, bR as Editor, bS as resolveCommandRef, bT as commandRefName, bU as createOasisEditorClient, bV as createEditorZoom, bW as startLongTaskObserver, bX as installGlobalReport, bY as applyStoredPreciseFontPreference, bZ as getWelcomeSeen, b_ as isLocalFontAccessSupported, b$ as EDITOR_SCROLL_PADDING_PX, c0 as Toolbar, c1 as OasisEditorLoading, c2 as I18nProvider, c3 as createTranslator, c4 as createEditorLogger, c5 as registerDomStatsSurface } from "./index-
|
|
4
|
+
import { v as visitRun, a as assertNever, c as createSignal, b as createEditorStateFromDocument, d as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, f as fontSizePxToPt, p as probeLocalFontFamilies, e as createEditorParagraphFromRuns, i as isInlineObjectRun, g as createEditorStyledRun, h as getParagraphLength, j as getParagraphText, k as getActiveZone, l as getDocumentSections, m as getActiveSectionIndex, n as getParagraphs, o as normalizeSelection, q as positionToParagraphOffset, r as paragraphOffsetToPosition, s as clampPosition, t as findParagraphIndex, u as createCollapsedSelection, w as isSelectionCollapsed, x as parseFontSizePtToPx, y as formatFontSizePt, z as createEditorParagraph, A as getBlockParagraphs, B as findParagraphTableLocation, C as buildTableCellLayout, P as PT_PER_PX, D as createEditorTableCell, E as createEditorTableRow, F as createEditorTable, G as underlineStyleToCssDecorationStyle, H as resolveImageSrc, I as listKindForTag, J as isParagraphTag, K as collectInlineRuns, L as parseParagraphStyle, M as getRunImage, N as InlineShell, O as BalloonShell, Q as DocumentShell, R as createMemo, T as buildCanvasLayoutSnapshot, U as getCaretRectFromSnapshot, V as getParagraphRectFromSnapshot, W as createComponent, X as CaretOverlay, Y as Show, Z as createRenderEffect, _ as style, $ as setAttribute, a0 as setStyleProperty, a1 as memo, a2 as template, a3 as useI18n, a4 as createEffect, a5 as insert, a6 as use, a7 as addEventListener, a8 as Dialog, a9 as delegateEvents, aa as className, ab as For, ac as UNDERLINE_STYLE_OPTIONS, ad as Tabs, ae as onMount, af as onCleanup, ag as PluginUiHost, ah as OasisEditorEditor, ai as OasisBrandMark, aj as setPreciseFontPreference, ak as setWelcomeSeen, al as enablePreciseFontMode, am as TWIPS_PER_POINT, an as PX_PER_INCH, ao as TWIPS_PER_INCH, ap as resolveEffectiveParagraphStyle, aq as resolveEffectiveTextStyleForParagraph, ar as EMU_PER_PX, as as EMU_PER_PT, at as getRunFootnoteReference, au as getRunEndnoteReference, av as iterateFootnoteReferenceRuns, aw as iterateEndnoteReferenceRuns, ax as imageContentTypeDefaults, ay as getRunFieldChar, az as getRunFieldInstruction, aA as createEditorRun, aB as JSZip, aC as imageExtensionFromMime, aD as pxToPt$1, aE as resolveFloatingObjectRect, aF as getTextBoxFloatingGeometry, aG as getPresetPathSegments, aH as projectBlocksLayout, aI as buildListLabels, aJ as getImageFloatingGeometry, aK as textStyleToFontSizePt, aL as PX_PER_POINT, aM as DEFAULT_FONT_SIZE_PX, aN as isDoubleUnderlineStyle, aO as isWavyUnderlineStyle, aP as underlineStyleLineWidthPx, aQ as underlineStyleDashArray, aR as resolveListLabel, aS as getListLabelInset, aT as getAlignedListLabelInset, aU as getParagraphBorderInsets, aV as buildSegmentTable, aW as buildCanvasTableLayout, aX as resolveCanvasTableWidth, aY as resolveFloatingTableRect, aZ as normalizeFamily, a_ as ROBOTO_FONT_FILES, a$ as loadFontAsset, b0 as OFFICE_COMPAT_FONT_FAMILIES, b1 as buildSfnt, b2 as defaultFontDecoderRegistry, b3 as SfntFontProgram, b4 as collectPdfFontFamilies, b5 as projectDocumentLayout, b6 as getPageContentWidth, b7 as getPageHeaderZoneTop, b8 as getPageBodyTop, b9 as getPageColumnRects, ba as findFootnoteReference, bb as FOOTNOTE_MARKER_GUTTER_PX, bc as resolveImporterForFile, bd as getDocumentSectionsCanonical, be as getDocumentParagraphsCanonical, bf as getDocumentParagraphs, bg as getDocumentPageSettings, bh as getTableCellContentWidthForParagraph, bi as on, bj as debounce, bk as unwrap, bl as perfTimer, bm as getRunTextBox, bn as createEditorDocument, bo as resolveResizedDimensions, bp as resolveTextBoxRenderHeight, bq as getToolbarStyleState, br as getCachedCanvasImage, bs as measureParagraphMinContentWidthPx, bt as getEditableBlocksForZone, bu as findParagraphLocation, bv as createSectionBoundaryParagraph, bw as normalizePageSettings, bx as DEFAULT_EDITOR_PAGE_SETTINGS, by as markStart, bz as markEnd, bA as getParagraphEntries, bB as getParagraphById, bC as createEditorFootnote, bD as createFootnoteReferenceRun, bE as renumberFootnotes, bF as getFootnoteDisplayMarker, bG as getHeadingLevel, bH as preciseFontModeVersion, bI as isPreciseFontModeEnabled, bJ as resolveNamedTextStyle, bK as togglePreciseFontMode, bL as nextFontSizePt, bM as previousFontSizePt, bN as fontSizePtToPx, bO as createDefaultToolbarPreset, bP as MenuRegistry, bQ as createToolbarRegistry, bR as Editor, bS as resolveCommandRef, bT as commandRefName, bU as createOasisEditorClient, bV as createEditorZoom, bW as startLongTaskObserver, bX as installGlobalReport, bY as applyStoredPreciseFontPreference, bZ as getWelcomeSeen, b_ as isLocalFontAccessSupported, b$ as EDITOR_SCROLL_PADDING_PX, c0 as Toolbar, c1 as OasisEditorLoading, c2 as I18nProvider, c3 as createTranslator, c4 as createEditorLogger, c5 as registerDomStatsSurface } from "./index-BQEtsRa0.js";
|
|
5
5
|
function cloneStyle(style2) {
|
|
6
6
|
return style2 ? { ...style2 } : void 0;
|
|
7
7
|
}
|
|
@@ -35065,12 +35065,27 @@ function serializeNoteSettings(tagName, settings) {
|
|
|
35065
35065
|
}
|
|
35066
35066
|
return parts.length > 0 ? `<w:${tagName}>${parts.join("")}</w:${tagName}>` : null;
|
|
35067
35067
|
}
|
|
35068
|
-
function buildSettingsXml(hasEvenAndOddHeaders, defaultTabStop, footnoteSettings, endnoteSettings, allowSpaceOfSameStyleInTable) {
|
|
35068
|
+
function buildSettingsXml(hasEvenAndOddHeaders, defaultTabStop, footnoteSettings, endnoteSettings, allowSpaceOfSameStyleInTable, hyphenation) {
|
|
35069
35069
|
const parts = [];
|
|
35070
35070
|
const defaultTabStopTwips = pointsToTwips(defaultTabStop);
|
|
35071
35071
|
if (defaultTabStopTwips !== null) {
|
|
35072
35072
|
parts.push(`<w:defaultTabStop w:val="${defaultTabStopTwips}"/>`);
|
|
35073
35073
|
}
|
|
35074
|
+
if (hyphenation == null ? void 0 : hyphenation.autoHyphenation) {
|
|
35075
|
+
parts.push("<w:autoHyphenation/>");
|
|
35076
|
+
}
|
|
35077
|
+
if ((hyphenation == null ? void 0 : hyphenation.consecutiveHyphenLimit) !== void 0 && hyphenation.consecutiveHyphenLimit >= 0) {
|
|
35078
|
+
parts.push(
|
|
35079
|
+
`<w:consecutiveHyphenLimit w:val="${hyphenation.consecutiveHyphenLimit}"/>`
|
|
35080
|
+
);
|
|
35081
|
+
}
|
|
35082
|
+
const hyphenationZoneTwips = pointsToTwips(hyphenation == null ? void 0 : hyphenation.hyphenationZone);
|
|
35083
|
+
if (hyphenationZoneTwips !== null) {
|
|
35084
|
+
parts.push(`<w:hyphenationZone w:val="${hyphenationZoneTwips}"/>`);
|
|
35085
|
+
}
|
|
35086
|
+
if (hyphenation == null ? void 0 : hyphenation.doNotHyphenateCaps) {
|
|
35087
|
+
parts.push("<w:doNotHyphenateCaps/>");
|
|
35088
|
+
}
|
|
35074
35089
|
const footnotePr = serializeNoteSettings("footnotePr", footnoteSettings);
|
|
35075
35090
|
if (footnotePr) {
|
|
35076
35091
|
parts.push(footnotePr);
|
|
@@ -35083,9 +35098,7 @@ function buildSettingsXml(hasEvenAndOddHeaders, defaultTabStop, footnoteSettings
|
|
|
35083
35098
|
parts.push("<w:evenAndOddHeaders/>");
|
|
35084
35099
|
}
|
|
35085
35100
|
if (allowSpaceOfSameStyleInTable) {
|
|
35086
|
-
parts.push(
|
|
35087
|
-
`<w:compat><w:allowSpaceOfSameStyleInTable/></w:compat>`
|
|
35088
|
-
);
|
|
35101
|
+
parts.push(`<w:compat><w:allowSpaceOfSameStyleInTable/></w:compat>`);
|
|
35089
35102
|
}
|
|
35090
35103
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:settings xmlns:w="${WORD_NS$1}">${parts.join("")}</w:settings>`;
|
|
35091
35104
|
}
|
|
@@ -35519,7 +35532,7 @@ function buildPartContext(blocks, numberingContext, state, document2) {
|
|
|
35519
35532
|
};
|
|
35520
35533
|
}
|
|
35521
35534
|
async function exportEditorDocumentToDocx(document2) {
|
|
35522
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
35535
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
35523
35536
|
document2 = renumberImageCaptionsInDocument(document2);
|
|
35524
35537
|
const zip = new JSZip();
|
|
35525
35538
|
const numberingContext = buildNumberingContext(document2);
|
|
@@ -35604,7 +35617,7 @@ async function exportEditorDocumentToDocx(document2) {
|
|
|
35604
35617
|
return (((_a2 = section.evenPageHeader) == null ? void 0 : _a2.length) ?? 0) > 0 || (((_b2 = section.evenPageFooter) == null ? void 0 : _b2.length) ?? 0) > 0;
|
|
35605
35618
|
}
|
|
35606
35619
|
);
|
|
35607
|
-
const hasDocumentSettings = hasEvenAndOddHeaders || ((_a = document2.settings) == null ? void 0 : _a.defaultTabStop) !== void 0 || ((_b = document2.settings) == null ? void 0 : _b.allowSpaceOfSameStyleInTable) !== void 0 || ((_c = document2.
|
|
35620
|
+
const hasDocumentSettings = hasEvenAndOddHeaders || ((_a = document2.settings) == null ? void 0 : _a.defaultTabStop) !== void 0 || ((_b = document2.settings) == null ? void 0 : _b.allowSpaceOfSameStyleInTable) !== void 0 || ((_c = document2.settings) == null ? void 0 : _c.autoHyphenation) !== void 0 || ((_d = document2.settings) == null ? void 0 : _d.consecutiveHyphenLimit) !== void 0 || ((_e = document2.settings) == null ? void 0 : _e.hyphenationZone) !== void 0 || ((_f = document2.settings) == null ? void 0 : _f.doNotHyphenateCaps) !== void 0 || ((_g = document2.footnotes) == null ? void 0 : _g.settings) !== void 0 || ((_h = document2.endnotes) == null ? void 0 : _h.settings) !== void 0;
|
|
35608
35621
|
const allImages = [
|
|
35609
35622
|
...bodyContext.images,
|
|
35610
35623
|
...parts.flatMap((part) => part.context.images)
|
|
@@ -35686,10 +35699,16 @@ async function exportEditorDocumentToDocx(document2) {
|
|
|
35686
35699
|
"word/settings.xml",
|
|
35687
35700
|
buildSettingsXml(
|
|
35688
35701
|
hasEvenAndOddHeaders,
|
|
35689
|
-
(
|
|
35690
|
-
(
|
|
35691
|
-
(
|
|
35692
|
-
(
|
|
35702
|
+
(_i = document2.settings) == null ? void 0 : _i.defaultTabStop,
|
|
35703
|
+
(_j = document2.footnotes) == null ? void 0 : _j.settings,
|
|
35704
|
+
(_k = document2.endnotes) == null ? void 0 : _k.settings,
|
|
35705
|
+
(_l = document2.settings) == null ? void 0 : _l.allowSpaceOfSameStyleInTable,
|
|
35706
|
+
{
|
|
35707
|
+
autoHyphenation: (_m = document2.settings) == null ? void 0 : _m.autoHyphenation,
|
|
35708
|
+
consecutiveHyphenLimit: (_n = document2.settings) == null ? void 0 : _n.consecutiveHyphenLimit,
|
|
35709
|
+
hyphenationZone: (_o = document2.settings) == null ? void 0 : _o.hyphenationZone,
|
|
35710
|
+
doNotHyphenateCaps: (_p = document2.settings) == null ? void 0 : _p.doNotHyphenateCaps
|
|
35711
|
+
}
|
|
35693
35712
|
)
|
|
35694
35713
|
);
|
|
35695
35714
|
}
|
|
@@ -36604,6 +36623,12 @@ async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, do
|
|
|
36604
36623
|
if (chunkText.length === 0) continue;
|
|
36605
36624
|
emitChunk(originX + chunk[0].left, chunkText);
|
|
36606
36625
|
}
|
|
36626
|
+
if (line.trailingHyphen && fragment.endOffset >= line.endOffset) {
|
|
36627
|
+
const endSlot = line.slots.find((slot) => slot.offset === line.endOffset) ?? line.slots[line.slots.length - 1];
|
|
36628
|
+
if (endSlot) {
|
|
36629
|
+
emitChunk(originX + endSlot.left, "-");
|
|
36630
|
+
}
|
|
36631
|
+
}
|
|
36607
36632
|
if (styles.underline) {
|
|
36608
36633
|
drawFragmentDecoration(
|
|
36609
36634
|
writer,
|