oasis-editor 0.0.149 → 0.0.150
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-CmqlSXEk.js → OasisEditorApp-CZNfjaj2.js} +360 -35
- package/dist/app/controllers/EditorCommandsController.d.ts +4 -0
- package/dist/app/controllers/createCropSession.d.ts +1 -0
- package/dist/app/controllers/useEditorImageOperations.d.ts +3 -0
- package/dist/assets/{importDocxWorker-CpQR2fwx.js → importDocxWorker-Ddoy1WwF.js} +1 -1
- package/dist/core/commands/builtinCommands.d.ts +1 -1
- package/dist/core/commands/image.d.ts +16 -1
- package/dist/core/commands/publicCommandTypes.d.ts +4 -0
- package/dist/core/model/index.d.ts +1 -1
- package/dist/core/model/types/primitives.d.ts +16 -0
- package/dist/export/docx/docxTypes.d.ts +3 -1
- package/dist/export/pdf/OasisPdfWriter.d.ts +2 -1
- package/dist/export/pdf/writer/PdfContentStream.d.ts +3 -1
- package/dist/i18n/locales/en.d.ts +8 -0
- package/dist/i18n/locales/pt-BR.d.ts +8 -0
- package/dist/{index-B7V7kbjr.js → index-DgN6KXYw.js} +547 -227
- package/dist/index.d.ts +1 -1
- package/dist/oasis-editor.css +1 -1
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/plugins/internal/essentialsCapabilities.d.ts +10 -0
- package/dist/ui/OasisEditorEditorProps.d.ts +3 -0
- package/dist/ui/app/buildEditorViewProps.d.ts +1 -0
- package/dist/ui/app/createAppCommandsController.d.ts +8 -0
- package/dist/ui/app/createEditorCommandRuntime.d.ts +4 -0
- package/dist/ui/app/createEditorInteractionRuntime.d.ts +3 -0
- package/dist/ui/cropGeometry.d.ts +4 -3
- package/dist/ui/overlays/ImageCropPreviewOverlay.d.ts +16 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
3
3
|
var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, 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, q as assertNever, r as cloneRun, s as createSignal, t as createEditorStateFromDocument, u as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, v as fontSizePxToPt, w as probeLocalFontFamilies, x as createEditorParagraphFromRuns, y as isInlineObjectRun, z as stylesEqual, A as cloneStyle, B as createEditorStyledRun, C as cloneParagraphList, D as cloneParagraph, G as getParagraphLength, H as getActiveZone, I as getActiveSectionIndex, J as getParagraphs, K as normalizeSelection, L as positionToParagraphOffset, M as cloneParagraphs, N as paragraphOffsetToPosition, O as findParagraphIndex, P as createCollapsedSelection, Q as isSelectionCollapsed, R as MATH_OBJECT_REPLACEMENT, T as setValueStyle, U as setBooleanStyle, V as parseFontSizePtToPx, W as formatFontSizePt, X as setParagraphStyleValue, Y as createEditorParagraph, Z as cloneBlocks, _ as resolveDefaultParagraphStyleId, $ as findParagraphTablePathLocation, a0 as findParagraphLocation, a1 as resolveTablePath, a2 as buildTableCellLayout, a3 as PT_PER_PX, a4 as createEditorTableCell, a5 as createEditorTableRow, a6 as createEditorTable, a7 as clampPosition, a8 as PX_PER_POINT, a9 as underlineStyleToCssDecorationStyle, aa as resolveImageSrc, ab as listKindForTag, ac as isParagraphTag, ad as collectInlineRuns, ae as parseParagraphStyle, af as getRunImage, ag as InlineShell, ah as BalloonShell, ai as DocumentShell, aj as findParagraphTableLocation, ak as createMemo, al as getCaretRectFromSnapshot, am as getParagraphRectFromSnapshot, an as createComponent, ao as CaretOverlay, ap as Show, aq as createRenderEffect, ar as style, as as setStyleProperty, at as setAttribute, au as memo, av as template, aw as Button, ax as useI18n, ay as createEffect, az as TextField, aA as Dialog, aB as insert, aC as className, aD as Grid, aE as SelectField, aF as StatusText, aG as ColorField, aH as UNDERLINE_STYLE_OPTIONS, aI as Stack, aJ as For, aK as ToggleChip, aL as FormField, aM as Checkbox, aN as FieldGroup, aO as Tabs, aP as NumberField, aQ as parseNumber, aR as createStore, aS as reconcile, aT as RadioGroup, aU as Radio$1, aV as TextAreaField, aW as COMMON_SYMBOLS, aX as getRecentSymbols, aY as SYMBOL_CATEGORIES, aZ as rememberSymbol, a_ as delegateEvents, a$ as EMPTY_EDITOR_MATH_EXPRESSION, b0 as serializeLinearMath, b1 as parseLinearMath, b2 as Text, b3 as SurfaceButton, b4 as onMount, b5 as onCleanup, b6 as CheckIcon, b7 as use, b8 as PluginUiHost, b9 as OasisEditorEditor, ba as OasisBrandMark, bb as setPreciseFontPreference, bc as setWelcomeSeen, bd as enablePreciseFontMode, be as WORD_NS$6, bf as XMLSerializer, bg as DOMParser, bh as WORD14_NS, bi as mergeNestedExtensionMarkup, bj as resolveOpcRelationships, bk as parseOpcRelationships, bl as JSZip, bm as normalizeOpcPartPath, bn as OPC_CONTENT_TYPES_PATH, bo as getOpcRelationshipOwnerPath, bp as serializeOpcRelationships, bq as OPC_ROOT_RELATIONSHIPS_PATH, br as hashDocxPartBytes, bs as parseOpcContentTypes, bt as serializeOpcContentTypes, bu as mergeParagraphPropertiesXmlSource, bv as setEditorRunOoxmlSource, bw as mergeRunOoxmlSourceIntoGeneratedXml, bx as mergeTableCellPropertiesXmlSource, by as mergeTableRowPropertiesXmlSource, bz as mergeTablePropertiesXmlSource, bA as exportEditorDocumentToDocxBlob, bB as exportEditorDocumentToDocx, bC as pxToPt$1, bD as resolveFloatingObjectRect, bE as getTextBoxFloatingGeometry, bF as getPresetPathSegments, bG as buildListLabels, bH as lineDashPatternPt, bI as DEFAULT_FONT_SIZE_PX, bJ as resolveGradientAxis, bK as isDoubleUnderlineStyle, bL as isWavyUnderlineStyle, bM as underlineStyleLineWidthPx, bN as WAVY_UNDERLINE_WAVELENGTH_PX, bO as WAVY_UNDERLINE_AMPLITUDE_PX, bP as DOUBLE_UNDERLINE_OFFSET_PX, bQ as underlineStyleDashArray, bR as resolveEffectiveParagraphStyle, bS as EMPHASIS_GLYPH, bT as parseHexColorToRgb255, bU as rgb255ToHex, bV as getImageFloatingGeometry, bW as resolveEffectiveTextStyleForParagraph, bX as textStyleToFontSizePt, bY as mathDisplayText, bZ as TEXT_BASELINE_RATIO, b_ as resolveTextAlignmentBaselineOffset, b$ as resolveRenderedTextChar, c0 as resolveOpenTypeFeatureTags, c1 as isLowercaseSmallCapsChar, c2 as resolveDecorationLineY, c3 as DOUBLE_STRIKE_OFFSET_PX, c4 as resolveListLabel, c5 as getListLabelInset, c6 as getAlignedListLabelInset, c7 as getParagraphBorderInsets, c8 as buildSegmentTable, c9 as buildCanvasTableLayout, ca as resolveCanvasTableWidth, cb as resolveFloatingTableRect, cc as paragraphBetweenBorderMatches, cd as normalizeFamily, ce as ROBOTO_FONT_FILES, cf as loadFontAsset, cg as getRemotePdfFontFaces, ch as OFFICE_COMPAT_FONT_FAMILIES, ci as BinaryReader, cj as buildSfnt, ck as defaultFontDecoderRegistry, cl as SfntFontProgram, cm as zlibSync, cn as renumberImageCaptionsInDocument, co as collectPdfFontFamilies, cp as outlineFrom, cq as getPageHeaderZoneTop, cr as getPageColumnRects, cs as findFootnoteReference, ct as resolveImporterForFile, cu as roundTo, cv as getDocumentSectionsCanonical, cw as getDocumentParagraphsCanonical, cx as getDocumentParagraphs, cy as getImageCaptionText, cz as isImageCaptionParagraph, cA as updateImageCaptionParagraph, cB as createImageCaptionParagraph, cC as renumberImageCaptionParagraphs, cD as getCaptionSelectionOffset, cE as PX_PER_CM, cF as getDocumentPageSettings, cG as getTableCellContentWidthForParagraph, cH as layoutMetricsEpoch, cI as bumpLayoutMetricsEpoch, cJ as createCanvasLayoutSnapshotProvider, cK as on, cL as debounce, cM as unwrap, cN as perfTimer, cO as prepareDocumentFonts, cP as getRunTextBox, cQ as EMU_PER_PX, cR as createEditorDocument, cS as resolveResizedDimensions, cT as axisSignForDirection, cU as clamp$1, cV as MIN_RESIZE_SIZE_PX, cW as resolveTextBoxRenderHeight, cX as getToolbarStyleState, cY as VERTICAL_HIT_WEIGHT, cZ as getCachedCanvasImage, c_ as measureParagraphMinContentWidthPx, c$ as createSectionBoundaryParagraph, d0 as normalizePageSettings, d1 as DEFAULT_EDITOR_PAGE_SETTINGS, d2 as markStart, d3 as markEnd, d4 as getParagraphEntries, d5 as getParagraphById, d6 as createEditorFootnote, d7 as createFootnoteReferenceRun, d8 as renumberFootnotes, d9 as iterateFootnoteReferenceRuns, da as preciseFontModeVersion, db as isPreciseFontModeEnabled, dc as getRunFieldChar, dd as getRunFieldInstruction, de as getHeadingLevel, df as createEditorRun, dg as TWIPS_PER_INCH, dh as PX_PER_INCH, di as togglePreciseFontMode, dj as nextFontSizePt, dk as previousFontSizePt, dl as fontSizePtToPx, dm as resolveNamedTextStyle, dn as resolveNamedTableStyle, dp as resolveEffectiveTableStyle, dq as createDefaultToolbarPreset, dr as MenuRegistry, ds as createToolbarRegistry, dt as Editor, du as resolveCommandRef, dv as commandRefName, dw as createOasisEditorClient, dx as createEditorZoom, dy as startLongTaskObserver, dz as installGlobalReport, dA as applyStoredPreciseFontPreference, dB as getWelcomeSeen, dC as isLocalFontAccessSupported, dD as EDITOR_SCROLL_PADDING_PX, dE as Toolbar, dF as OasisEditorLoading, dG as I18nProvider, dH as createTranslator, dI as registerDomStatsSurface, dJ as createEditorLogger } from "./index-
|
|
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, q as assertNever, r as cloneRun, s as createSignal, t as createEditorStateFromDocument, u as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, v as fontSizePxToPt, w as probeLocalFontFamilies, x as createEditorParagraphFromRuns, y as isInlineObjectRun, z as stylesEqual, A as cloneStyle, B as createEditorStyledRun, C as cloneParagraphList, D as cloneParagraph, G as getParagraphLength, H as getActiveZone, I as getActiveSectionIndex, J as getParagraphs, K as normalizeSelection, L as positionToParagraphOffset, M as cloneParagraphs, N as paragraphOffsetToPosition, O as findParagraphIndex, P as createCollapsedSelection, Q as isSelectionCollapsed, R as MATH_OBJECT_REPLACEMENT, T as setValueStyle, U as setBooleanStyle, V as parseFontSizePtToPx, W as formatFontSizePt, X as setParagraphStyleValue, Y as createEditorParagraph, Z as cloneBlocks, _ as resolveDefaultParagraphStyleId, $ as findParagraphTablePathLocation, a0 as findParagraphLocation, a1 as resolveTablePath, a2 as buildTableCellLayout, a3 as PT_PER_PX, a4 as createEditorTableCell, a5 as createEditorTableRow, a6 as createEditorTable, a7 as clampPosition, a8 as PX_PER_POINT, a9 as underlineStyleToCssDecorationStyle, aa as resolveImageSrc, ab as listKindForTag, ac as isParagraphTag, ad as collectInlineRuns, ae as parseParagraphStyle, af as getRunImage, ag as InlineShell, ah as BalloonShell, ai as DocumentShell, aj as findParagraphTableLocation, ak as createMemo, al as getCaretRectFromSnapshot, am as getParagraphRectFromSnapshot, an as createComponent, ao as CaretOverlay, ap as Show, aq as createRenderEffect, ar as style, as as setStyleProperty, at as setAttribute, au as memo, av as template, aw as Button, ax as useI18n, ay as createEffect, az as TextField, aA as Dialog, aB as insert, aC as className, aD as Grid, aE as SelectField, aF as StatusText, aG as ColorField, aH as UNDERLINE_STYLE_OPTIONS, aI as Stack, aJ as For, aK as ToggleChip, aL as FormField, aM as Checkbox, aN as FieldGroup, aO as Tabs, aP as NumberField, aQ as parseNumber, aR as createStore, aS as reconcile, aT as RadioGroup, aU as Radio$1, aV as TextAreaField, aW as COMMON_SYMBOLS, aX as getRecentSymbols, aY as SYMBOL_CATEGORIES, aZ as rememberSymbol, a_ as delegateEvents, a$ as EMPTY_EDITOR_MATH_EXPRESSION, b0 as serializeLinearMath, b1 as parseLinearMath, b2 as Text, b3 as SurfaceButton, b4 as onMount, b5 as onCleanup, b6 as CheckIcon, b7 as use, b8 as PluginUiHost, b9 as OasisEditorEditor, ba as OasisBrandMark, bb as setPreciseFontPreference, bc as setWelcomeSeen, bd as enablePreciseFontMode, be as WORD_NS$6, bf as XMLSerializer, bg as DOMParser, bh as WORD14_NS, bi as mergeNestedExtensionMarkup, bj as resolveOpcRelationships, bk as parseOpcRelationships, bl as JSZip, bm as normalizeOpcPartPath, bn as OPC_CONTENT_TYPES_PATH, bo as getOpcRelationshipOwnerPath, bp as serializeOpcRelationships, bq as OPC_ROOT_RELATIONSHIPS_PATH, br as hashDocxPartBytes, bs as parseOpcContentTypes, bt as serializeOpcContentTypes, bu as mergeParagraphPropertiesXmlSource, bv as setEditorRunOoxmlSource, bw as mergeRunOoxmlSourceIntoGeneratedXml, bx as mergeTableCellPropertiesXmlSource, by as mergeTableRowPropertiesXmlSource, bz as mergeTablePropertiesXmlSource, bA as exportEditorDocumentToDocxBlob, bB as exportEditorDocumentToDocx, bC as pxToPt$1, bD as resolveFloatingObjectRect, bE as getTextBoxFloatingGeometry, bF as getPresetPathSegments, bG as buildListLabels, bH as lineDashPatternPt, bI as DEFAULT_FONT_SIZE_PX, bJ as resolveGradientAxis, bK as isDoubleUnderlineStyle, bL as isWavyUnderlineStyle, bM as underlineStyleLineWidthPx, bN as WAVY_UNDERLINE_WAVELENGTH_PX, bO as WAVY_UNDERLINE_AMPLITUDE_PX, bP as DOUBLE_UNDERLINE_OFFSET_PX, bQ as underlineStyleDashArray, bR as resolveEffectiveParagraphStyle, bS as EMPHASIS_GLYPH, bT as parseHexColorToRgb255, bU as rgb255ToHex, bV as getImageFloatingGeometry, bW as resolveEffectiveTextStyleForParagraph, bX as textStyleToFontSizePt, bY as mathDisplayText, bZ as TEXT_BASELINE_RATIO, b_ as resolveTextAlignmentBaselineOffset, b$ as resolveRenderedTextChar, c0 as resolveOpenTypeFeatureTags, c1 as isLowercaseSmallCapsChar, c2 as resolveDecorationLineY, c3 as DOUBLE_STRIKE_OFFSET_PX, c4 as resolveListLabel, c5 as getListLabelInset, c6 as getAlignedListLabelInset, c7 as getParagraphBorderInsets, c8 as buildSegmentTable, c9 as buildCanvasTableLayout, ca as resolveCanvasTableWidth, cb as resolveFloatingTableRect, cc as paragraphBetweenBorderMatches, cd as normalizeFamily, ce as ROBOTO_FONT_FILES, cf as loadFontAsset, cg as getRemotePdfFontFaces, ch as OFFICE_COMPAT_FONT_FAMILIES, ci as BinaryReader, cj as buildSfnt, ck as defaultFontDecoderRegistry, cl as SfntFontProgram, cm as zlibSync, cn as renumberImageCaptionsInDocument, co as collectPdfFontFamilies, cp as outlineFrom, cq as getPageHeaderZoneTop, cr as getPageColumnRects, cs as findFootnoteReference, ct as resolveImporterForFile, cu as roundTo, cv as getDocumentSectionsCanonical, cw as getDocumentParagraphsCanonical, cx as getDocumentParagraphs, cy as getImageCaptionText, cz as isImageCaptionParagraph, cA as updateImageCaptionParagraph, cB as createImageCaptionParagraph, cC as renumberImageCaptionParagraphs, cD as getCaptionSelectionOffset, cE as PX_PER_CM, cF as getDocumentPageSettings, cG as getTableCellContentWidthForParagraph, cH as layoutMetricsEpoch, cI as bumpLayoutMetricsEpoch, cJ as createCanvasLayoutSnapshotProvider, cK as on, cL as debounce, cM as unwrap, cN as perfTimer, cO as prepareDocumentFonts, cP as getRunTextBox, cQ as EMU_PER_PX, cR as createEditorDocument, cS as resolveResizedDimensions, cT as axisSignForDirection, cU as clamp$1, cV as MIN_RESIZE_SIZE_PX, cW as resolveTextBoxRenderHeight, cX as getToolbarStyleState, cY as VERTICAL_HIT_WEIGHT, cZ as getCachedCanvasImage, c_ as measureParagraphMinContentWidthPx, c$ as createSectionBoundaryParagraph, d0 as normalizePageSettings, d1 as DEFAULT_EDITOR_PAGE_SETTINGS, d2 as markStart, d3 as markEnd, d4 as getParagraphEntries, d5 as getParagraphById, d6 as createEditorFootnote, d7 as createFootnoteReferenceRun, d8 as renumberFootnotes, d9 as iterateFootnoteReferenceRuns, da as preciseFontModeVersion, db as isPreciseFontModeEnabled, dc as getRunFieldChar, dd as getRunFieldInstruction, de as getHeadingLevel, df as createEditorRun, dg as TWIPS_PER_INCH, dh as PX_PER_INCH, di as togglePreciseFontMode, dj as nextFontSizePt, dk as previousFontSizePt, dl as fontSizePtToPx, dm as resolveNamedTextStyle, dn as resolveNamedTableStyle, dp as resolveEffectiveTableStyle, dq as createDefaultToolbarPreset, dr as MenuRegistry, ds as createToolbarRegistry, dt as Editor, du as resolveCommandRef, dv as commandRefName, dw as createOasisEditorClient, dx as createEditorZoom, dy as startLongTaskObserver, dz as installGlobalReport, dA as applyStoredPreciseFontPreference, dB as getWelcomeSeen, dC as isLocalFontAccessSupported, dD as EDITOR_SCROLL_PADDING_PX, dE as Toolbar, dF as OasisEditorLoading, dG as I18nProvider, dH as createTranslator, dI as registerDomStatsSurface, dJ as createEditorLogger } from "./index-DgN6KXYw.js";
|
|
5
5
|
function projectHeaderFooterBlocksWithDependencies(blocks, deps, context = {}) {
|
|
6
6
|
const {
|
|
7
7
|
pageIndex,
|
|
@@ -27315,6 +27315,7 @@ const MERGE_KEYS = {
|
|
|
27315
27315
|
imageAlt: "imageAlt",
|
|
27316
27316
|
imageCaption: "imageCaption",
|
|
27317
27317
|
imageResize: "imageResize",
|
|
27318
|
+
imageCrop: "imageCrop",
|
|
27318
27319
|
layoutWrapPolygon: "layoutWrapPolygon",
|
|
27319
27320
|
specialIndent: "specialIndent",
|
|
27320
27321
|
paraBorders: "paraBorders",
|
|
@@ -36591,6 +36592,7 @@ function buildEditorViewProps(ctx) {
|
|
|
36591
36592
|
onTextBoxResizeHandleMouseDown: surface.handleTextBoxResizeHandleMouseDown,
|
|
36592
36593
|
onImageRotateHandleMouseDown: surface.handleImageRotateHandleMouseDown,
|
|
36593
36594
|
onImageCropHandleMouseDown: surface.handleImageCropHandleMouseDown,
|
|
36595
|
+
onImageCropBodyMouseDown: surface.handleImageCropBodyMouseDown,
|
|
36594
36596
|
onTextBoxRotateHandleMouseDown: surface.handleTextBoxRotateHandleMouseDown,
|
|
36595
36597
|
onTableDragHandleMouseDown: surface.tableDrag.handleMouseDown,
|
|
36596
36598
|
onTableCornerResizeHandleMouseDown: surface.tableCornerResize.handleMouseDown,
|
|
@@ -40970,40 +40972,133 @@ async function registerPdfImageRun(writer, document2, image) {
|
|
|
40970
40972
|
perWriter.set(resolvedSrc, preparedPromise);
|
|
40971
40973
|
return preparedPromise;
|
|
40972
40974
|
}
|
|
40975
|
+
function transformPath(segments, x, y, width, height, rotation) {
|
|
40976
|
+
if (!rotation) return segments;
|
|
40977
|
+
const cx = x + width / 2;
|
|
40978
|
+
const cy = y + height / 2;
|
|
40979
|
+
const radians = rotation * Math.PI / 180;
|
|
40980
|
+
const rotate = (px, py) => ({
|
|
40981
|
+
x: cx + (px - cx) * Math.cos(radians) - (py - cy) * Math.sin(radians),
|
|
40982
|
+
y: cy + (px - cx) * Math.sin(radians) + (py - cy) * Math.cos(radians)
|
|
40983
|
+
});
|
|
40984
|
+
return segments.map((segment) => {
|
|
40985
|
+
if (segment.type === "close") return segment;
|
|
40986
|
+
if (segment.type === "cubic") {
|
|
40987
|
+
const p1 = rotate(segment.x1, segment.y1);
|
|
40988
|
+
const p2 = rotate(segment.x2, segment.y2);
|
|
40989
|
+
const p3 = rotate(segment.x, segment.y);
|
|
40990
|
+
return {
|
|
40991
|
+
type: "cubic",
|
|
40992
|
+
x1: p1.x,
|
|
40993
|
+
y1: p1.y,
|
|
40994
|
+
x2: p2.x,
|
|
40995
|
+
y2: p2.y,
|
|
40996
|
+
x: p3.x,
|
|
40997
|
+
y: p3.y
|
|
40998
|
+
};
|
|
40999
|
+
}
|
|
41000
|
+
const p = rotate(segment.x, segment.y);
|
|
41001
|
+
return { type: segment.type, x: p.x, y: p.y };
|
|
41002
|
+
});
|
|
41003
|
+
}
|
|
40973
41004
|
async function drawImageObject(writer, pageIndex, document2, image, x, y, width, height) {
|
|
41005
|
+
var _a;
|
|
40974
41006
|
const resourceName = await registerPdfImageRun(writer, document2, image);
|
|
40975
41007
|
if (!resourceName) {
|
|
40976
41008
|
return;
|
|
40977
41009
|
}
|
|
40978
|
-
|
|
40979
|
-
|
|
41010
|
+
const sourceWidth = image.intrinsicWidth ?? image.width;
|
|
41011
|
+
const sourceHeight = image.intrinsicHeight ?? image.height;
|
|
41012
|
+
const sourceRatio = sourceWidth / Math.max(1, sourceHeight);
|
|
41013
|
+
const frameRatio = width / Math.max(1, height);
|
|
41014
|
+
let drawX = x;
|
|
41015
|
+
let drawY = y;
|
|
41016
|
+
let drawWidth = width;
|
|
41017
|
+
let drawHeight = height;
|
|
41018
|
+
if (image.cropFit === "fit" && sourceRatio > 0) {
|
|
41019
|
+
if (sourceRatio > frameRatio) {
|
|
41020
|
+
drawHeight = width / sourceRatio;
|
|
41021
|
+
drawY += (height - drawHeight) / 2;
|
|
41022
|
+
} else {
|
|
41023
|
+
drawWidth = height * sourceRatio;
|
|
41024
|
+
drawX += (width - drawWidth) / 2;
|
|
41025
|
+
}
|
|
41026
|
+
}
|
|
41027
|
+
const effectiveCrop = image.cropFit === "fill" && !image.crop ? (() => {
|
|
41028
|
+
if (sourceRatio > frameRatio) {
|
|
41029
|
+
const visible = frameRatio / sourceRatio;
|
|
41030
|
+
const trim = Math.max(0, (1 - visible) / 2);
|
|
41031
|
+
return { left: trim, right: trim };
|
|
41032
|
+
}
|
|
41033
|
+
if (sourceRatio < frameRatio) {
|
|
41034
|
+
const visible = sourceRatio / frameRatio;
|
|
41035
|
+
const trim = Math.max(0, (1 - visible) / 2);
|
|
41036
|
+
return { top: trim, bottom: trim };
|
|
41037
|
+
}
|
|
41038
|
+
return void 0;
|
|
41039
|
+
})() : image.crop;
|
|
41040
|
+
const shape = (_a = image.cropShape) == null ? void 0 : _a.preset;
|
|
41041
|
+
const shapePath = shape ? transformPath(
|
|
41042
|
+
getPresetPathSegments(shape, x, y, width, height),
|
|
40980
41043
|
x,
|
|
40981
41044
|
y,
|
|
40982
41045
|
width,
|
|
40983
41046
|
height,
|
|
40984
|
-
|
|
40985
|
-
|
|
41047
|
+
image.rotation ?? 0
|
|
41048
|
+
) : null;
|
|
41049
|
+
const rotateFitAroundFrame = image.cropFit === "fit" && Boolean(image.rotation);
|
|
41050
|
+
if (shapePath) {
|
|
41051
|
+
writer.saveGraphicsState(pageIndex);
|
|
41052
|
+
writer.clipPath(pageIndex, shapePath);
|
|
41053
|
+
}
|
|
41054
|
+
if (rotateFitAroundFrame) {
|
|
41055
|
+
writer.saveGraphicsState(pageIndex);
|
|
41056
|
+
writer.rotateAbout(
|
|
41057
|
+
pageIndex,
|
|
41058
|
+
x + width / 2,
|
|
41059
|
+
y + height / 2,
|
|
41060
|
+
image.rotation ?? 0
|
|
41061
|
+
);
|
|
41062
|
+
}
|
|
41063
|
+
writer.drawImage(pageIndex, {
|
|
41064
|
+
resourceName,
|
|
41065
|
+
x: drawX,
|
|
41066
|
+
y: drawY,
|
|
41067
|
+
width: drawWidth,
|
|
41068
|
+
height: drawHeight,
|
|
41069
|
+
rotation: rotateFitAroundFrame ? void 0 : image.rotation,
|
|
41070
|
+
crop: effectiveCrop
|
|
40986
41071
|
});
|
|
41072
|
+
if (rotateFitAroundFrame) writer.restoreGraphicsState(pageIndex);
|
|
41073
|
+
if (shapePath) writer.restoreGraphicsState(pageIndex);
|
|
40987
41074
|
const border = image.border;
|
|
40988
41075
|
if (!border) {
|
|
40989
41076
|
return;
|
|
40990
41077
|
}
|
|
40991
41078
|
const rotation = image.rotation;
|
|
40992
|
-
if (rotation) {
|
|
41079
|
+
if (rotation && !shapePath) {
|
|
40993
41080
|
writer.saveGraphicsState(pageIndex);
|
|
40994
41081
|
writer.rotateAbout(pageIndex, x + width / 2, y + height / 2, rotation);
|
|
40995
41082
|
}
|
|
40996
41083
|
const dashArray = lineDashPatternPt(border.dash);
|
|
40997
|
-
|
|
40998
|
-
|
|
40999
|
-
|
|
41000
|
-
|
|
41001
|
-
|
|
41002
|
-
|
|
41003
|
-
|
|
41004
|
-
|
|
41005
|
-
|
|
41006
|
-
|
|
41084
|
+
if (shapePath) {
|
|
41085
|
+
writer.drawPath(pageIndex, {
|
|
41086
|
+
segments: shapePath,
|
|
41087
|
+
stroke: border.color,
|
|
41088
|
+
lineWidth: border.widthPt ?? 1
|
|
41089
|
+
});
|
|
41090
|
+
} else {
|
|
41091
|
+
writer.drawRect(pageIndex, {
|
|
41092
|
+
x,
|
|
41093
|
+
y,
|
|
41094
|
+
width,
|
|
41095
|
+
height,
|
|
41096
|
+
stroke: border.color,
|
|
41097
|
+
lineWidth: border.widthPt ?? 1,
|
|
41098
|
+
...dashArray.length > 0 ? { dashArray } : {}
|
|
41099
|
+
});
|
|
41100
|
+
}
|
|
41101
|
+
if (rotation && !shapePath) {
|
|
41007
41102
|
writer.restoreGraphicsState(pageIndex);
|
|
41008
41103
|
}
|
|
41009
41104
|
}
|
|
@@ -42711,6 +42806,37 @@ class PdfContentStream {
|
|
|
42711
42806
|
"n"
|
|
42712
42807
|
);
|
|
42713
42808
|
}
|
|
42809
|
+
/** Intersects the current clip with an arbitrary top-left-origin path. */
|
|
42810
|
+
clipPath(segments) {
|
|
42811
|
+
const page = this.page;
|
|
42812
|
+
if (segments.length === 0) return;
|
|
42813
|
+
const flip = (yy) => page.height - yy;
|
|
42814
|
+
const commands = [];
|
|
42815
|
+
for (const segment of segments) {
|
|
42816
|
+
switch (segment.type) {
|
|
42817
|
+
case "move":
|
|
42818
|
+
commands.push(
|
|
42819
|
+
`${formatNumber(segment.x)} ${formatNumber(flip(segment.y))} m`
|
|
42820
|
+
);
|
|
42821
|
+
break;
|
|
42822
|
+
case "line":
|
|
42823
|
+
commands.push(
|
|
42824
|
+
`${formatNumber(segment.x)} ${formatNumber(flip(segment.y))} l`
|
|
42825
|
+
);
|
|
42826
|
+
break;
|
|
42827
|
+
case "cubic":
|
|
42828
|
+
commands.push(
|
|
42829
|
+
`${formatNumber(segment.x1)} ${formatNumber(flip(segment.y1))} ${formatNumber(segment.x2)} ${formatNumber(flip(segment.y2))} ${formatNumber(segment.x)} ${formatNumber(flip(segment.y))} c`
|
|
42830
|
+
);
|
|
42831
|
+
break;
|
|
42832
|
+
case "close":
|
|
42833
|
+
commands.push("h");
|
|
42834
|
+
break;
|
|
42835
|
+
}
|
|
42836
|
+
}
|
|
42837
|
+
commands.push("W", "n");
|
|
42838
|
+
page.commands.push(commands.join("\n"));
|
|
42839
|
+
}
|
|
42714
42840
|
drawText(options) {
|
|
42715
42841
|
if (options.text.length === 0) {
|
|
42716
42842
|
return;
|
|
@@ -44643,6 +44769,10 @@ class OasisPdfWriter {
|
|
|
44643
44769
|
var _a;
|
|
44644
44770
|
(_a = this.streams[pageIndex]) == null ? void 0 : _a.clipRect(x, y, width, height);
|
|
44645
44771
|
}
|
|
44772
|
+
clipPath(pageIndex, segments) {
|
|
44773
|
+
var _a;
|
|
44774
|
+
(_a = this.streams[pageIndex]) == null ? void 0 : _a.clipPath(segments);
|
|
44775
|
+
}
|
|
44646
44776
|
drawText(pageIndex, options) {
|
|
44647
44777
|
var _a;
|
|
44648
44778
|
(_a = this.streams[pageIndex]) == null ? void 0 : _a.drawText(options);
|
|
@@ -45441,6 +45571,72 @@ function applySelectedImageCropAspect(state, mode) {
|
|
|
45441
45571
|
}
|
|
45442
45572
|
return setSelectedImageCrop(state, computeImageAspectCrop(image, mode));
|
|
45443
45573
|
}
|
|
45574
|
+
function getSelectedImageCropShape(state) {
|
|
45575
|
+
const selectedImage = getSelectedImageRun(state);
|
|
45576
|
+
const image = selectedImage && getRunImage(selectedImage.run);
|
|
45577
|
+
return (image == null ? void 0 : image.cropShape) ?? null;
|
|
45578
|
+
}
|
|
45579
|
+
function setSelectedImageCropShape(state, preset) {
|
|
45580
|
+
const normalized = preset == null ? void 0 : preset.trim();
|
|
45581
|
+
return patchSelectedImage(state, (image) => {
|
|
45582
|
+
const next = { ...image };
|
|
45583
|
+
if (!normalized || normalized === "rect") {
|
|
45584
|
+
delete next.cropShape;
|
|
45585
|
+
} else {
|
|
45586
|
+
next.cropShape = { preset: normalized };
|
|
45587
|
+
if (!next.cropFit) next.cropFit = "fill";
|
|
45588
|
+
}
|
|
45589
|
+
return next;
|
|
45590
|
+
});
|
|
45591
|
+
}
|
|
45592
|
+
function computeImageFillCrop(image) {
|
|
45593
|
+
const sourceWidth = image.intrinsicWidth ?? image.width;
|
|
45594
|
+
const sourceHeight = image.intrinsicHeight ?? image.height;
|
|
45595
|
+
const sourceRatio = sourceWidth > 0 && sourceHeight > 0 ? sourceWidth / sourceHeight : image.width / Math.max(1, image.height);
|
|
45596
|
+
const frameRatio = image.width / Math.max(1, image.height);
|
|
45597
|
+
if (!Number.isFinite(sourceRatio) || !Number.isFinite(frameRatio)) {
|
|
45598
|
+
return {};
|
|
45599
|
+
}
|
|
45600
|
+
if (sourceRatio > frameRatio) {
|
|
45601
|
+
const visibleWidth = frameRatio / sourceRatio;
|
|
45602
|
+
const trim = Math.max(0, (1 - visibleWidth) / 2);
|
|
45603
|
+
return { left: trim, right: trim };
|
|
45604
|
+
}
|
|
45605
|
+
if (sourceRatio < frameRatio) {
|
|
45606
|
+
const visibleHeight = sourceRatio / frameRatio;
|
|
45607
|
+
const trim = Math.max(0, (1 - visibleHeight) / 2);
|
|
45608
|
+
return { top: trim, bottom: trim };
|
|
45609
|
+
}
|
|
45610
|
+
return {};
|
|
45611
|
+
}
|
|
45612
|
+
function applySelectedImageCropFill(state) {
|
|
45613
|
+
const selectedImage = getSelectedImageRun(state);
|
|
45614
|
+
const image = selectedImage && getRunImage(selectedImage.run);
|
|
45615
|
+
if (!image) return state;
|
|
45616
|
+
const cropped = setSelectedImageCrop(state, {
|
|
45617
|
+
crop: computeImageFillCrop(image)
|
|
45618
|
+
});
|
|
45619
|
+
return patchSelectedImage(cropped, (next) => ({
|
|
45620
|
+
...next,
|
|
45621
|
+
cropFit: "fill"
|
|
45622
|
+
}));
|
|
45623
|
+
}
|
|
45624
|
+
function applySelectedImageCropFit(state) {
|
|
45625
|
+
return patchSelectedImage(state, (image) => {
|
|
45626
|
+
const next = { ...image, cropFit: "fit" };
|
|
45627
|
+
delete next.crop;
|
|
45628
|
+
return next;
|
|
45629
|
+
});
|
|
45630
|
+
}
|
|
45631
|
+
function resetSelectedImageCrop(state) {
|
|
45632
|
+
return patchSelectedImage(state, (image) => {
|
|
45633
|
+
const next = { ...image };
|
|
45634
|
+
delete next.crop;
|
|
45635
|
+
delete next.cropFit;
|
|
45636
|
+
delete next.cropShape;
|
|
45637
|
+
return next;
|
|
45638
|
+
});
|
|
45639
|
+
}
|
|
45444
45640
|
function getSelectedImageBorder(state) {
|
|
45445
45641
|
const selectedImage = getSelectedImageRun(state);
|
|
45446
45642
|
const image = selectedImage && getRunImage(selectedImage.run);
|
|
@@ -45755,7 +45951,13 @@ function createImageInsertionService(deps) {
|
|
|
45755
45951
|
deps.applyTransactionalState(
|
|
45756
45952
|
(current) => {
|
|
45757
45953
|
const targetState = position ? setSelection(current, { anchor: position, focus: position }) : current;
|
|
45758
|
-
return insertImageAtSelection(targetState, {
|
|
45954
|
+
return insertImageAtSelection(targetState, {
|
|
45955
|
+
src,
|
|
45956
|
+
width,
|
|
45957
|
+
height,
|
|
45958
|
+
intrinsicWidth: naturalWidth,
|
|
45959
|
+
intrinsicHeight: naturalHeight
|
|
45960
|
+
});
|
|
45759
45961
|
},
|
|
45760
45962
|
{ mergeKey: MERGE_KEYS.insertImage }
|
|
45761
45963
|
);
|
|
@@ -49176,6 +49378,15 @@ function createRotateSession(adapter, deps) {
|
|
|
49176
49378
|
function visibleFraction(near, far) {
|
|
49177
49379
|
return Math.max(1e-4, 1 - near - far);
|
|
49178
49380
|
}
|
|
49381
|
+
function clampCropPair(near, far, nextNear, nextFar) {
|
|
49382
|
+
const visible = Math.max(0.01, 1 - near - far);
|
|
49383
|
+
const clampedNear = Math.max(0, Math.min(nextNear, 0.99 - far));
|
|
49384
|
+
const clampedFar = Math.max(0, Math.min(nextFar, 0.99 - clampedNear));
|
|
49385
|
+
if (clampedNear + clampedFar >= 0.99) {
|
|
49386
|
+
return { near: Math.max(0, 0.99 - visible - far), far };
|
|
49387
|
+
}
|
|
49388
|
+
return { near: clampedNear, far: clampedFar };
|
|
49389
|
+
}
|
|
49179
49390
|
function resolveCroppedImage(geometry, deltaX, deltaY) {
|
|
49180
49391
|
const { startWidth: W, startHeight: H } = geometry;
|
|
49181
49392
|
const l0 = geometry.startCrop.left ?? 0;
|
|
@@ -49190,26 +49401,36 @@ function resolveCroppedImage(geometry, deltaX, deltaY) {
|
|
|
49190
49401
|
let right = r0;
|
|
49191
49402
|
let width = W;
|
|
49192
49403
|
if (xs !== 0) {
|
|
49193
|
-
|
|
49194
|
-
|
|
49195
|
-
|
|
49196
|
-
|
|
49197
|
-
|
|
49404
|
+
if (xs < 0) {
|
|
49405
|
+
const maxWidth = W + l0 / kx;
|
|
49406
|
+
width = clamp$1(W - deltaX, MIN_RESIZE_SIZE_PX, maxWidth);
|
|
49407
|
+
const pair = clampCropPair(l0, r0, l0 - (width - W) * kx, r0);
|
|
49408
|
+
left = pair.near;
|
|
49409
|
+
right = pair.far;
|
|
49198
49410
|
} else {
|
|
49199
|
-
|
|
49411
|
+
const maxWidth = W + r0 / kx;
|
|
49412
|
+
width = clamp$1(W + deltaX, MIN_RESIZE_SIZE_PX, maxWidth);
|
|
49413
|
+
const pair = clampCropPair(l0, r0, l0, r0 - (width - W) * kx);
|
|
49414
|
+
left = pair.near;
|
|
49415
|
+
right = pair.far;
|
|
49200
49416
|
}
|
|
49201
49417
|
}
|
|
49202
49418
|
let top = t0;
|
|
49203
49419
|
let bottom = b0;
|
|
49204
49420
|
let height = H;
|
|
49205
49421
|
if (ys !== 0) {
|
|
49206
|
-
|
|
49207
|
-
|
|
49208
|
-
|
|
49209
|
-
|
|
49210
|
-
|
|
49422
|
+
if (ys < 0) {
|
|
49423
|
+
const maxHeight = H + t0 / ky;
|
|
49424
|
+
height = clamp$1(H - deltaY, MIN_RESIZE_SIZE_PX, maxHeight);
|
|
49425
|
+
const pair = clampCropPair(t0, b0, t0 - (height - H) * ky, b0);
|
|
49426
|
+
top = pair.near;
|
|
49427
|
+
bottom = pair.far;
|
|
49211
49428
|
} else {
|
|
49212
|
-
|
|
49429
|
+
const maxHeight = H + b0 / ky;
|
|
49430
|
+
height = clamp$1(H + deltaY, MIN_RESIZE_SIZE_PX, maxHeight);
|
|
49431
|
+
const pair = clampCropPair(t0, b0, t0, b0 - (height - H) * ky);
|
|
49432
|
+
top = pair.near;
|
|
49433
|
+
bottom = pair.far;
|
|
49213
49434
|
}
|
|
49214
49435
|
}
|
|
49215
49436
|
return {
|
|
@@ -49218,6 +49439,29 @@ function resolveCroppedImage(geometry, deltaX, deltaY) {
|
|
|
49218
49439
|
height: Math.round(height)
|
|
49219
49440
|
};
|
|
49220
49441
|
}
|
|
49442
|
+
function resolveMovedImageCrop(geometry, deltaX, deltaY) {
|
|
49443
|
+
const { startWidth: W, startHeight: H } = geometry;
|
|
49444
|
+
const l0 = geometry.startCrop.left ?? 0;
|
|
49445
|
+
const t0 = geometry.startCrop.top ?? 0;
|
|
49446
|
+
const r0 = geometry.startCrop.right ?? 0;
|
|
49447
|
+
const b0 = geometry.startCrop.bottom ?? 0;
|
|
49448
|
+
const kx = visibleFraction(l0, r0) / W;
|
|
49449
|
+
const ky = visibleFraction(t0, b0) / H;
|
|
49450
|
+
const visibleW = 1 - l0 - r0;
|
|
49451
|
+
const visibleH = 1 - t0 - b0;
|
|
49452
|
+
const nextLeft = Math.max(0, Math.min(1 - visibleW, l0 - deltaX * kx));
|
|
49453
|
+
const nextTop = Math.max(0, Math.min(1 - visibleH, t0 - deltaY * ky));
|
|
49454
|
+
return {
|
|
49455
|
+
crop: {
|
|
49456
|
+
left: nextLeft,
|
|
49457
|
+
right: Math.max(0, 1 - visibleW - nextLeft),
|
|
49458
|
+
top: nextTop,
|
|
49459
|
+
bottom: Math.max(0, 1 - visibleH - nextTop)
|
|
49460
|
+
},
|
|
49461
|
+
width: Math.round(W),
|
|
49462
|
+
height: Math.round(H)
|
|
49463
|
+
};
|
|
49464
|
+
}
|
|
49221
49465
|
function createCropSession(deps) {
|
|
49222
49466
|
let active = null;
|
|
49223
49467
|
const selectionForObject = (state, paragraphId, paragraphOffset) => {
|
|
@@ -49248,7 +49492,7 @@ function createCropSession(deps) {
|
|
|
49248
49492
|
const z = ((_a = deps.zoomFactor) == null ? void 0 : _a.call(deps)) ?? 1;
|
|
49249
49493
|
const deltaX = (event.clientX - crop.startClientX) / z;
|
|
49250
49494
|
const deltaY = (event.clientY - crop.startClientY) / z;
|
|
49251
|
-
const result = resolveCroppedImage(crop, deltaX, deltaY);
|
|
49495
|
+
const result = crop.mode === "move" ? resolveMovedImageCrop(crop, deltaX, deltaY) : resolveCroppedImage(crop, deltaX, deltaY);
|
|
49252
49496
|
const selection = selectionForObject(
|
|
49253
49497
|
deps.state,
|
|
49254
49498
|
crop.paragraphId,
|
|
@@ -49286,7 +49530,7 @@ function createCropSession(deps) {
|
|
|
49286
49530
|
window.removeEventListener("mousemove", handleMouseMove);
|
|
49287
49531
|
window.removeEventListener("mouseup", handleMouseUp);
|
|
49288
49532
|
};
|
|
49289
|
-
const
|
|
49533
|
+
const begin = (paragraphId, paragraphOffset, handleDirection, event, initialState, mode) => {
|
|
49290
49534
|
const selection = selectionForObject(
|
|
49291
49535
|
initialState,
|
|
49292
49536
|
paragraphId,
|
|
@@ -49312,12 +49556,22 @@ function createCropSession(deps) {
|
|
|
49312
49556
|
startWidth: image.width,
|
|
49313
49557
|
startHeight: image.height,
|
|
49314
49558
|
startCrop,
|
|
49315
|
-
initialState: deps.cloneState(initialState)
|
|
49559
|
+
initialState: deps.cloneState(initialState),
|
|
49560
|
+
mode
|
|
49316
49561
|
};
|
|
49317
49562
|
window.addEventListener("mousemove", handleMouseMove);
|
|
49318
49563
|
window.addEventListener("mouseup", handleMouseUp);
|
|
49319
49564
|
};
|
|
49320
|
-
|
|
49565
|
+
const start = (paragraphId, paragraphOffset, handleDirection, event, initialState) => begin(
|
|
49566
|
+
paragraphId,
|
|
49567
|
+
paragraphOffset,
|
|
49568
|
+
handleDirection,
|
|
49569
|
+
event,
|
|
49570
|
+
initialState,
|
|
49571
|
+
"handle"
|
|
49572
|
+
);
|
|
49573
|
+
const startMove = (paragraphId, paragraphOffset, event, initialState) => begin(paragraphId, paragraphOffset, "se", event, initialState, "move");
|
|
49574
|
+
return { start, startMove, stop };
|
|
49321
49575
|
}
|
|
49322
49576
|
function createEditorImageOperations(deps) {
|
|
49323
49577
|
return createEditorImageOperationsImpl(deps);
|
|
@@ -49587,6 +49841,11 @@ function createEditorImageOperationsImpl(deps) {
|
|
|
49587
49841
|
deps.state
|
|
49588
49842
|
);
|
|
49589
49843
|
};
|
|
49844
|
+
const handleImageCropBodyMouseDown = (paragraphId, paragraphOffset, event) => {
|
|
49845
|
+
event.preventDefault();
|
|
49846
|
+
event.stopPropagation();
|
|
49847
|
+
imageCropSession.startMove(paragraphId, paragraphOffset, event, deps.state);
|
|
49848
|
+
};
|
|
49590
49849
|
return {
|
|
49591
49850
|
dragging,
|
|
49592
49851
|
cropMode,
|
|
@@ -49604,7 +49863,8 @@ function createEditorImageOperationsImpl(deps) {
|
|
|
49604
49863
|
handleImageMouseDown,
|
|
49605
49864
|
handleImageResizeHandleMouseDown,
|
|
49606
49865
|
handleImageRotateHandleMouseDown,
|
|
49607
|
-
handleImageCropHandleMouseDown
|
|
49866
|
+
handleImageCropHandleMouseDown,
|
|
49867
|
+
handleImageCropBodyMouseDown
|
|
49608
49868
|
};
|
|
49609
49869
|
}
|
|
49610
49870
|
function createEditorTextBoxOperations(deps) {
|
|
@@ -54190,7 +54450,36 @@ function createEditorCommandsControllerImpl(deps) {
|
|
|
54190
54450
|
return;
|
|
54191
54451
|
}
|
|
54192
54452
|
execTransactional(
|
|
54193
|
-
(current) => applySelectedImageCropAspect(current, mode)
|
|
54453
|
+
(current) => mode === "reset" ? resetSelectedImageCrop(current) : applySelectedImageCropAspect(current, mode),
|
|
54454
|
+
{ mergeKey: MERGE_KEYS.imageCrop }
|
|
54455
|
+
);
|
|
54456
|
+
};
|
|
54457
|
+
const applyImageCropShapeCommand = (preset) => {
|
|
54458
|
+
if (!selectedImageRun()) return;
|
|
54459
|
+
execTransactional(
|
|
54460
|
+
(current) => setSelectedImageCropShape(current, preset),
|
|
54461
|
+
{ mergeKey: MERGE_KEYS.imageCrop }
|
|
54462
|
+
);
|
|
54463
|
+
};
|
|
54464
|
+
const applyImageCropFillCommand = () => {
|
|
54465
|
+
if (!selectedImageRun()) return;
|
|
54466
|
+
execTransactional(
|
|
54467
|
+
(current) => applySelectedImageCropFill(current),
|
|
54468
|
+
{ mergeKey: MERGE_KEYS.imageCrop }
|
|
54469
|
+
);
|
|
54470
|
+
};
|
|
54471
|
+
const applyImageCropFitCommand = () => {
|
|
54472
|
+
if (!selectedImageRun()) return;
|
|
54473
|
+
execTransactional(
|
|
54474
|
+
(current) => applySelectedImageCropFit(current),
|
|
54475
|
+
{ mergeKey: MERGE_KEYS.imageCrop }
|
|
54476
|
+
);
|
|
54477
|
+
};
|
|
54478
|
+
const resetImageCropCommand = () => {
|
|
54479
|
+
if (!selectedImageRun()) return;
|
|
54480
|
+
execTransactional(
|
|
54481
|
+
(current) => resetSelectedImageCrop(current),
|
|
54482
|
+
{ mergeKey: MERGE_KEYS.imageCrop }
|
|
54194
54483
|
);
|
|
54195
54484
|
};
|
|
54196
54485
|
const applyImageBorderCommand = (patch) => {
|
|
@@ -54232,6 +54521,10 @@ function createEditorCommandsControllerImpl(deps) {
|
|
|
54232
54521
|
applyImageWidthCmCommand,
|
|
54233
54522
|
applyImageHeightCmCommand,
|
|
54234
54523
|
applyImageCropAspectCommand,
|
|
54524
|
+
applyImageCropShapeCommand,
|
|
54525
|
+
applyImageCropFillCommand,
|
|
54526
|
+
applyImageCropFitCommand,
|
|
54527
|
+
resetImageCropCommand,
|
|
54235
54528
|
applyImageBorderCommand,
|
|
54236
54529
|
handleListTab,
|
|
54237
54530
|
handleListEnter,
|
|
@@ -55338,6 +55631,29 @@ function buildDocumentAndBrowserCommands({
|
|
|
55338
55631
|
isEnabled: image.isSelected()
|
|
55339
55632
|
})
|
|
55340
55633
|
),
|
|
55634
|
+
imageCropShape: actionCommand(
|
|
55635
|
+
"imageCropShape",
|
|
55636
|
+
(p) => image.applyCropShape(String(p)),
|
|
55637
|
+
() => ({
|
|
55638
|
+
isEnabled: image.isSelected(),
|
|
55639
|
+
value: image.getCropShape()
|
|
55640
|
+
})
|
|
55641
|
+
),
|
|
55642
|
+
imageCropFill: actionCommand(
|
|
55643
|
+
"imageCropFill",
|
|
55644
|
+
() => image.applyCropFill(),
|
|
55645
|
+
() => ({ isEnabled: image.isSelected() })
|
|
55646
|
+
),
|
|
55647
|
+
imageCropFit: actionCommand(
|
|
55648
|
+
"imageCropFit",
|
|
55649
|
+
() => image.applyCropFit(),
|
|
55650
|
+
() => ({ isEnabled: image.isSelected() })
|
|
55651
|
+
),
|
|
55652
|
+
imageCropReset: actionCommand(
|
|
55653
|
+
"imageCropReset",
|
|
55654
|
+
() => image.resetCrop(),
|
|
55655
|
+
() => ({ isEnabled: image.isSelected() })
|
|
55656
|
+
),
|
|
55341
55657
|
imageBorder: actionCommand(
|
|
55342
55658
|
"imageBorder",
|
|
55343
55659
|
(p) => image.setBorder(p),
|
|
@@ -56239,6 +56555,14 @@ function buildEssentialsImage(options) {
|
|
|
56239
56555
|
isCropActive: () => options.imageCropMode.isActive(),
|
|
56240
56556
|
toggleCrop: () => options.imageCropMode.toggle(),
|
|
56241
56557
|
applyCropAspect: (preset) => options.commandsController.applyImageCropAspectCommand(preset),
|
|
56558
|
+
getCropShape: () => {
|
|
56559
|
+
var _a;
|
|
56560
|
+
return ((_a = getSelectedImageCropShape(options.state())) == null ? void 0 : _a.preset) ?? null;
|
|
56561
|
+
},
|
|
56562
|
+
applyCropShape: (preset) => options.commandsController.applyImageCropShapeCommand(preset),
|
|
56563
|
+
applyCropFill: () => options.commandsController.applyImageCropFillCommand(),
|
|
56564
|
+
applyCropFit: () => options.commandsController.applyImageCropFitCommand(),
|
|
56565
|
+
resetCrop: () => options.commandsController.resetImageCropCommand(),
|
|
56242
56566
|
getBorder: () => getSelectedImageBorder(options.state()),
|
|
56243
56567
|
setBorder: (patch) => options.commandsController.applyImageBorderCommand(patch)
|
|
56244
56568
|
};
|
|
@@ -57674,6 +57998,7 @@ function OasisEditorApp(props = {}) {
|
|
|
57674
57998
|
handleTextBoxResizeHandleMouseDown: textBoxOps.handleTextBoxResizeHandleMouseDown,
|
|
57675
57999
|
handleImageRotateHandleMouseDown: imageOps.handleImageRotateHandleMouseDown,
|
|
57676
58000
|
handleImageCropHandleMouseDown: imageOps.handleImageCropHandleMouseDown,
|
|
58001
|
+
handleImageCropBodyMouseDown: imageOps.handleImageCropBodyMouseDown,
|
|
57677
58002
|
handleTextBoxRotateHandleMouseDown: textBoxOps.handleTextBoxRotateHandleMouseDown,
|
|
57678
58003
|
handleEditorContextMenu
|
|
57679
58004
|
},
|
|
@@ -48,6 +48,10 @@ declare function createEditorCommandsControllerImpl(deps: EditorCommandsControll
|
|
|
48
48
|
applyImageWidthCmCommand: (cm: number) => void;
|
|
49
49
|
applyImageHeightCmCommand: (cm: number) => void;
|
|
50
50
|
applyImageCropAspectCommand: (preset: string) => void;
|
|
51
|
+
applyImageCropShapeCommand: (preset: string) => void;
|
|
52
|
+
applyImageCropFillCommand: () => void;
|
|
53
|
+
applyImageCropFitCommand: () => void;
|
|
54
|
+
resetImageCropCommand: () => void;
|
|
51
55
|
applyImageBorderCommand: (patch: ImageBorderPatch) => void;
|
|
52
56
|
handleListTab: (direction: "indent" | "outdent") => boolean;
|
|
53
57
|
handleListEnter: () => boolean;
|
|
@@ -22,5 +22,6 @@ export interface CropSessionDeps {
|
|
|
22
22
|
*/
|
|
23
23
|
export declare function createCropSession(deps: CropSessionDeps): {
|
|
24
24
|
start: (paragraphId: string, paragraphOffset: number, handleDirection: ResizeHandleDirection, event: MouseEvent, initialState: EditorState) => void;
|
|
25
|
+
startMove: (paragraphId: string, paragraphOffset: number, event: MouseEvent, initialState: EditorState) => void;
|
|
25
26
|
stop: () => void;
|
|
26
27
|
};
|
|
@@ -73,5 +73,8 @@ declare function createEditorImageOperationsImpl(deps: EditorImageOperationsDeps
|
|
|
73
73
|
handleImageCropHandleMouseDown: (paragraphId: string, paragraphOffset: number, direction: ResizeHandleDirection, event: MouseEvent & {
|
|
74
74
|
currentTarget: HTMLElement;
|
|
75
75
|
}) => void;
|
|
76
|
+
handleImageCropBodyMouseDown: (paragraphId: string, paragraphOffset: number, event: MouseEvent & {
|
|
77
|
+
currentTarget: HTMLElement;
|
|
78
|
+
}) => void;
|
|
76
79
|
};
|
|
77
80
|
export {};
|