oasis-editor 0.0.218 → 0.0.220

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.
@@ -1,2 +1,2 @@
1
- export declare const OASIS_BUILTIN_COMMANDS: readonly ["selectAll", "insertFootnote", "insertText", "insertEquation", "updateEquation", "insertTableOfContents", "updateTableOfContents", "pastePlainText", "paste", "pasteAsPlainText", "pasteMergeFormatting", "formatPainter", "formatPainterContinuous", "cancelFormatPainter", "bold", "italic", "underline", "strike", "superscript", "subscript", "link", "unlink", "alignLeft", "alignCenter", "alignRight", "alignJustify", "orderedList", "bulletList", "find", "replace", "toggleTrackChanges", "acceptRevisions", "rejectRevisions", "nextRevision", "previousRevision", "nextComment", "previousComment", "newComment", "replyComment", "editComment", "toggleCommentsPanel", "resolveComment", "reopenComment", "deleteComment", "toggleShowMargins", "toggleShowParagraphMarks", "togglePreciseFonts", "undo", "redo", "pageBreak", "lineBreak", "splitBlock", "setFontFamily", "setFontSize", "increaseFontSize", "decreaseFontSize", "changeTextCase", "clearFormatting", "setColor", "setHighlight", "setTextShading", "setStyleId", "setCharacterStyleId", "setUnderlineStyle", "documentStyles", "print", "copy", "cut", "newDocument", "exportDocx", "exportPdf", "importDocument", "insertHtml", "insertImage", "editImageAlt", "insertImageCaption", "imageContext", "imageWidthCm", "imageHeightCm", "imageCrop", "imageCropAspect", "imageCropShape", "imageCropFill", "imageCropFit", "imageCropReset", "imageBorder", "outdent", "indent", "togglePageBreakBefore", "toggleKeepWithNext", "setSpacingAfter", "setSpacingBefore", "setIndentLeft", "setIndentRight", "setIndentFirstLine", "setIndentHanging", "setSpecialIndent", "setParagraphShading", "applyParagraphBorders", "setLineHeight", "setListFormat", "setListStartAt", "toggleOrientation", "setOrientation", "sectionBreakNextPage", "sectionBreakContinuous", "setPageMargins", "setSectionPageNumbering", "setPaperSize", "setPaperSizePreset", "editHeader", "editFooter", "insertPageNumber", "insertPageNumberXOfY", "placePageNumberTop", "placePageNumberBottom", "insertBookmark", "removeBookmark", "insertDateField", "exitHeaderFooter", "applyDocumentTheme", "setDocumentColorScheme", "setDocumentFontScheme", "setDocumentParagraphSpacing", "setDocumentEffects", "setDocumentPageColor", "setDocumentWatermark", "setDocumentPageBorder", "setDocumentDesignDefault", "tableContext", "tableMerge", "tableSplit", "tableInsertColumnBefore", "tableInsertColumnAfter", "tableDeleteColumn", "tableInsertRowBefore", "tableInsertRowAfter", "tableDeleteRow", "tableCellShading", "tableCellBorders", "tableCellNoBorders", "tableApplyBorderPreset", "toggleTableDrawBorders", "toggleTableGridlines", "tableWidth100", "tableAlignLeft", "tableAlignCenter", "tableAlignRight", "tableSetCellWidth", "tableToggleHeaderRow", "tableToggleTotalRow", "tableToggleBandedRows", "tableToggleFirstColumn", "tableToggleLastColumn", "tableToggleBandedColumns", "setTableStyle", "tableToggleAutoFit", "tableDistributeColumns", "tableDistributeRows", "insertTable", "insertShape", "openSymbolDialog", "openEquationDialog"];
1
+ export declare const OASIS_BUILTIN_COMMANDS: readonly ["selectAll", "insertFootnote", "insertText", "insertEquation", "updateEquation", "insertTableOfContents", "updateTableOfContents", "pastePlainText", "paste", "pasteAsPlainText", "pasteMergeFormatting", "formatPainter", "formatPainterContinuous", "cancelFormatPainter", "bold", "italic", "underline", "strike", "superscript", "subscript", "link", "unlink", "alignLeft", "alignCenter", "alignRight", "alignJustify", "orderedList", "bulletList", "find", "replace", "toggleTrackChanges", "acceptRevisions", "rejectRevisions", "nextRevision", "previousRevision", "nextComment", "previousComment", "newComment", "replyComment", "editComment", "toggleCommentsPanel", "resolveComment", "reopenComment", "deleteComment", "toggleShowMargins", "toggleShowParagraphMarks", "togglePreciseFonts", "undo", "redo", "pageBreak", "lineBreak", "splitBlock", "setFontFamily", "setFontSize", "increaseFontSize", "decreaseFontSize", "changeTextCase", "clearFormatting", "setColor", "setHighlight", "setTextShading", "setStyleId", "setCharacterStyleId", "setUnderlineStyle", "documentStyles", "print", "copy", "cut", "newDocument", "exportDocx", "exportPdf", "importDocument", "insertHtml", "insertImage", "editImageAlt", "insertImageCaption", "imageContext", "imageWidthCm", "imageHeightCm", "imageCrop", "imageCropAspect", "imageCropShape", "imageCropFill", "imageCropFit", "imageCropReset", "imageBorder", "outdent", "indent", "togglePageBreakBefore", "toggleKeepWithNext", "setSpacingAfter", "setSpacingBefore", "setIndentLeft", "setIndentRight", "setIndentFirstLine", "setIndentHanging", "setSpecialIndent", "setParagraphShading", "applyParagraphBorders", "setLineHeight", "setListFormat", "setListStartAt", "toggleOrientation", "setOrientation", "sectionBreakNextPage", "sectionBreakContinuous", "setPageMargins", "setSectionPageNumbering", "setPaperSize", "setPaperSizePreset", "setColumns", "setColumnsPreset", "editHeader", "editFooter", "insertPageNumber", "insertPageNumberXOfY", "placePageNumberTop", "placePageNumberBottom", "insertBookmark", "removeBookmark", "insertDateField", "insertCrossReference", "exitHeaderFooter", "applyDocumentTheme", "setDocumentColorScheme", "setDocumentFontScheme", "setDocumentParagraphSpacing", "setDocumentEffects", "setDocumentPageColor", "setDocumentWatermark", "setDocumentPageBorder", "setDocumentDesignDefault", "tableContext", "tableMerge", "tableSplit", "tableInsertColumnBefore", "tableInsertColumnAfter", "tableDeleteColumn", "tableInsertRowBefore", "tableInsertRowAfter", "tableDeleteRow", "tableCellShading", "tableCellBorders", "tableCellNoBorders", "tableApplyBorderPreset", "toggleTableDrawBorders", "toggleTableGridlines", "tableWidth100", "tableAlignLeft", "tableAlignCenter", "tableAlignRight", "tableSetCellWidth", "tableToggleHeaderRow", "tableToggleTotalRow", "tableToggleBandedRows", "tableToggleFirstColumn", "tableToggleLastColumn", "tableToggleBandedColumns", "setTableStyle", "tableToggleAutoFit", "tableDistributeColumns", "tableDistributeRows", "insertTable", "insertShape", "openSymbolDialog", "openEquationDialog"];
2
2
  export type OasisBuiltinCommand = (typeof OASIS_BUILTIN_COMMANDS)[number];
@@ -0,0 +1,27 @@
1
+ import { EditorBookmark, EditorState, EditorTextRun } from '../model.js';
2
+ export type CrossReferenceType = "REF" | "PAGEREF";
3
+ export interface InsertCrossReferenceOptions {
4
+ /** Which derived value to reference. Default `REF`. */
5
+ type?: CrossReferenceType;
6
+ /** The target bookmark's Word name. Required; a no-op when unknown. */
7
+ bookmark: string;
8
+ }
9
+ /** Resolve a bookmark by its Word name, or undefined. */
10
+ export declare function findBookmarkByName(state: EditorState, name: string): EditorBookmark | undefined;
11
+ /**
12
+ * Resolve the text a REF field should display for a bookmark: the flattened
13
+ * text of the bookmarked range (from the start paragraph offset to the end
14
+ * paragraph offset, or the whole start paragraph when the bookmark is
15
+ * zero-width). Falls back to "Error" style placeholder when the target
16
+ * bookmark cannot be located — mirroring a broken cross-reference.
17
+ */
18
+ export declare function resolveBookmarkReferenceText(state: EditorState, bookmark: EditorBookmark): string;
19
+ /**
20
+ * Insert a cross-reference field at the caret (any zone). When the target
21
+ * bookmark is missing this is a no-op (returns the same state), so a broken
22
+ * reference is never silently authored. The field caches a "1" placeholder as
23
+ * its displayed result, resolved by layout for PAGEREF and by bookmarked text
24
+ * for REF refresh.
25
+ */
26
+ export declare function insertCrossReference(state: EditorState, options: InsertCrossReferenceOptions): EditorState;
27
+ export declare function isCrossReferenceFieldRun(run: EditorTextRun): boolean;
@@ -1,6 +1,38 @@
1
- import { EditorState } from '../model.js';
1
+ import { EditorColumnsSettings, EditorState } from '../model.js';
2
2
  /** Convert a physical dimension in points to the editor's px unit (×96/72). */
3
3
  export declare function pointsToPx(points: number): number;
4
+ /** Default gap between columns (0.5"), matching Word's default `w:cols` space. */
5
+ export declare const DEFAULT_COLUMN_SPACE_PX = 48;
6
+ /** Common multi-column presets exposed to the Layout ribbon (per Word). */
7
+ export interface ColumnLayoutPreset {
8
+ /** Machine id, e.g. "two", "three", "left", "right". */
9
+ id: string;
10
+ count: number;
11
+ /** Whether the first column is wider (asymmetric preset) rather than equal. */
12
+ asymmetric?: boolean;
13
+ }
14
+ /** Ordinary single-column and the common newspaper presets. */
15
+ export declare const COLUMN_LAYOUT_PRESETS: readonly ColumnLayoutPreset[];
16
+ /** Look up a column-layout preset by id, or undefined. */
17
+ export declare function getColumnLayoutPreset(id: string): ColumnLayoutPreset | undefined;
18
+ /** Read the active section's columns, or undefined when single-column. */
19
+ export declare function getActiveColumns(state: EditorState): EditorColumnsSettings | undefined;
20
+ /**
21
+ * Set the active section's multi-column layout (`w:cols`). Passing `count <= 1`
22
+ * clears any columns.x so an ordinary single-column layout is restored. A
23
+ * `space` of `undefined` keeps existing spacing or falls back to the 0.5"
24
+ * default. `separator` draws a vertical rule between columns. Returns the same
25
+ * state when there's no section.
26
+ *
27
+ * Only equal-width columns are authored here; explicit unequal per-column
28
+ * widths remain round-trip-only (preserved on import, still rendered by the
29
+ * layout engine via `getPageColumnRects`).
30
+ */
31
+ export declare function setSectionColumns(state: EditorState, columns: {
32
+ count: number;
33
+ space?: number;
34
+ separator?: boolean;
35
+ }): EditorState;
4
36
  /** A named paper size in points (the author-facing physical dimension). */
5
37
  export interface PaperSizePreset {
6
38
  /** Machine id, e.g. "letter" / "a4". */
@@ -149,6 +149,12 @@ export interface OasisCommandPayloads {
149
149
  heightPt: number;
150
150
  };
151
151
  setPaperSizePreset: string;
152
+ setColumns: {
153
+ count: number;
154
+ space?: number;
155
+ separator?: boolean;
156
+ };
157
+ setColumnsPreset: string;
152
158
  editHeader: undefined;
153
159
  editFooter: undefined;
154
160
  insertPageNumber: undefined;
@@ -158,6 +164,10 @@ export interface OasisCommandPayloads {
158
164
  insertBookmark: string | undefined;
159
165
  removeBookmark: string;
160
166
  insertDateField: undefined;
167
+ insertCrossReference: {
168
+ type?: "REF" | "PAGEREF";
169
+ bookmark: string;
170
+ };
161
171
  exitHeaderFooter: undefined;
162
172
  applyDocumentTheme: DesignThemeId;
163
173
  setDocumentColorScheme: string;
@@ -191,13 +191,19 @@ export interface EditorImageRunData {
191
191
  /** `\*` number-format switch for PAGE/NUMPAGES fields (WordCraft NUMBER_FORMATS). */
192
192
  export type PageNumberFormat = "decimal" | "roman" | "ROMAN" | "alphabetic" | "ALPHABETIC" | "Ordinal";
193
193
  /** Field types the editor can author/evaluate for display. */
194
- export type EditorFieldType = "PAGE" | "NUMPAGES" | "DATE";
194
+ export type EditorFieldType = "PAGE" | "NUMPAGES" | "DATE" | "REF" | "PAGEREF";
195
195
  export interface EditorFieldData {
196
196
  type: EditorFieldType;
197
197
  /** Page-number `\*` format switch. Absent ⇒ decimal. */
198
198
  format?: PageNumberFormat;
199
199
  /** `\@` picture for DATE fields (e.g. "M/d/yyyy"). Absent ⇒ default. */
200
200
  dateFormat?: string;
201
+ /**
202
+ * Bookmark name a REF / PAGEREF cross-reference targets. The wordbookmark
203
+ * name is the link/cross-reference target (e.g. `_Ref12345` or a user
204
+ * bookmark). Absent for PAGE/NUMPAGES/DATE.
205
+ */
206
+ bookmark?: string;
201
207
  }
202
208
  /**
203
209
  * A preserved complex-field control character (`w:fldChar`). Carried on a