oasis-editor 0.0.136 → 0.0.138
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-DPrjPRTW.js → OasisEditorApp-DMI2ZfOd.js} +561 -115
- package/dist/app/controllers/animationFrame.d.ts +2 -0
- package/dist/app/controllers/tableResize/tableResizeDom.d.ts +3 -3
- package/dist/app/controllers/tableResize/tableResizeHitTest.d.ts +1 -1
- package/dist/app/controllers/tableResize/tableResizeTypes.d.ts +1 -0
- package/dist/app/controllers/useEditorTableCornerResize.d.ts +1 -0
- package/dist/app/controllers/useEditorTableDrag.d.ts +2 -0
- package/dist/assets/{importDocxWorker-B0cSSI12.js → importDocxWorker-DBjcGf-C.js} +1 -1
- package/dist/core/commands/table/tableCellStyleCommands.d.ts +3 -0
- package/dist/core/commands/table/tableRowCommands.d.ts +1 -0
- package/dist/core/editorState/defaultStyles.d.ts +1 -0
- package/dist/core/model/index.d.ts +1 -1
- package/dist/core/model/types/nodes.d.ts +123 -5
- package/dist/export/docx/text/sdtXml.d.ts +10 -0
- package/dist/i18n/locales/en.d.ts +4 -0
- package/dist/i18n/locales/pt-BR.d.ts +4 -0
- package/dist/import/docx/contentControls.d.ts +9 -0
- package/dist/import/docx/tableProperties.d.ts +1 -14
- package/dist/{index-Cbwb1bgI.js → index-M7h7REmM.js} +691 -488
- package/dist/oasis-editor.css +1 -1
- package/dist/oasis-editor.js +49 -49
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/ui/OasisEditorEditorProps.d.ts +0 -1
- package/dist/ui/app/EditorWorkspace.d.ts +0 -1
- package/dist/ui/app/createEditorInteractionRuntime.d.ts +1 -0
- package/dist/ui/components/Toolbar/presets/builtinToolbarIds.d.ts +0 -1
- package/dist/ui/components/Toolbar/presets/defaultToolbar/buttonSpecs.d.ts +1 -0
- package/dist/ui/components/Toolbar/primitives/useSurfaceRect.d.ts +2 -2
- package/dist/ui/editorHistory.d.ts +2 -0
- package/dist/ui/shells/DocumentShell.d.ts +1 -2
- package/package.json +1 -1
- package/dist/ui/components/FloatingToolbar/FloatingTableToolbar.d.ts +0 -11
|
@@ -3,6 +3,9 @@ import { EditorBorderStyle, EditorState, EditorTableCellStyle } from '../../mode
|
|
|
3
3
|
export type TableBorderPreset = "bottom" | "top" | "left" | "right" | "none" | "all" | "outside" | "inside" | "insideHorizontal" | "insideVertical" | "diagonalDown" | "diagonalUp";
|
|
4
4
|
/** Word's default border: black, solid, one half point. */
|
|
5
5
|
export declare const DEFAULT_TABLE_BORDER: EditorBorderStyle;
|
|
6
|
+
/** Explicitly suppresses a border. Missing cell borders intentionally fall
|
|
7
|
+
* back to the editor's default visible table border. */
|
|
8
|
+
export declare const NO_TABLE_BORDER: EditorBorderStyle;
|
|
6
9
|
export declare function setTableCellStyleValue<K extends keyof EditorTableCellStyle>(state: EditorState, key: K, value: EditorTableCellStyle[K] | null): EditorState;
|
|
7
10
|
export declare function setTableCellWidth(state: EditorState, width: number | string | null): EditorState;
|
|
8
11
|
export declare function setTableCellBorders(state: EditorState, border: EditorBorderStyle | null): EditorState;
|
|
@@ -3,6 +3,7 @@ import { EditorState, EditorTableRowStyle } from '../../model.js';
|
|
|
3
3
|
export declare function setSelectedTableRowStyleValue<K extends keyof EditorTableRowStyle>(state: EditorState, key: K, value: EditorTableRowStyle[K] | null): EditorState;
|
|
4
4
|
export declare function setSelectedTableRowHeader(state: EditorState, value: boolean | null): EditorState;
|
|
5
5
|
export declare function setTableRowHeight(state: EditorState, tableId: string, rowIndex: number, height: number | string | null): EditorState;
|
|
6
|
+
export declare function setTableRowHeights(state: EditorState, tableId: string, rowHeights: Readonly<Record<number, number | string | null>>): EditorState;
|
|
6
7
|
/**
|
|
7
8
|
* Equalize the heights of every row in the active table (Word's "Distribute
|
|
8
9
|
* Rows"). Uses the tallest explicit row height as the target (or a default when
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
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
|
-
export type { EditorRunBase, EditorTextRun, EditorTextBoxShape, EditorTextBoxBody, EditorTextBoxData, EditorDropCap, EditorSdtBlockWrapper, EditorParagraphNode, EditorTableCellNode, EditorTableRowStyle, EditorTableRowNode, EditorTableNode, EditorBlockNode, } from './types/nodes.js';
|
|
11
|
+
export type { EditorRunBase, EditorTextRun, EditorTextBoxShape, EditorTextBoxBody, EditorTextBoxData, EditorDropCap, EditorSdtBlockWrapper, EditorSdtPr, EditorSdtSubtype, EditorSdtListItem, EditorSdtDataBinding, EditorParagraphNode, EditorTableCellNode, EditorTableRowStyle, EditorTableRowNode, EditorTableNode, EditorBlockNode, } from './types/nodes.js';
|
|
12
12
|
export type { RunKind, RunOfKind, RunVisitor } from './runKind.js';
|
|
13
13
|
export { getRunKind, isInlineObjectRun, visitRun, getRunImage, getRunTextBox, getRunField, getRunFieldChar, getRunFieldInstruction, getRunFootnoteReference, getRunEndnoteReference, getRunSym, } from './runKind.js';
|
|
14
14
|
export type { EditorFootnote } from './types/documentFootnotes.js';
|
|
@@ -148,17 +148,135 @@ export interface EditorDropCap {
|
|
|
148
148
|
* A block-level structured document tag (`w:sdt`, a content control) enclosing
|
|
149
149
|
* one or more blocks, preserved for round-trip. Its content is unwrapped into the
|
|
150
150
|
* normal block flow (so it still renders and edits); this carries the wrapper's
|
|
151
|
-
* properties
|
|
152
|
-
*
|
|
153
|
-
*
|
|
151
|
+
* properties so export can re-wrap. `groupId` ties together the consecutive blocks
|
|
152
|
+
* that came from the same `w:sdt`; the array on a block lists its enclosing
|
|
153
|
+
* wrappers outermost-first (nested content controls).
|
|
154
|
+
*
|
|
155
|
+
* Recognized `w:sdtPr` children are parsed into the typed `sdtPr` object so the
|
|
156
|
+
* editor can read the control's alias/tag/id/lock/subtype/etc. Unknown children
|
|
157
|
+
* (extension namespaces, future-schema elements) are preserved verbatim in
|
|
158
|
+
* `sdtPr.unknownXml` so export re-emits them byte-for-byte. Likewise `sdtEndPr`
|
|
159
|
+
* is preserved as raw XML; structured-document end properties rarely carry
|
|
160
|
+
* editor-meaningful data beyond run formatting that the content already supplies.
|
|
154
161
|
*/
|
|
155
162
|
export interface EditorSdtBlockWrapper {
|
|
156
163
|
groupId: string;
|
|
157
|
-
/**
|
|
158
|
-
|
|
164
|
+
/** Parsed `<w:sdtPr>` properties (alias, tag, id, lock, subtype, etc.). */
|
|
165
|
+
sdtPr: EditorSdtPr;
|
|
159
166
|
/** Raw `<w:sdtEndPr>…</w:sdtEndPr>` XML, when present. */
|
|
160
167
|
sdtEndPrXml?: string;
|
|
161
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Recognized `<w:sdtPr>` children. Every field is optional; a property is only
|
|
171
|
+
* present if the matching element was in the source markup. Property order in
|
|
172
|
+
* OOXML is significant (CT_SdtPr schema sequence: `rPr`, `alias`, `tag`, `id`,
|
|
173
|
+
* `lock`, `placeholder`, `dataBinding`,
|
|
174
|
+
* `temporary`, `equation`/`citation`/`bibliography`/`group`/`picture`/`text`/
|
|
175
|
+
* `richText`/`comboBox`/`dropDownList`/`date`/`repeatingSection`/
|
|
176
|
+
* `repeatingSectionItem`, extension elements). The exporter emits them in this
|
|
177
|
+
* sequence to keep documents schema-valid.
|
|
178
|
+
*/
|
|
179
|
+
export interface EditorSdtPr {
|
|
180
|
+
/** `<w:alias w:val="…"/>` — friendly display name. */
|
|
181
|
+
alias?: string;
|
|
182
|
+
/** `<w:tag w:val="…"/>` — programmatic tag for template automation. */
|
|
183
|
+
tag?: string;
|
|
184
|
+
/** `<w:id w:val="…"/>` — stable content-control id (stored as a string for fidelity). */
|
|
185
|
+
id?: string;
|
|
186
|
+
/** `<w:lock w:val="…"/>` — sdtLocked/contentLocked/sdtContentLocked combinations. */
|
|
187
|
+
lock?: string;
|
|
188
|
+
/**
|
|
189
|
+
* `<w:appearance w:val="…"/>` — boundingBox|tags|hidden. Editor-UI hint, not layout.
|
|
190
|
+
*/
|
|
191
|
+
appearance?: "boundingBox" | "tags" | "hidden" | string;
|
|
192
|
+
/** `<w:showingPlcHdr w:val="…"/>` — true when the control currently shows its placeholder text. */
|
|
193
|
+
showingPlcHdr?: boolean;
|
|
194
|
+
/** `<w:temporary w:val="…"/>` — remove the control after the first edit. */
|
|
195
|
+
temporary?: boolean;
|
|
196
|
+
/** `<w:color w:val="…"/>` — UI color of the content-control chrome. */
|
|
197
|
+
color?: string;
|
|
198
|
+
/** `<w:placeholder><w:docPart w:val="…"/></w:placeholder>` — glossary entry name. */
|
|
199
|
+
placeholderDocPart?: string;
|
|
200
|
+
/** `<w:dataBinding>` — custom-XML store binding. */
|
|
201
|
+
dataBinding?: EditorSdtDataBinding;
|
|
202
|
+
/** Recognized content-control subtype element (`<w:text>`, `<w:dropDownList>`, …). */
|
|
203
|
+
subtype?: EditorSdtSubtype;
|
|
204
|
+
/**
|
|
205
|
+
* Serialized XML of every `w:sdtPr` child the parser did not recognize, in
|
|
206
|
+
* document order, so a future-proof round-trip re-emits extension/future-schema
|
|
207
|
+
* elements (e.g. `w15:storeItem`, `w14:*` extension attributes) without loss.
|
|
208
|
+
*/
|
|
209
|
+
unknownXml?: string;
|
|
210
|
+
}
|
|
211
|
+
/** Recognized content-control subtypes (the single typed child of `w:sdtPr`). */
|
|
212
|
+
export type EditorSdtSubtype = {
|
|
213
|
+
kind: "text";
|
|
214
|
+
multiline?: boolean;
|
|
215
|
+
} | {
|
|
216
|
+
kind: "richText";
|
|
217
|
+
} | {
|
|
218
|
+
kind: "picture";
|
|
219
|
+
} | {
|
|
220
|
+
kind: "group";
|
|
221
|
+
} | {
|
|
222
|
+
kind: "equation";
|
|
223
|
+
} | {
|
|
224
|
+
kind: "citation";
|
|
225
|
+
} | {
|
|
226
|
+
kind: "bibliography";
|
|
227
|
+
} | {
|
|
228
|
+
kind: "comboBox";
|
|
229
|
+
/** Display/value pairs from `<w:listItem>` children. */
|
|
230
|
+
listItems?: EditorSdtListItem[];
|
|
231
|
+
/** `<w:lastSelectedValue w:val="…"/>` if a value was chosen on last save. */
|
|
232
|
+
lastSelectedValue?: string;
|
|
233
|
+
} | {
|
|
234
|
+
kind: "dropDownList";
|
|
235
|
+
listItems?: EditorSdtListItem[];
|
|
236
|
+
lastSelectedValue?: string;
|
|
237
|
+
} | {
|
|
238
|
+
kind: "date";
|
|
239
|
+
/** `<w:date w:fullDate="…"/>` — the chosen date-time (ISO 8601). */
|
|
240
|
+
fullDate?: string;
|
|
241
|
+
/** `<w:dateFormat w:val="…"/>` — display format string (e.g. `M/d/yyyy`). */
|
|
242
|
+
dateFormat?: string;
|
|
243
|
+
/** `<w:lid w:val="…"/>` — locale id for calendar formatting. */
|
|
244
|
+
lid?: string;
|
|
245
|
+
/** `<w:calendar w:val="…"/>` — gregorian|gregorianUs|gregorianUsFrench|… */
|
|
246
|
+
calendar?: string;
|
|
247
|
+
/** `<w:storeMappedDataAs w:val="…"/>` — storage format for data binding. */
|
|
248
|
+
storeMappedDataAs?: string;
|
|
249
|
+
} | {
|
|
250
|
+
kind: "checkbox";
|
|
251
|
+
/** `<w14:checked w14:val="…"/>` — current boolean state (default false). */
|
|
252
|
+
checked?: boolean;
|
|
253
|
+
/** `<w14:checkedState w14:font="…" w14:char="…"/>` — checked-glyph spec. */
|
|
254
|
+
checkedStateFont?: string;
|
|
255
|
+
checkedStateChar?: string;
|
|
256
|
+
/** `<w14:uncheckedState w14:font="…" w14:char="…"/>` — unchecked-glyph spec. */
|
|
257
|
+
uncheckedStateFont?: string;
|
|
258
|
+
uncheckedStateChar?: string;
|
|
259
|
+
} | {
|
|
260
|
+
kind: "repeatingSection";
|
|
261
|
+
} | {
|
|
262
|
+
kind: "repeatingSectionItem";
|
|
263
|
+
};
|
|
264
|
+
/** Single item in a `<w:comboBox>` or `<w:dropDownList>`. */
|
|
265
|
+
export interface EditorSdtListItem {
|
|
266
|
+
/** `<w:listItem w:displayText="…"/>` — what the user sees. */
|
|
267
|
+
displayText?: string;
|
|
268
|
+
/** `<w:listItem w:value="…"/>` — the stored value. */
|
|
269
|
+
value?: string;
|
|
270
|
+
}
|
|
271
|
+
/** `<w:dataBinding>` — XPath binding into a custom-XML storage part. */
|
|
272
|
+
export interface EditorSdtDataBinding {
|
|
273
|
+
/** `<w:prefixMappings w:val="…"/>` — namespace prefixes for the XPath. */
|
|
274
|
+
prefixMappings?: string;
|
|
275
|
+
/** `<w:xpath w:val="…"/>` — the XPath expression selecting the bound node. */
|
|
276
|
+
xpath?: string;
|
|
277
|
+
/** `<w:storeItemID w:val="…"/>` — id of the `customXml/itemN.xml` part. */
|
|
278
|
+
storeItemID?: string;
|
|
279
|
+
}
|
|
162
280
|
export interface EditorParagraphNode {
|
|
163
281
|
id: string;
|
|
164
282
|
type: "paragraph";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EditorSdtPr } from '../../../core/model.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `<w:sdtPr>` requires its subtype element to be the final named child per schema
|
|
5
|
+
* order, with `appearance`, `showingPlcHdr`, `color` trailing as extension-like
|
|
6
|
+
* properties. The exact ordering used by Word is: rPr, alias, tag, id, lock,
|
|
7
|
+
* placeholder, dataBinding, temporary, subtype, appearance, showingPlcHdr,
|
|
8
|
+
* color, extension. We mirror that so we round-trip as schema-valid.
|
|
9
|
+
*/
|
|
10
|
+
export declare function serializeSdtPrXml(sdtPr: EditorSdtPr): string;
|
|
@@ -221,9 +221,13 @@ export declare const en: {
|
|
|
221
221
|
"table.mergeTooltip": string;
|
|
222
222
|
"table.split": string;
|
|
223
223
|
"table.splitTooltip": string;
|
|
224
|
+
"table.insertLeft": string;
|
|
225
|
+
"table.insertRight": string;
|
|
224
226
|
"table.insertColumnLeft": string;
|
|
225
227
|
"table.insertColumnRight": string;
|
|
226
228
|
"table.deleteColumn": string;
|
|
229
|
+
"table.insertAbove": string;
|
|
230
|
+
"table.insertBelow": string;
|
|
227
231
|
"table.insertRowAbove": string;
|
|
228
232
|
"table.insertRowBelow": string;
|
|
229
233
|
"table.deleteRow": string;
|
|
@@ -221,9 +221,13 @@ export declare const ptBR: {
|
|
|
221
221
|
"table.mergeTooltip": string;
|
|
222
222
|
"table.split": string;
|
|
223
223
|
"table.splitTooltip": string;
|
|
224
|
+
"table.insertLeft": string;
|
|
225
|
+
"table.insertRight": string;
|
|
224
226
|
"table.insertColumnLeft": string;
|
|
225
227
|
"table.insertColumnRight": string;
|
|
226
228
|
"table.deleteColumn": string;
|
|
229
|
+
"table.insertAbove": string;
|
|
230
|
+
"table.insertBelow": string;
|
|
227
231
|
"table.insertRowAbove": string;
|
|
228
232
|
"table.insertRowBelow": string;
|
|
229
233
|
"table.deleteRow": string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Element as XmlElement } from '@xmldom/xmldom';
|
|
2
|
+
import { EditorSdtPr } from '../../core/model.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Parse a `<w:sdtPr>` element into the typed model. Returns `{}` (empty) when
|
|
6
|
+
* `sdtPr` is null or has no recognized children; the caller still attaches an
|
|
7
|
+
* empty wrapper so the round-trip emits an empty `<w:sdtPr/>`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseSdtPr(sdtPr: XmlElement | null): EditorSdtPr;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Element as XmlElement } from '@xmldom/xmldom';
|
|
2
|
-
import {
|
|
2
|
+
import { EditorTableCellStyle, EditorTableRowNode, EditorTableRowStyle, EditorTableStyle, EditorTableConditionalFlags } from '../../core/model.js';
|
|
3
3
|
import { EditorTableBorders } from './borders.js';
|
|
4
|
-
import { ParagraphAutospacingFlags } from './paragraphStyle.js';
|
|
5
4
|
import { ThemeColorMap } from './themeColors.js';
|
|
6
5
|
|
|
7
6
|
export declare function parseTableConditionalFlags(properties: XmlElement | null): EditorTableConditionalFlags | undefined;
|
|
@@ -18,16 +17,4 @@ export declare function getTableCellVMerge(cellProperties: XmlElement | null): "
|
|
|
18
17
|
export declare function getTableCellHMerge(cellProperties: XmlElement | null): "restart" | "continue" | undefined;
|
|
19
18
|
export declare function parseTableCellStyle(cellProperties: XmlElement | null, tableDefaultMargins?: EditorTableStyle["defaultCellMargins"], colors?: ThemeColorMap): EditorTableCellStyle | undefined;
|
|
20
19
|
export declare function isTableHeaderRow(rowNode: XmlElement): boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Reproduces Word's HTML-style margin collapsing for paragraphs that use "auto
|
|
23
|
-
* spacing" (`w:beforeAutospacing` / `w:afterAutospacing`) inside a table cell.
|
|
24
|
-
* Word ignores the literal before/after values for these margins and collapses
|
|
25
|
-
* them: the first paragraph's auto before-space and the last paragraph's auto
|
|
26
|
-
* after-space collapse to 0 against the cell edge, and two adjacent auto margins
|
|
27
|
-
* collapse to their max instead of summing. Without this, oasis renders cells
|
|
28
|
-
* taller than Word because every paragraph's spacing is summed in full.
|
|
29
|
-
*
|
|
30
|
-
* The flags array is parallel to `paragraphs` (one entry per `<w:p>` in the cell).
|
|
31
|
-
*/
|
|
32
|
-
export declare function collapseCellAutospacing(paragraphs: EditorParagraphNode[], flags: ParagraphAutospacingFlags[]): void;
|
|
33
20
|
export declare function applyTableBordersToRows(rows: EditorTableRowNode[], tblBorders: EditorTableBorders): void;
|