oasis-editor 0.0.213 → 0.0.215

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.
@@ -0,0 +1,16 @@
1
+ import { EditorBookmark, EditorBookmarkAnchor, EditorState } from '../model.js';
2
+ /**
3
+ * Add a bookmark over the current selection (single point when collapsed) and
4
+ * keep the selection unchanged. `name` is the Word bookmark / hyperlink /
5
+ * cross-reference target; a deterministic default is used when omitted.
6
+ */
7
+ export declare function createBookmark(state: EditorState, name?: string): EditorState;
8
+ /**
9
+ * Remove a bookmark by editor-local id, returning the same state if it does
10
+ * not exist.
11
+ */
12
+ export declare function removeBookmark(state: EditorState, bookmarkId: string): EditorState;
13
+ /** List authorable (non-hidden) bookmarks, for cross-reference/target pickers. */
14
+ export declare function listBookmarks(state: EditorState): EditorBookmark[];
15
+ /** True when a visible bookmark covers the given (block, offset) anchor. */
16
+ export declare function isAnchorInBookmark(state: EditorState, anchor: EditorBookmarkAnchor): boolean;
@@ -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", "editHeader", "editFooter", "insertPageNumber", "insertPageNumberXOfY", "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", "editHeader", "editFooter", "insertPageNumber", "insertPageNumberXOfY", "placePageNumberTop", "placePageNumberBottom", "insertBookmark", "removeBookmark", "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];
@@ -1,5 +1,19 @@
1
1
  import { EditorState, EditorTextRun, PageNumberFormat } from '../model.js';
2
2
  export type PageNumberFieldKind = "page" | "xOfY";
3
+ export type PageNumberPlacement = "current" | "top" | "bottom";
4
+ export type PageNumberAlign = "left" | "center" | "right" | "justify";
5
+ export interface PageNumberPlacementOptions {
6
+ /** Field shape: bare PAGE or the Page X of Y combination. Default `page`. */
7
+ kind?: PageNumberFieldKind;
8
+ /** `\*` number format applied to the field runs. Default decimal. */
9
+ format?: PageNumberFormat;
10
+ /**
11
+ * Paragraph alignment of the placed page number. Only meaningful for
12
+ * `top`/`bottom` (the story paragraph's alignment); WordCraft defaults the
13
+ * placement to `center`. Ignored for `current` (caret insertion).
14
+ */
15
+ align?: PageNumberAlign;
16
+ }
3
17
  /** True for a run that is a PAGE or NUMPAGES field. */
4
18
  export declare function isPageNumberFieldRun(run: EditorTextRun): boolean;
5
19
  /**
@@ -10,5 +24,17 @@ export declare function isPageNumberFieldRun(run: EditorTextRun): boolean;
10
24
  * the field runs (default decimal).
11
25
  */
12
26
  export declare function insertPageNumberField(state: EditorState, kind?: PageNumberFieldKind, format?: PageNumberFormat): EditorState;
27
+ /**
28
+ * Place a page number at the requested position.
29
+ *
30
+ * - `current` inserts the field at the active caret (header, footer or body),
31
+ * reusing {@link insertPageNumberField}.
32
+ * - `top`/`bottom` replace the active section's default header/footer story
33
+ * with a single aligned paragraph containing the field runs, and move the
34
+ * caret into that story (active zone set) — mirroring WordCraft's
35
+ * `position` handling, which rewrites the story to a styled, aligned
36
+ * paragraph.
37
+ */
38
+ export declare function placePageNumber(state: EditorState, position: PageNumberPlacement, options?: PageNumberPlacementOptions): EditorState;
13
39
  /** Exported for tests: whether the active zone is a header or footer. */
14
40
  export declare function isInHeaderOrFooter(state: EditorState): boolean;
@@ -143,6 +143,10 @@ export interface OasisCommandPayloads {
143
143
  editFooter: undefined;
144
144
  insertPageNumber: undefined;
145
145
  insertPageNumberXOfY: undefined;
146
+ placePageNumberTop: undefined;
147
+ placePageNumberBottom: undefined;
148
+ insertBookmark: string | undefined;
149
+ removeBookmark: string;
146
150
  exitHeaderFooter: undefined;
147
151
  applyDocumentTheme: DesignThemeId;
148
152
  setDocumentColorScheme: string;