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,2 +1,2 @@
|
|
|
1
|
-
export declare const OASIS_BUILTIN_COMMANDS: readonly ["selectAll", "insertFootnote", "insertTableOfContents", "updateTableOfContents", "pastePlainText", "bold", "italic", "underline", "strike", "superscript", "subscript", "link", "unlink", "alignLeft", "alignCenter", "alignRight", "alignJustify", "orderedList", "bulletList", "find", "replace", "toggleTrackChanges", "acceptRevisions", "rejectRevisions", "toggleShowMargins", "toggleShowParagraphMarks", "togglePreciseFonts", "undo", "redo", "pageBreak", "lineBreak", "splitBlock", "setFontFamily", "setFontSize", "increaseFontSize", "decreaseFontSize", "changeTextCase", "clearFormatting", "setColor", "setHighlight", "setTextShading", "setStyleId", "setCharacterStyleId", "setUnderlineStyle", "documentStyles", "print", "copy", "exportDocx", "exportPdf", "importDocument", "insertImage", "editImageAlt", "insertImageCaption", "imageContext", "imageWidthCm", "imageHeightCm", "imageCrop", "imageCropAspect", "outdent", "indent", "togglePageBreakBefore", "toggleKeepWithNext", "setSpacingAfter", "setSpacingBefore", "setIndentLeft", "setIndentRight", "setIndentFirstLine", "setIndentHanging", "setSpecialIndent", "setParagraphShading", "applyParagraphBorders", "setLineHeight", "setListFormat", "setListStartAt", "toggleOrientation", "setOrientation", "sectionBreakNextPage", "sectionBreakContinuous", "setPageMargins", "tableContext", "tableMerge", "tableSplit", "tableInsertColumnBefore", "tableInsertColumnAfter", "tableDeleteColumn", "tableInsertRowBefore", "tableInsertRowAfter", "tableDeleteRow", "tableCellShading", "tableCellBorders", "tableCellNoBorders", "tableWidth100", "tableAlignLeft", "tableAlignCenter", "tableAlignRight", "tableSetCellWidth", "tableToggleHeaderRow", "tableToggleTotalRow", "tableToggleBandedRows", "tableToggleFirstColumn", "tableToggleLastColumn", "tableToggleBandedColumns", "setTableStyle", "tableToggleAutoFit", "tableDistributeColumns", "tableDistributeRows", "insertTable", "insertShape"];
|
|
1
|
+
export declare const OASIS_BUILTIN_COMMANDS: readonly ["selectAll", "insertFootnote", "insertTableOfContents", "updateTableOfContents", "pastePlainText", "bold", "italic", "underline", "strike", "superscript", "subscript", "link", "unlink", "alignLeft", "alignCenter", "alignRight", "alignJustify", "orderedList", "bulletList", "find", "replace", "toggleTrackChanges", "acceptRevisions", "rejectRevisions", "toggleShowMargins", "toggleShowParagraphMarks", "togglePreciseFonts", "undo", "redo", "pageBreak", "lineBreak", "splitBlock", "setFontFamily", "setFontSize", "increaseFontSize", "decreaseFontSize", "changeTextCase", "clearFormatting", "setColor", "setHighlight", "setTextShading", "setStyleId", "setCharacterStyleId", "setUnderlineStyle", "documentStyles", "print", "copy", "exportDocx", "exportPdf", "importDocument", "insertImage", "editImageAlt", "insertImageCaption", "imageContext", "imageWidthCm", "imageHeightCm", "imageCrop", "imageCropAspect", "imageBorder", "outdent", "indent", "togglePageBreakBefore", "toggleKeepWithNext", "setSpacingAfter", "setSpacingBefore", "setIndentLeft", "setIndentRight", "setIndentFirstLine", "setIndentHanging", "setSpecialIndent", "setParagraphShading", "applyParagraphBorders", "setLineHeight", "setListFormat", "setListStartAt", "toggleOrientation", "setOrientation", "sectionBreakNextPage", "sectionBreakContinuous", "setPageMargins", "tableContext", "tableMerge", "tableSplit", "tableInsertColumnBefore", "tableInsertColumnAfter", "tableDeleteColumn", "tableInsertRowBefore", "tableInsertRowAfter", "tableDeleteRow", "tableCellShading", "tableCellBorders", "tableCellNoBorders", "tableWidth100", "tableAlignLeft", "tableAlignCenter", "tableAlignRight", "tableSetCellWidth", "tableToggleHeaderRow", "tableToggleTotalRow", "tableToggleBandedRows", "tableToggleFirstColumn", "tableToggleLastColumn", "tableToggleBandedColumns", "setTableStyle", "tableToggleAutoFit", "tableDistributeColumns", "tableDistributeRows", "insertTable", "insertShape"];
|
|
2
2
|
export type OasisBuiltinCommand = (typeof OASIS_BUILTIN_COMMANDS)[number];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EditorPosition, EditorState, EditorImageRunData, EditorImageCrop } from '../model.js';
|
|
1
|
+
import { EditorPosition, EditorState, EditorImageRunData, EditorImageBorder, EditorImageCrop, EditorLineDash } from '../model.js';
|
|
2
2
|
import { SelectedObjectRun } from './selectedObjectRun.js';
|
|
3
3
|
import { WrapPreset } from './floatingLayout.js';
|
|
4
4
|
|
|
@@ -42,6 +42,20 @@ export type ImageCropAspectMode = number | "reset";
|
|
|
42
42
|
export declare function computeImageAspectCrop(image: EditorImageRunData, mode: ImageCropAspectMode): ImageCropUpdate;
|
|
43
43
|
/** Applies an aspect-ratio crop preset to the selected image. */
|
|
44
44
|
export declare function applySelectedImageCropAspect(state: EditorState, mode: ImageCropAspectMode): EditorState;
|
|
45
|
+
/** Outline of the selected image (`pic:spPr/a:ln`), or `null`. */
|
|
46
|
+
export declare function getSelectedImageBorder(state: EditorState): EditorImageBorder | null;
|
|
47
|
+
/**
|
|
48
|
+
* A partial edit of the image outline, as dispatched by the picture-border
|
|
49
|
+
* toolbar popup. Each popup action touches one facet, so the patch merges onto
|
|
50
|
+
* whatever border the image already has. `color: null` removes the outline.
|
|
51
|
+
*/
|
|
52
|
+
export interface ImageBorderPatch {
|
|
53
|
+
color?: string | null;
|
|
54
|
+
widthPt?: number;
|
|
55
|
+
dash?: EditorLineDash;
|
|
56
|
+
}
|
|
57
|
+
/** Merges `patch` onto the selected image's outline. `color: null` clears it. */
|
|
58
|
+
export declare function setSelectedImageBorder(state: EditorState, patch: ImageBorderPatch): EditorState;
|
|
45
59
|
export declare function rotateSelectedImage(state: EditorState, rotation: number): EditorState;
|
|
46
60
|
export declare function getSelectedImageWrapPreset(state: EditorState): WrapPreset | null;
|
|
47
61
|
export declare function isSelectedImageFixedPosition(state: EditorState): boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EditorLineDash } from './model/types/primitives.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Canonical dash patterns for DrawingML `a:prstDash` presets, expressed in
|
|
5
|
+
* typographic points. This is the single source of truth shared by every
|
|
6
|
+
* renderer: the canvas scales them by `PX_PER_POINT` for `setLineDash`, the PDF
|
|
7
|
+
* exporter feeds them straight to the `d` operator, and the DOCX serializer
|
|
8
|
+
* needs no numbers at all (it writes the preset name back out verbatim).
|
|
9
|
+
*
|
|
10
|
+
* `solid` is the empty pattern — a continuous line in both backends.
|
|
11
|
+
*/
|
|
12
|
+
export declare const LINE_DASH_PATTERN_PT: Record<EditorLineDash, number[]>;
|
|
13
|
+
/** Narrows an untrusted `a:prstDash/@val` to a supported preset. */
|
|
14
|
+
export declare function parseLineDash(value: string | null | undefined): EditorLineDash | undefined;
|
|
15
|
+
/** Dash pattern for a border, in points. Empty for solid/undefined. */
|
|
16
|
+
export declare function lineDashPatternPt(dash: EditorLineDash | undefined): number[];
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* statements that pointed there continue to work via the barrel
|
|
7
7
|
* re-export in `src/core/model.ts`.
|
|
8
8
|
*/
|
|
9
|
-
export type { EditorUnderlineStyle, EditorLigatures, EditorNumberSpacing, EditorNumberForm, EditorTextLanguage, EditorBorderStyle, EditorEmphasisMark, EditorTabStop, EditorParagraphListStyle, EditorImageCrop, EditorImageFillMode, EditorImageFloatingPosition, EditorImageFloatingLayout, EditorImageRunData, EditorWrapPolygonPoint, EditorFieldData, EditorFieldChar, EditorFootnoteReferenceData, EditorEndnoteReferenceData, EditorRevision, EditorRevisionMetadata, EditorStructuralRevision, EditorPropertyRevision, EditorAsset, EditorFootnoteNumberFormat, EditorFootnoteRestart, EditorDocxWidthValue, EditorTableLayout, EditorTableRowHeightRule, EditorGradientStop, EditorTextFill, EditorTextOutline, EditorTextShadow, EditorGlow, EditorReflection, } from './types/primitives.js';
|
|
9
|
+
export type { EditorUnderlineStyle, EditorLigatures, EditorNumberSpacing, EditorNumberForm, EditorTextLanguage, EditorBorderStyle, EditorEmphasisMark, EditorTabStop, EditorParagraphListStyle, EditorImageCrop, EditorImageFillMode, EditorLineDash, EditorImageBorder, EditorImageFloatingPosition, EditorImageFloatingLayout, EditorImageRunData, EditorWrapPolygonPoint, EditorFieldData, EditorFieldChar, EditorFootnoteReferenceData, EditorEndnoteReferenceData, EditorRevision, EditorRevisionMetadata, EditorStructuralRevision, EditorPropertyRevision, EditorAsset, EditorFootnoteNumberFormat, EditorFootnoteRestart, EditorDocxWidthValue, EditorTableLayout, EditorTableRowHeightRule, EditorGradientStop, EditorTextFill, EditorTextOutline, EditorTextShadow, EditorGlow, EditorReflection, } from './types/primitives.js';
|
|
10
10
|
export type { EditorTextStyle, EditorParagraphStyle, EditorTableStyle, EditorTableFloatingLayout, EditorTableConditionalFormat, EditorConditionalRowStyle, EditorTableConditionalType, EditorTableConditionalFlags, EditorTableCellStyle, EditorNamedStyle, } from './types/styles.js';
|
|
11
11
|
export type { EditorRunBase, EditorTextRun, EditorTextBoxShape, EditorTextBoxBody, EditorTextBoxData, EditorDropCap, EditorSdtBlockWrapper, EditorParagraphNode, EditorTableCellNode, EditorTableRowStyle, EditorTableRowNode, EditorTableNode, EditorBlockNode, } from './types/nodes.js';
|
|
12
12
|
export type { RunKind, RunOfKind, RunVisitor } from './runKind.js';
|
|
@@ -110,6 +110,24 @@ export interface EditorImageCrop {
|
|
|
110
110
|
bottom?: number;
|
|
111
111
|
}
|
|
112
112
|
export type EditorImageFillMode = "stretch" | "tile";
|
|
113
|
+
/**
|
|
114
|
+
* Preset dash patterns for an outline, mapped from DrawingML `a:prstDash/@val`.
|
|
115
|
+
* The member names are the serialized OOXML tokens.
|
|
116
|
+
*/
|
|
117
|
+
export type EditorLineDash = "solid" | "dot" | "sysDot" | "dash" | "sysDash" | "dashDot" | "lgDash" | "lgDashDot" | "lgDashDotDot";
|
|
118
|
+
/**
|
|
119
|
+
* An image outline, mapped from `pic:spPr/a:ln`. Word centers the stroke on the
|
|
120
|
+
* displayed box edge and reserves no layout space for it. An absent `border`
|
|
121
|
+
* means no outline.
|
|
122
|
+
*/
|
|
123
|
+
export interface EditorImageBorder {
|
|
124
|
+
/** `a:ln/a:solidFill/a:srgbClr` as `#RRGGBB`. */
|
|
125
|
+
color: string;
|
|
126
|
+
/** `a:ln/@w`, in points. Absent ⇒ 1pt. */
|
|
127
|
+
widthPt?: number;
|
|
128
|
+
/** `a:ln/a:prstDash/@val`. Absent ⇒ solid. */
|
|
129
|
+
dash?: EditorLineDash;
|
|
130
|
+
}
|
|
113
131
|
export interface EditorImageFloatingPosition {
|
|
114
132
|
relativeFrom?: string;
|
|
115
133
|
align?: string;
|
|
@@ -145,6 +163,7 @@ export interface EditorImageRunData {
|
|
|
145
163
|
linkedSrc?: string;
|
|
146
164
|
crop?: EditorImageCrop;
|
|
147
165
|
fillMode?: EditorImageFillMode;
|
|
166
|
+
border?: EditorImageBorder;
|
|
148
167
|
rotation?: number;
|
|
149
168
|
flipH?: boolean;
|
|
150
169
|
flipV?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EditorBlockNode, EditorImageCrop, EditorImageFillMode, EditorImageFloatingLayout, EditorParagraphListStyle, EditorWrapPolygonPoint } from '../../core/model.js';
|
|
1
|
+
import { EditorBlockNode, EditorImageBorder, EditorImageCrop, EditorImageFillMode, EditorImageFloatingLayout, EditorParagraphListStyle, EditorWrapPolygonPoint } from '../../core/model.js';
|
|
2
2
|
import { BookmarkEventsByParagraph } from './bookmarksXml.js';
|
|
3
3
|
import { CommentEventsByParagraph } from './commentsXml.js';
|
|
4
4
|
|
|
@@ -36,6 +36,7 @@ export interface DocContext {
|
|
|
36
36
|
alt?: string;
|
|
37
37
|
crop?: EditorImageCrop;
|
|
38
38
|
fillMode?: EditorImageFillMode;
|
|
39
|
+
border?: EditorImageBorder;
|
|
39
40
|
rotation?: number;
|
|
40
41
|
flipH?: boolean;
|
|
41
42
|
flipV?: boolean;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import { EditorImageFloatingLayout, EditorWrapPolygonPoint } from '../../../core/model.js';
|
|
1
|
+
import { EditorImageBorder, EditorImageFloatingLayout, EditorWrapPolygonPoint } from '../../../core/model.js';
|
|
2
2
|
import { DocContext } from '../docxTypes.js';
|
|
3
3
|
|
|
4
4
|
export declare function buildXfrmAttrs(img: DocContext["images"][number]): string;
|
|
5
5
|
export declare function buildSrcRect(crop: DocContext["images"][number]["crop"]): string;
|
|
6
|
+
/**
|
|
7
|
+
* The picture outline. Belongs inside `pic:spPr` right after `a:prstGeom` —
|
|
8
|
+
* `CT_ShapeProperties` sequences xfrm, geometry, fill, then `a:ln` (a picture's
|
|
9
|
+
* fill lives in `pic:blipFill`, so nothing sits between the two here).
|
|
10
|
+
*/
|
|
11
|
+
export declare function buildImageLnXml(border: EditorImageBorder | undefined): string;
|
|
6
12
|
export declare function buildDrawingContainerXml(options: {
|
|
7
13
|
cx: number;
|
|
8
14
|
cy: number;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EditorDocument, EditorImageRunData } from '../../../core/model.js';
|
|
2
|
+
import { OasisPdfWriter } from '../OasisPdfWriter.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Draws one image — inline or floating — onto a page: the XObject itself, then
|
|
6
|
+
* its picture outline (`pic:spPr/a:ln`) if it has one. Shared by both call
|
|
7
|
+
* sites so the two can never drift on border handling.
|
|
8
|
+
*
|
|
9
|
+
* The rect passed in is the displayed box, in points. Crop never changes it:
|
|
10
|
+
* `drawImage` already clips the (enlarged) source to this same box, so the
|
|
11
|
+
* outline hugs what the reader sees. Rotation is applied around the box centre,
|
|
12
|
+
* mirroring `paintTextBox`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function drawImageObject(writer: OasisPdfWriter, pageIndex: number, document: EditorDocument, image: EditorImageRunData, x: number, y: number, width: number, height: number): Promise<void>;
|
|
@@ -389,6 +389,7 @@ export declare const en: {
|
|
|
389
389
|
"ribbon.group.cellSize": string;
|
|
390
390
|
"ribbon.group.alignment": string;
|
|
391
391
|
"ribbon.group.size": string;
|
|
392
|
+
"ribbon.group.imageStyles": string;
|
|
392
393
|
"image.crop": string;
|
|
393
394
|
"image.height": string;
|
|
394
395
|
"image.width": string;
|
|
@@ -400,6 +401,20 @@ export declare const en: {
|
|
|
400
401
|
"image.cropRatio.2x3": string;
|
|
401
402
|
"image.cropRatio.3x4": string;
|
|
402
403
|
"image.cropRatio.9x16": string;
|
|
404
|
+
"image.border": string;
|
|
405
|
+
"image.borderNone": string;
|
|
406
|
+
"image.borderMoreColors": string;
|
|
407
|
+
"image.borderWeight": string;
|
|
408
|
+
"image.borderDashes": string;
|
|
409
|
+
"image.borderDash.solid": string;
|
|
410
|
+
"image.borderDash.sysDot": string;
|
|
411
|
+
"image.borderDash.sysDash": string;
|
|
412
|
+
"image.borderDash.dot": string;
|
|
413
|
+
"image.borderDash.dash": string;
|
|
414
|
+
"image.borderDash.dashDot": string;
|
|
415
|
+
"image.borderDash.lgDash": string;
|
|
416
|
+
"image.borderDash.lgDashDot": string;
|
|
417
|
+
"image.borderDash.lgDashDotDot": string;
|
|
403
418
|
"toolbar.exportDocx": string;
|
|
404
419
|
"toolbar.exportPdf": string;
|
|
405
420
|
"underline.style.single": string;
|
|
@@ -389,6 +389,7 @@ export declare const ptBR: {
|
|
|
389
389
|
"ribbon.group.cellSize": string;
|
|
390
390
|
"ribbon.group.alignment": string;
|
|
391
391
|
"ribbon.group.size": string;
|
|
392
|
+
"ribbon.group.imageStyles": string;
|
|
392
393
|
"image.crop": string;
|
|
393
394
|
"image.height": string;
|
|
394
395
|
"image.width": string;
|
|
@@ -400,6 +401,20 @@ export declare const ptBR: {
|
|
|
400
401
|
"image.cropRatio.2x3": string;
|
|
401
402
|
"image.cropRatio.3x4": string;
|
|
402
403
|
"image.cropRatio.9x16": string;
|
|
404
|
+
"image.border": string;
|
|
405
|
+
"image.borderNone": string;
|
|
406
|
+
"image.borderMoreColors": string;
|
|
407
|
+
"image.borderWeight": string;
|
|
408
|
+
"image.borderDashes": string;
|
|
409
|
+
"image.borderDash.solid": string;
|
|
410
|
+
"image.borderDash.sysDot": string;
|
|
411
|
+
"image.borderDash.sysDash": string;
|
|
412
|
+
"image.borderDash.dot": string;
|
|
413
|
+
"image.borderDash.dash": string;
|
|
414
|
+
"image.borderDash.dashDot": string;
|
|
415
|
+
"image.borderDash.lgDash": string;
|
|
416
|
+
"image.borderDash.lgDashDot": string;
|
|
417
|
+
"image.borderDash.lgDashDotDot": string;
|
|
403
418
|
"toolbar.exportDocx": string;
|
|
404
419
|
"toolbar.exportPdf": string;
|
|
405
420
|
"underline.style.single": string;
|