oasis-editor 0.0.96 → 0.0.97
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-CMTq6BTy.js → OasisEditorApp-m8k4gBW1.js} +76 -2
- package/dist/assets/{importDocxWorker-M34STPYy.js → importDocxWorker-BV6LezJZ.js} +1 -1
- package/dist/core/model/index.d.ts +1 -1
- package/dist/core/model/types/primitives.d.ts +23 -0
- package/dist/core/model/types/styles.d.ts +7 -1
- package/dist/{index-D0bOD23M.js → index-BiTnt_yD.js} +142 -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 { 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-BiTnt_yD.js";
|
|
5
5
|
function cloneStyle(style2) {
|
|
6
6
|
return style2 ? { ...style2 } : void 0;
|
|
7
7
|
}
|
|
@@ -29591,6 +29591,31 @@ function textRunStylesToCss(style2) {
|
|
|
29591
29591
|
const color = style2.textOutline.color ?? "#000000";
|
|
29592
29592
|
parts.push(`-webkit-text-stroke:${widthPx.toFixed(2)}px ${color}`);
|
|
29593
29593
|
}
|
|
29594
|
+
if (style2.textShadow) {
|
|
29595
|
+
const dirRad = style2.textShadow.dirDeg * Math.PI / 180;
|
|
29596
|
+
const px = (pt) => (pt * (96 / 72)).toFixed(2);
|
|
29597
|
+
const ox = (Math.cos(dirRad) * style2.textShadow.distPt * (96 / 72)).toFixed(
|
|
29598
|
+
2
|
|
29599
|
+
);
|
|
29600
|
+
const oy = (Math.sin(dirRad) * style2.textShadow.distPt * (96 / 72)).toFixed(
|
|
29601
|
+
2
|
|
29602
|
+
);
|
|
29603
|
+
const blur = px(style2.textShadow.blurPt);
|
|
29604
|
+
const alpha = style2.textShadow.alpha ?? 1;
|
|
29605
|
+
const r = parseInt(style2.textShadow.color.slice(1, 3), 16);
|
|
29606
|
+
const g = parseInt(style2.textShadow.color.slice(3, 5), 16);
|
|
29607
|
+
const b = parseInt(style2.textShadow.color.slice(5, 7), 16);
|
|
29608
|
+
parts.push(
|
|
29609
|
+
`text-shadow:${ox}px ${oy}px ${blur}px rgba(${r},${g},${b},${alpha})`
|
|
29610
|
+
);
|
|
29611
|
+
} else if (style2.glow) {
|
|
29612
|
+
const blur = (style2.glow.radiusPt * (96 / 72)).toFixed(2);
|
|
29613
|
+
const alpha = style2.glow.alpha ?? 0.7;
|
|
29614
|
+
const r = parseInt(style2.glow.color.slice(1, 3), 16);
|
|
29615
|
+
const g = parseInt(style2.glow.color.slice(3, 5), 16);
|
|
29616
|
+
const b = parseInt(style2.glow.color.slice(5, 7), 16);
|
|
29617
|
+
parts.push(`text-shadow:0 0 ${blur}px rgba(${r},${g},${b},${alpha})`);
|
|
29618
|
+
}
|
|
29594
29619
|
const decorations = [];
|
|
29595
29620
|
if (style2.underline || style2.link) {
|
|
29596
29621
|
decorations.push("underline");
|
|
@@ -33767,6 +33792,9 @@ function materializeRunStyle(run, paragraphStyleId, styles) {
|
|
|
33767
33792
|
color: effective.color,
|
|
33768
33793
|
textFill: effective.textFill,
|
|
33769
33794
|
textOutline: effective.textOutline,
|
|
33795
|
+
textShadow: effective.textShadow,
|
|
33796
|
+
glow: effective.glow,
|
|
33797
|
+
reflection: effective.reflection,
|
|
33770
33798
|
highlight: effective.highlight,
|
|
33771
33799
|
shading: effective.shading,
|
|
33772
33800
|
language: effective.language
|
|
@@ -33982,6 +34010,32 @@ function serializeTextOutlineMC(outline) {
|
|
|
33982
34010
|
const fillXml = outline.fill ? serializeW14FillXml(outline.fill) : outline.color ? serializeW14SolidFillXml(outline.color) : "";
|
|
33983
34011
|
return `<mc:AlternateContent xmlns:mc="${MC_NS}"><mc:Choice Requires="w14"><w14:textOutline w14:w="${widthEmu}" w14:cap="flat" w14:cmpd="sng" w14:algn="ctr">` + fillXml + `</w14:textOutline></mc:Choice><mc:Fallback><w:outline/></mc:Fallback></mc:AlternateContent>`;
|
|
33984
34012
|
}
|
|
34013
|
+
function serializeW14ColorEl(color, alpha) {
|
|
34014
|
+
const hex = normalizeDocxColor(color);
|
|
34015
|
+
const alphaXml = alpha !== void 0 ? `<w14:alpha w14:val="${Math.round(alpha * 1e5)}"/>` : "";
|
|
34016
|
+
return `<w14:srgbClr w14:val="${hex}">${alphaXml}</w14:srgbClr>`;
|
|
34017
|
+
}
|
|
34018
|
+
function serializeTextShadowMC(shadow) {
|
|
34019
|
+
const blurEmu = Math.round(Math.max(0, shadow.blurPt) * 12700);
|
|
34020
|
+
const distEmu = Math.round(Math.max(0, shadow.distPt) * 12700);
|
|
34021
|
+
const dirVal = Math.round(shadow.dirDeg * 6e4);
|
|
34022
|
+
const colorXml = serializeW14ColorEl(shadow.color, shadow.alpha);
|
|
34023
|
+
return `<mc:AlternateContent xmlns:mc="${MC_NS}"><mc:Choice Requires="w14"><w14:shadow w14:blurRad="${blurEmu}" w14:dist="${distEmu}" w14:dir="${dirVal}" w14:sx="100000" w14:sy="100000" w14:kx="0" w14:ky="0" w14:algn="ctr">` + colorXml + `</w14:shadow></mc:Choice><mc:Fallback><w:shadow/></mc:Fallback></mc:AlternateContent>`;
|
|
34024
|
+
}
|
|
34025
|
+
function serializeGlowMC(glow) {
|
|
34026
|
+
const radEmu = Math.round(Math.max(0, glow.radiusPt) * 12700);
|
|
34027
|
+
const colorXml = serializeW14ColorEl(glow.color, glow.alpha);
|
|
34028
|
+
return `<mc:AlternateContent xmlns:mc="${MC_NS}"><mc:Choice Requires="w14"><w14:glow w14:rad="${radEmu}">${colorXml}</w14:glow></mc:Choice><mc:Fallback/></mc:AlternateContent>`;
|
|
34029
|
+
}
|
|
34030
|
+
function serializeReflectionMC(reflection) {
|
|
34031
|
+
const blurEmu = Math.round(Math.max(0, reflection.blurPt) * 12700);
|
|
34032
|
+
const stA = Math.round(reflection.startAlpha * 1e5);
|
|
34033
|
+
const stPos = Math.round(reflection.startPos * 1e5);
|
|
34034
|
+
const endA = Math.round(reflection.endAlpha * 1e5);
|
|
34035
|
+
const endPos = Math.round(reflection.endPos * 1e5);
|
|
34036
|
+
const distEmu = Math.round(Math.max(0, reflection.distPt) * 12700);
|
|
34037
|
+
return `<mc:AlternateContent xmlns:mc="${MC_NS}"><mc:Choice Requires="w14"><w14:reflection w14:blurRad="${blurEmu}" w14:stA="${stA}" w14:stPos="${stPos}" w14:endA="${endA}" w14:endPos="${endPos}" w14:dist="${distEmu}" w14:dir="5400000" w14:fadeDir="5400000" w14:sx="100000" w14:sy="-100000" w14:kx="0" w14:ky="0" w14:algn="bl"/></mc:Choice><mc:Fallback/></mc:AlternateContent>`;
|
|
34038
|
+
}
|
|
33985
34039
|
function pointsToSignedTwips(value) {
|
|
33986
34040
|
if (value === void 0 || value === null || !Number.isFinite(value)) {
|
|
33987
34041
|
return null;
|
|
@@ -34159,6 +34213,15 @@ function serializeRunProperties(styles) {
|
|
|
34159
34213
|
if (styles.textOutline) {
|
|
34160
34214
|
parts.push(serializeTextOutlineMC(styles.textOutline));
|
|
34161
34215
|
}
|
|
34216
|
+
if (styles.textShadow) {
|
|
34217
|
+
parts.push(serializeTextShadowMC(styles.textShadow));
|
|
34218
|
+
}
|
|
34219
|
+
if (styles.glow) {
|
|
34220
|
+
parts.push(serializeGlowMC(styles.glow));
|
|
34221
|
+
}
|
|
34222
|
+
if (styles.reflection) {
|
|
34223
|
+
parts.push(serializeReflectionMC(styles.reflection));
|
|
34224
|
+
}
|
|
34162
34225
|
if (styles.highlight) {
|
|
34163
34226
|
parts.push(
|
|
34164
34227
|
`<w:highlight w:val="${escapeXml(normalizeHighlightForDocx(styles.highlight))}"/>`
|
|
@@ -36652,7 +36715,18 @@ async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, do
|
|
|
36652
36715
|
color: "#BFBFBF"
|
|
36653
36716
|
});
|
|
36654
36717
|
}
|
|
36655
|
-
if (styles.
|
|
36718
|
+
if (styles.textShadow) {
|
|
36719
|
+
const ts = styles.textShadow;
|
|
36720
|
+
const dirRad = ts.dirDeg * Math.PI / 180;
|
|
36721
|
+
const shadowOffsetPt = pxToPt$1(ts.distPt * PX_PER_POINT);
|
|
36722
|
+
writer.drawText(pageIndex, {
|
|
36723
|
+
...baseTextOptions,
|
|
36724
|
+
x: pxToPt$1(leftPx) + Math.cos(dirRad) * shadowOffsetPt,
|
|
36725
|
+
y: pxToPt$1(baselineY) + Math.sin(dirRad) * shadowOffsetPt,
|
|
36726
|
+
text: text2,
|
|
36727
|
+
color: ts.color
|
|
36728
|
+
});
|
|
36729
|
+
} else if (styles.shadow) {
|
|
36656
36730
|
writer.drawText(pageIndex, {
|
|
36657
36731
|
...baseTextOptions,
|
|
36658
36732
|
x: pxToPt$1(leftPx) + offsetPt,
|