oasis-editor 0.0.134 → 0.0.135
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-B2f15Gpe.js → OasisEditorApp-207_qEC4.js} +123 -29
- package/dist/app/controllers/EditorCommandsController.d.ts +2 -0
- package/dist/assets/{importDocxWorker-CCwhxVSR.js → importDocxWorker-B0cSSI12.js} +1 -1
- package/dist/core/commands/builtinCommands.d.ts +1 -1
- package/dist/core/commands/image.d.ts +15 -1
- package/dist/core/lineDash.d.ts +16 -0
- package/dist/core/model/index.d.ts +1 -1
- package/dist/core/model/types/primitives.d.ts +19 -0
- package/dist/export/docx/docxTypes.d.ts +2 -1
- package/dist/export/docx/text/drawingContainerXml.d.ts +7 -1
- package/dist/export/pdf/draw/drawImageObject.d.ts +14 -0
- package/dist/export/pdf/writer/pdfTypes.d.ts +2 -0
- package/dist/i18n/locales/en.d.ts +15 -0
- package/dist/i18n/locales/pt-BR.d.ts +15 -0
- package/dist/{index-ogn0S9F3.js → index-CaKZARyM.js} +835 -305
- package/dist/oasis-editor.css +1 -1
- package/dist/oasis-editor.js +49 -49
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/plugins/internal/essentialsCapabilities.d.ts +6 -1
- package/dist/ui/app/createAppCommandsController.d.ts +2 -0
- package/dist/ui/app/createEditorCommandRuntime.d.ts +1 -0
- package/dist/ui/canvas/paragraph/canvasInlineImage.d.ts +1 -1
- package/dist/ui/components/Toolbar/pictureBorderPresets.d.ts +19 -0
- package/dist/ui/components/Toolbar/primitives/ColorGrids.d.ts +20 -0
- package/dist/ui/components/Toolbar/primitives/PictureBorderPicker.d.ts +37 -0
- package/dist/ui/components/Toolbar/primitives/WideMenuButton.d.ts +27 -0
- package/dist/ui/components/Toolbar/schema/items.d.ts +15 -1
- 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 { E as EMPTY_PROJECTION_CONTEXT, d as domTextMeasurer, g as getProjectedParagraphBlockHeight, e as estimateTableBlockHeight, p as projectParagraphLayout, a as getPageBodyBottom, b as getPageBodyTop, c as getPageContentWidth, F as FOOTNOTE_MARKER_GUTTER_PX, f as getParagraphText, h as getBlockParagraphs, i as getRunFootnoteReference, l as listReferencedEndnotes, j as getFootnoteDisplayMarker, k as createProjectionContext, m as getDocumentSections, n as getRunField, o as projectBlocksLayout, v as visitRun, q as assertNever, r as createSignal, s as createEditorStateFromDocument, t as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, u as fontSizePxToPt, w as probeLocalFontFamilies, x as createEditorParagraphFromRuns, y as isInlineObjectRun, z as createEditorStyledRun, A as getParagraphLength, B as getActiveZone, C as getActiveSectionIndex, D as getParagraphs, G as normalizeSelection, H as positionToParagraphOffset, I as paragraphOffsetToPosition, J as clampPosition, K as findParagraphIndex, L as createCollapsedSelection, M as isSelectionCollapsed, N as parseFontSizePtToPx, O as formatFontSizePt, P as createEditorParagraph, Q as resolveDefaultParagraphStyleId, R as findParagraphTableLocation, T as buildTableCellLayout, U as PT_PER_PX, V as createEditorTableCell, W as createEditorTableRow, X as createEditorTable, Y as PX_PER_POINT, Z as underlineStyleToCssDecorationStyle, _ as resolveImageSrc, $ as listKindForTag, a0 as isParagraphTag, a1 as collectInlineRuns, a2 as parseParagraphStyle, a3 as getRunImage, a4 as InlineShell, a5 as BalloonShell, a6 as DocumentShell, a7 as createMemo, a8 as getCaretRectFromSnapshot, a9 as getParagraphRectFromSnapshot, aa as createComponent, ab as CaretOverlay, ac as Show, ad as createRenderEffect, ae as style, af as setStyleProperty, ag as setAttribute, ah as memo, ai as template, aj as Button, ak as useI18n, al as createEffect, am as TextField, an as Dialog, ao as insert, ap as className, aq as Grid, ar as SelectField, as as StatusText, at as ColorField, au as UNDERLINE_STYLE_OPTIONS, av as Stack, aw as For, ax as ToggleChip, ay as FormField, az as Checkbox, aA as FieldGroup, aB as Tabs, aC as NumberField, aD as parseNumber, aE as createStore, aF as reconcile, aG as RadioGroup, aH as Radio$1, aI as TextAreaField, aJ as Text, aK as SurfaceButton, aL as delegateEvents, aM as onMount, aN as onCleanup, aO as CheckIcon, aP as use, aQ as PluginUiHost, aR as OasisEditorEditor, aS as OasisBrandMark, aT as setPreciseFontPreference, aU as setWelcomeSeen, aV as enablePreciseFontMode, aW as TWIPS_PER_POINT, aX as PX_PER_INCH, aY as TWIPS_PER_INCH, aZ as normalizeHex6, a_ as TABLE_CONDITIONAL_FLAG_ATTRIBUTES, a$ as TABLE_BORDER_EDGE_KEYS, b0 as resolveEffectiveParagraphStyle, b1 as resolveEffectiveTextStyleForParagraph, b2 as EMU_PER_PT, b3 as OOXML_ROTATION_UNITS, b4 as OOXML_PERCENT_DENOMINATOR, b5 as parseHexColorToRgb255, b6 as EMU_PER_PX, b7 as getRunEndnoteReference, b8 as iterateFootnoteReferenceRuns, b9 as iterateEndnoteReferenceRuns, ba as imageContentTypeDefaults, bb as getRunFieldChar, bc as getRunFieldInstruction, bd as createEditorRun, be as JSZip, bf as imageExtensionFromMime, bg as pxToPt$1, bh as resolveFloatingObjectRect, bi as getTextBoxFloatingGeometry, bj as getPresetPathSegments, bk as buildListLabels, bl as
|
|
4
|
+
import { E as EMPTY_PROJECTION_CONTEXT, d as domTextMeasurer, g as getProjectedParagraphBlockHeight, e as estimateTableBlockHeight, p as projectParagraphLayout, a as getPageBodyBottom, b as getPageBodyTop, c as getPageContentWidth, F as FOOTNOTE_MARKER_GUTTER_PX, f as getParagraphText, h as getBlockParagraphs, i as getRunFootnoteReference, l as listReferencedEndnotes, j as getFootnoteDisplayMarker, k as createProjectionContext, m as getDocumentSections, n as getRunField, o as projectBlocksLayout, v as visitRun, q as assertNever, r as createSignal, s as createEditorStateFromDocument, t as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, u as fontSizePxToPt, w as probeLocalFontFamilies, x as createEditorParagraphFromRuns, y as isInlineObjectRun, z as createEditorStyledRun, A as getParagraphLength, B as getActiveZone, C as getActiveSectionIndex, D as getParagraphs, G as normalizeSelection, H as positionToParagraphOffset, I as paragraphOffsetToPosition, J as clampPosition, K as findParagraphIndex, L as createCollapsedSelection, M as isSelectionCollapsed, N as parseFontSizePtToPx, O as formatFontSizePt, P as createEditorParagraph, Q as resolveDefaultParagraphStyleId, R as findParagraphTableLocation, T as buildTableCellLayout, U as PT_PER_PX, V as createEditorTableCell, W as createEditorTableRow, X as createEditorTable, Y as PX_PER_POINT, Z as underlineStyleToCssDecorationStyle, _ as resolveImageSrc, $ as listKindForTag, a0 as isParagraphTag, a1 as collectInlineRuns, a2 as parseParagraphStyle, a3 as getRunImage, a4 as InlineShell, a5 as BalloonShell, a6 as DocumentShell, a7 as createMemo, a8 as getCaretRectFromSnapshot, a9 as getParagraphRectFromSnapshot, aa as createComponent, ab as CaretOverlay, ac as Show, ad as createRenderEffect, ae as style, af as setStyleProperty, ag as setAttribute, ah as memo, ai as template, aj as Button, ak as useI18n, al as createEffect, am as TextField, an as Dialog, ao as insert, ap as className, aq as Grid, ar as SelectField, as as StatusText, at as ColorField, au as UNDERLINE_STYLE_OPTIONS, av as Stack, aw as For, ax as ToggleChip, ay as FormField, az as Checkbox, aA as FieldGroup, aB as Tabs, aC as NumberField, aD as parseNumber, aE as createStore, aF as reconcile, aG as RadioGroup, aH as Radio$1, aI as TextAreaField, aJ as Text, aK as SurfaceButton, aL as delegateEvents, aM as onMount, aN as onCleanup, aO as CheckIcon, aP as use, aQ as PluginUiHost, aR as OasisEditorEditor, aS as OasisBrandMark, aT as setPreciseFontPreference, aU as setWelcomeSeen, aV as enablePreciseFontMode, aW as TWIPS_PER_POINT, aX as PX_PER_INCH, aY as TWIPS_PER_INCH, aZ as normalizeHex6, a_ as TABLE_CONDITIONAL_FLAG_ATTRIBUTES, a$ as TABLE_BORDER_EDGE_KEYS, b0 as resolveEffectiveParagraphStyle, b1 as resolveEffectiveTextStyleForParagraph, b2 as EMU_PER_PT, b3 as OOXML_ROTATION_UNITS, b4 as OOXML_PERCENT_DENOMINATOR, b5 as parseHexColorToRgb255, b6 as EMU_PER_PX, b7 as getRunEndnoteReference, b8 as iterateFootnoteReferenceRuns, b9 as iterateEndnoteReferenceRuns, ba as imageContentTypeDefaults, bb as getRunFieldChar, bc as getRunFieldInstruction, bd as createEditorRun, be as JSZip, bf as imageExtensionFromMime, bg as pxToPt$1, bh as resolveFloatingObjectRect, bi as getTextBoxFloatingGeometry, bj as getPresetPathSegments, bk as buildListLabels, bl as lineDashPatternPt, bm as DEFAULT_FONT_SIZE_PX, bn as resolveGradientAxis, bo as isDoubleUnderlineStyle, bp as isWavyUnderlineStyle, bq as underlineStyleLineWidthPx, br as WAVY_UNDERLINE_WAVELENGTH_PX, bs as WAVY_UNDERLINE_AMPLITUDE_PX, bt as DOUBLE_UNDERLINE_OFFSET_PX, bu as underlineStyleDashArray, bv as EMPHASIS_GLYPH, bw as rgb255ToHex, bx as getImageFloatingGeometry, by as textStyleToFontSizePt, bz as resolveTextAlignmentBaselineOffset, bA as TEXT_BASELINE_RATIO, bB as resolveOpenTypeFeatureTags, bC as resolveDecorationLineY, bD as DOUBLE_STRIKE_OFFSET_PX, bE as resolveListLabel, bF as getListLabelInset, bG as getAlignedListLabelInset, bH as getParagraphBorderInsets, bI as buildSegmentTable, bJ as buildCanvasTableLayout, bK as resolveCanvasTableWidth, bL as resolveFloatingTableRect, bM as paragraphBetweenBorderMatches, bN as normalizeFamily, bO as ROBOTO_FONT_FILES, bP as loadFontAsset, bQ as OFFICE_COMPAT_FONT_FAMILIES, bR as BinaryReader, bS as buildSfnt, bT as defaultFontDecoderRegistry, bU as SfntFontProgram, bV as collectPdfFontFamilies, bW as outlineFrom, bX as getPageHeaderZoneTop, bY as getPageColumnRects, bZ as findFootnoteReference, b_ as resolveImporterForFile, b$ as roundTo, c0 as getDocumentSectionsCanonical, c1 as getDocumentParagraphsCanonical, c2 as getDocumentParagraphs, c3 as PX_PER_CM, c4 as getDocumentPageSettings, c5 as getTableCellContentWidthForParagraph, c6 as layoutMetricsEpoch, c7 as bumpLayoutMetricsEpoch, c8 as createCanvasLayoutSnapshotProvider, c9 as on, ca as debounce, cb as unwrap, cc as perfTimer, cd as getRunTextBox, ce as createEditorDocument, cf as resolveResizedDimensions, cg as axisSignForDirection, ch as clamp$1, ci as MIN_RESIZE_SIZE_PX, cj as resolveTextBoxRenderHeight, ck as getToolbarStyleState, cl as VERTICAL_HIT_WEIGHT, cm as getCachedCanvasImage, cn as measureParagraphMinContentWidthPx, co as getEditableBlocksForZone, cp as findParagraphLocation, cq as createSectionBoundaryParagraph, cr as normalizePageSettings, cs as DEFAULT_EDITOR_PAGE_SETTINGS, ct as markStart, cu as markEnd, cv as getParagraphEntries, cw as getParagraphById, cx as createEditorFootnote, cy as createFootnoteReferenceRun, cz as renumberFootnotes, cA as preciseFontModeVersion, cB as isPreciseFontModeEnabled, cC as getHeadingLevel, cD as togglePreciseFontMode, cE as nextFontSizePt, cF as previousFontSizePt, cG as fontSizePtToPx, cH as resolveNamedTextStyle, cI as createDefaultToolbarPreset, cJ as MenuRegistry, cK as createToolbarRegistry, cL as Editor, cM as resolveCommandRef, cN as commandRefName, cO as createOasisEditorClient, cP as createEditorZoom, cQ as startLongTaskObserver, cR as installGlobalReport, cS as applyStoredPreciseFontPreference, cT as getWelcomeSeen, cU as isLocalFontAccessSupported, cV as EDITOR_SCROLL_PADDING_PX, cW as Toolbar, cX as OasisEditorLoading, cY as I18nProvider, cZ as createTranslator, c_ as registerDomStatsSurface, c$ as createEditorLogger } from "./index-CaKZARyM.js";
|
|
5
5
|
function projectHeaderFooterBlocksWithDependencies(blocks, deps, context = {}) {
|
|
6
6
|
const {
|
|
7
7
|
pageIndex,
|
|
@@ -37604,6 +37604,15 @@ function buildSrcRect(crop) {
|
|
|
37604
37604
|
}
|
|
37605
37605
|
return `<a:srcRect l="${l}" t="${t}" r="${r}" b="${b}"/>`;
|
|
37606
37606
|
}
|
|
37607
|
+
function buildImageLnXml(border) {
|
|
37608
|
+
if (!border) {
|
|
37609
|
+
return "";
|
|
37610
|
+
}
|
|
37611
|
+
const widthAttr = border.widthPt !== void 0 ? ` w="${Math.round(border.widthPt * EMU_PER_PT)}"` : "";
|
|
37612
|
+
const fill = `<a:solidFill><a:srgbClr val="${escapeXml(border.color.replace(/^#/, ""))}"/></a:solidFill>`;
|
|
37613
|
+
const dash = border.dash ? `<a:prstDash val="${border.dash}"/>` : "";
|
|
37614
|
+
return `<a:ln${widthAttr}>${fill}${dash}</a:ln>`;
|
|
37615
|
+
}
|
|
37607
37616
|
function buildAnchorBool(value, fallback) {
|
|
37608
37617
|
return value ?? fallback ? "1" : "0";
|
|
37609
37618
|
}
|
|
@@ -37696,9 +37705,10 @@ function serializeImageRun(runId, rId, context, rPrXml) {
|
|
|
37696
37705
|
const altAttr = img.alt !== void 0 ? ` descr="${escapeXml(img.alt)}" title="${escapeXml(img.alt)}"` : "";
|
|
37697
37706
|
const xfrmAttrs = buildXfrmAttrs(img);
|
|
37698
37707
|
const srcRect = buildSrcRect(img.crop);
|
|
37708
|
+
const lnXml = buildImageLnXml(img.border);
|
|
37699
37709
|
const fill = img.fillMode === "tile" ? "<a:tile/>" : "<a:stretch><a:fillRect/></a:stretch>";
|
|
37700
37710
|
const blipRelAttr = img.kind === "linked" ? `r:link="${rId}"` : `r:embed="${rId}"`;
|
|
37701
|
-
const picXml = `<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:nvPicPr><pic:cNvPr id="0" name="Picture"${altAttr}/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill><a:blip ${blipRelAttr} xmlns:r="${OFFICE_REL_NS}"/>${srcRect}${fill}</pic:blipFill><pic:spPr><a:xfrm${xfrmAttrs}><a:off x="0" y="0"/><a:ext cx="${img.cx}" cy="${img.cy}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom
|
|
37711
|
+
const picXml = `<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:nvPicPr><pic:cNvPr id="0" name="Picture"${altAttr}/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill><a:blip ${blipRelAttr} xmlns:r="${OFFICE_REL_NS}"/>${srcRect}${fill}</pic:blipFill><pic:spPr><a:xfrm${xfrmAttrs}><a:off x="0" y="0"/><a:ext cx="${img.cx}" cy="${img.cy}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom>${lnXml}</pic:spPr></pic:pic></a:graphicData></a:graphic>`;
|
|
37702
37712
|
const drawing = buildDrawingXml(img, docPrId, altAttr, picXml);
|
|
37703
37713
|
return `<w:r>${rPrXml}${drawing}</w:r>`;
|
|
37704
37714
|
}
|
|
@@ -38939,6 +38949,7 @@ function buildPartContext(blocks, numberingContext, state, document2) {
|
|
|
38939
38949
|
alt: run.image.alt,
|
|
38940
38950
|
crop: run.image.crop,
|
|
38941
38951
|
fillMode: run.image.fillMode,
|
|
38952
|
+
border: run.image.border,
|
|
38942
38953
|
rotation: run.image.rotation,
|
|
38943
38954
|
flipH: run.image.flipH,
|
|
38944
38955
|
flipV: run.image.flipV,
|
|
@@ -39562,6 +39573,43 @@ async function registerPdfImageRun(writer, document2, image) {
|
|
|
39562
39573
|
perWriter.set(resolvedSrc, preparedPromise);
|
|
39563
39574
|
return preparedPromise;
|
|
39564
39575
|
}
|
|
39576
|
+
async function drawImageObject(writer, pageIndex, document2, image, x, y, width, height) {
|
|
39577
|
+
const resourceName = await registerPdfImageRun(writer, document2, image);
|
|
39578
|
+
if (!resourceName) {
|
|
39579
|
+
return;
|
|
39580
|
+
}
|
|
39581
|
+
writer.drawImage(pageIndex, {
|
|
39582
|
+
resourceName,
|
|
39583
|
+
x,
|
|
39584
|
+
y,
|
|
39585
|
+
width,
|
|
39586
|
+
height,
|
|
39587
|
+
rotation: image.rotation,
|
|
39588
|
+
crop: image.crop
|
|
39589
|
+
});
|
|
39590
|
+
const border = image.border;
|
|
39591
|
+
if (!border) {
|
|
39592
|
+
return;
|
|
39593
|
+
}
|
|
39594
|
+
const rotation = image.rotation;
|
|
39595
|
+
if (rotation) {
|
|
39596
|
+
writer.saveGraphicsState(pageIndex);
|
|
39597
|
+
writer.rotateAbout(pageIndex, x + width / 2, y + height / 2, rotation);
|
|
39598
|
+
}
|
|
39599
|
+
const dashArray = lineDashPatternPt(border.dash);
|
|
39600
|
+
writer.drawRect(pageIndex, {
|
|
39601
|
+
x,
|
|
39602
|
+
y,
|
|
39603
|
+
width,
|
|
39604
|
+
height,
|
|
39605
|
+
stroke: border.color,
|
|
39606
|
+
lineWidth: border.widthPt ?? 1,
|
|
39607
|
+
...dashArray.length > 0 ? { dashArray } : {}
|
|
39608
|
+
});
|
|
39609
|
+
if (rotation) {
|
|
39610
|
+
writer.restoreGraphicsState(pageIndex);
|
|
39611
|
+
}
|
|
39612
|
+
}
|
|
39565
39613
|
function resolveFragmentSlots(line, fragment) {
|
|
39566
39614
|
const slotByOffset = new Map(
|
|
39567
39615
|
line.slots.map(
|
|
@@ -39918,21 +39966,16 @@ async function drawFloatingImagesForParagraph(options) {
|
|
|
39918
39966
|
lineTop: options.paragraphTop + line.top,
|
|
39919
39967
|
anchorLeft: options.contentLeft + ((slot == null ? void 0 : slot.left) ?? 0)
|
|
39920
39968
|
});
|
|
39921
|
-
|
|
39969
|
+
await drawImageObject(
|
|
39922
39970
|
options.writer,
|
|
39971
|
+
options.pageIndex,
|
|
39923
39972
|
options.document,
|
|
39924
|
-
image
|
|
39973
|
+
image,
|
|
39974
|
+
pxToPt$1(rect.x),
|
|
39975
|
+
pxToPt$1(rect.y),
|
|
39976
|
+
pxToPt$1(rect.width),
|
|
39977
|
+
pxToPt$1(rect.height)
|
|
39925
39978
|
);
|
|
39926
|
-
if (!resourceName) continue;
|
|
39927
|
-
options.writer.drawImage(options.pageIndex, {
|
|
39928
|
-
resourceName,
|
|
39929
|
-
x: pxToPt$1(rect.x),
|
|
39930
|
-
y: pxToPt$1(rect.y),
|
|
39931
|
-
width: pxToPt$1(rect.width),
|
|
39932
|
-
height: pxToPt$1(rect.height),
|
|
39933
|
-
rotation: image.rotation,
|
|
39934
|
-
crop: image.crop
|
|
39935
|
-
});
|
|
39936
39979
|
}
|
|
39937
39980
|
}
|
|
39938
39981
|
}
|
|
@@ -40022,21 +40065,16 @@ async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, do
|
|
|
40022
40065
|
if (fragment.image.floating) return;
|
|
40023
40066
|
const slot = line.slots.find((c) => c.offset === fragment.startOffset) ?? line.slots.find((c) => c.offset >= fragment.startOffset);
|
|
40024
40067
|
if (!slot) return;
|
|
40025
|
-
|
|
40068
|
+
await drawImageObject(
|
|
40026
40069
|
writer,
|
|
40070
|
+
pageIndex,
|
|
40027
40071
|
document2,
|
|
40028
|
-
fragment.image
|
|
40029
|
-
|
|
40030
|
-
|
|
40031
|
-
|
|
40032
|
-
|
|
40033
|
-
|
|
40034
|
-
y: pxToPt$1(originY + line.top + line.height - fragment.image.height),
|
|
40035
|
-
width: pxToPt$1(fragment.image.width),
|
|
40036
|
-
height: pxToPt$1(fragment.image.height),
|
|
40037
|
-
rotation: fragment.image.rotation,
|
|
40038
|
-
crop: fragment.image.crop
|
|
40039
|
-
});
|
|
40072
|
+
fragment.image,
|
|
40073
|
+
pxToPt$1(originX + slot.left),
|
|
40074
|
+
pxToPt$1(originY + line.top + line.height - fragment.image.height),
|
|
40075
|
+
pxToPt$1(fragment.image.width),
|
|
40076
|
+
pxToPt$1(fragment.image.height)
|
|
40077
|
+
);
|
|
40040
40078
|
return;
|
|
40041
40079
|
}
|
|
40042
40080
|
if (fragment.textBox) {
|
|
@@ -41029,6 +41067,12 @@ function textMarkerComment(value) {
|
|
|
41029
41067
|
);
|
|
41030
41068
|
return `% OasisText ${encodePdfUtf16Hex(codePoints)}`;
|
|
41031
41069
|
}
|
|
41070
|
+
function buildDashCommand(dashArray) {
|
|
41071
|
+
if (!dashArray || dashArray.length === 0) {
|
|
41072
|
+
return null;
|
|
41073
|
+
}
|
|
41074
|
+
return `[${dashArray.map((value) => formatNumber(value)).join(" ")}] 0 d`;
|
|
41075
|
+
}
|
|
41032
41076
|
class PdfContentStream {
|
|
41033
41077
|
constructor(page, fonts, images, shadings) {
|
|
41034
41078
|
this.page = page;
|
|
@@ -41064,6 +41108,10 @@ class PdfContentStream {
|
|
|
41064
41108
|
if (options.stroke) {
|
|
41065
41109
|
commands.push(colorCommand(options.stroke, "RG", [0, 0, 0]));
|
|
41066
41110
|
commands.push(`${formatNumber(options.lineWidth ?? 1)} w`);
|
|
41111
|
+
const dashCommand = buildDashCommand(options.dashArray);
|
|
41112
|
+
if (dashCommand) {
|
|
41113
|
+
commands.push(dashCommand);
|
|
41114
|
+
}
|
|
41067
41115
|
}
|
|
41068
41116
|
commands.push(
|
|
41069
41117
|
[
|
|
@@ -41086,7 +41134,7 @@ class PdfContentStream {
|
|
|
41086
41134
|
}
|
|
41087
41135
|
drawLine(options) {
|
|
41088
41136
|
const page = this.page;
|
|
41089
|
-
const dashCommand = options.dashArray
|
|
41137
|
+
const dashCommand = buildDashCommand(options.dashArray);
|
|
41090
41138
|
const commands = [
|
|
41091
41139
|
"q",
|
|
41092
41140
|
colorCommand(options.stroke, "RG", [0, 0, 0])
|
|
@@ -44421,6 +44469,33 @@ function applySelectedImageCropAspect(state, mode) {
|
|
|
44421
44469
|
}
|
|
44422
44470
|
return setSelectedImageCrop(state, computeImageAspectCrop(image, mode));
|
|
44423
44471
|
}
|
|
44472
|
+
function getSelectedImageBorder(state) {
|
|
44473
|
+
const selectedImage = getSelectedImageRun(state);
|
|
44474
|
+
const image = selectedImage && getRunImage(selectedImage.run);
|
|
44475
|
+
return (image == null ? void 0 : image.border) ?? null;
|
|
44476
|
+
}
|
|
44477
|
+
const DEFAULT_IMAGE_BORDER_COLOR = "#000000";
|
|
44478
|
+
function setSelectedImageBorder(state, patch) {
|
|
44479
|
+
return patchSelectedImage(state, (image) => {
|
|
44480
|
+
if (patch.color === null) {
|
|
44481
|
+
const { border: _removed, ...rest } = image;
|
|
44482
|
+
return rest;
|
|
44483
|
+
}
|
|
44484
|
+
const border = {
|
|
44485
|
+
...image.border ?? { color: DEFAULT_IMAGE_BORDER_COLOR }
|
|
44486
|
+
};
|
|
44487
|
+
if (patch.color !== void 0) {
|
|
44488
|
+
border.color = patch.color;
|
|
44489
|
+
}
|
|
44490
|
+
if (patch.widthPt !== void 0) {
|
|
44491
|
+
border.widthPt = patch.widthPt;
|
|
44492
|
+
}
|
|
44493
|
+
if (patch.dash !== void 0) {
|
|
44494
|
+
border.dash = patch.dash;
|
|
44495
|
+
}
|
|
44496
|
+
return { ...image, border };
|
|
44497
|
+
});
|
|
44498
|
+
}
|
|
44424
44499
|
function normalizeRotation$1(rotation) {
|
|
44425
44500
|
if (!Number.isFinite(rotation)) {
|
|
44426
44501
|
return void 0;
|
|
@@ -52701,6 +52776,14 @@ function createEditorCommandsControllerImpl(deps) {
|
|
|
52701
52776
|
(current) => applySelectedImageCropAspect(current, mode)
|
|
52702
52777
|
);
|
|
52703
52778
|
};
|
|
52779
|
+
const applyImageBorderCommand = (patch) => {
|
|
52780
|
+
if (!selectedImageRun()) {
|
|
52781
|
+
return;
|
|
52782
|
+
}
|
|
52783
|
+
execTransactional(
|
|
52784
|
+
(current) => setSelectedImageBorder(current, patch)
|
|
52785
|
+
);
|
|
52786
|
+
};
|
|
52704
52787
|
return {
|
|
52705
52788
|
applyBooleanStyleCommand,
|
|
52706
52789
|
applyValueStyleCommand,
|
|
@@ -52732,6 +52815,7 @@ function createEditorCommandsControllerImpl(deps) {
|
|
|
52732
52815
|
applyImageWidthCmCommand,
|
|
52733
52816
|
applyImageHeightCmCommand,
|
|
52734
52817
|
applyImageCropAspectCommand,
|
|
52818
|
+
applyImageBorderCommand,
|
|
52735
52819
|
handleListTab,
|
|
52736
52820
|
handleListEnter,
|
|
52737
52821
|
handleListBoundaryBackspace
|
|
@@ -53782,6 +53866,14 @@ function buildDocumentAndBrowserCommands({
|
|
|
53782
53866
|
() => ({
|
|
53783
53867
|
isEnabled: image.isSelected()
|
|
53784
53868
|
})
|
|
53869
|
+
),
|
|
53870
|
+
imageBorder: actionCommand(
|
|
53871
|
+
"imageBorder",
|
|
53872
|
+
(p) => image.setBorder(p),
|
|
53873
|
+
() => ({
|
|
53874
|
+
isEnabled: image.isSelected(),
|
|
53875
|
+
value: image.getBorder()
|
|
53876
|
+
})
|
|
53785
53877
|
)
|
|
53786
53878
|
};
|
|
53787
53879
|
}
|
|
@@ -54605,7 +54697,9 @@ function buildEssentialsImage(options) {
|
|
|
54605
54697
|
setHeightCm: (cm) => options.commandsController.applyImageHeightCmCommand(cm),
|
|
54606
54698
|
isCropActive: () => options.imageCropMode.isActive(),
|
|
54607
54699
|
toggleCrop: () => options.imageCropMode.toggle(),
|
|
54608
|
-
applyCropAspect: (preset) => options.commandsController.applyImageCropAspectCommand(preset)
|
|
54700
|
+
applyCropAspect: (preset) => options.commandsController.applyImageCropAspectCommand(preset),
|
|
54701
|
+
getBorder: () => getSelectedImageBorder(options.state()),
|
|
54702
|
+
setBorder: (patch) => options.commandsController.applyImageBorderCommand(patch)
|
|
54609
54703
|
};
|
|
54610
54704
|
}
|
|
54611
54705
|
function buildEssentialsBrowser() {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ImageBorderPatch } from '../../core/commands/image.js';
|
|
1
2
|
import { EditorParagraphListStyle, EditorParagraphStyle, EditorSection, EditorState, EditorTextStyle } from '../../core/model.js';
|
|
2
3
|
import { TextCaseMode } from '../../core/commands/text.js';
|
|
3
4
|
import { BooleanStyleKey, ParagraphStyleKey, ToolbarStyleState } from '../../ui/toolbarStyleState.js';
|
|
@@ -47,6 +48,7 @@ declare function createEditorCommandsControllerImpl(deps: EditorCommandsControll
|
|
|
47
48
|
applyImageWidthCmCommand: (cm: number) => void;
|
|
48
49
|
applyImageHeightCmCommand: (cm: number) => void;
|
|
49
50
|
applyImageCropAspectCommand: (preset: string) => void;
|
|
51
|
+
applyImageBorderCommand: (patch: ImageBorderPatch) => void;
|
|
50
52
|
handleListTab: (direction: "indent" | "outdent") => boolean;
|
|
51
53
|
handleListEnter: () => boolean;
|
|
52
54
|
handleListBoundaryBackspace: (event: KeyboardEvent & {
|