oasis-editor 0.0.220 → 0.0.222

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,5 +1,5 @@
1
1
  import { ImageBorderPatch } from '../../core/commands/image.js';
2
- import { EditorParagraphListStyle, EditorParagraphStyle, EditorSection, EditorState, EditorTextStyle } from '../../core/model.js';
2
+ import { EditorParagraphListStyle, EditorParagraphStyle, EditorSection, EditorSectionBreakType, EditorState, EditorTextStyle } from '../../core/model.js';
3
3
  import { TextCaseMode } from '../../core/commands/text.js';
4
4
  import { BooleanStyleKey, ParagraphStyleKey, ToolbarStyleState } from '../../ui/toolbarStyleState.js';
5
5
  import { EditorLogger } from '../../utils/logger.js';
@@ -26,7 +26,7 @@ declare function createEditorCommandsControllerImpl(deps: EditorCommandsControll
26
26
  applyParagraphListCommand: (kind: NonNullable<EditorParagraphListStyle["kind"]>) => void;
27
27
  handleListFormatChange: (format: EditorParagraphListStyle["format"]) => void;
28
28
  handleListStartAtChange: (startAt: number | null) => void;
29
- applyInsertSectionBreakCommand: (breakType: "nextPage" | "continuous") => void;
29
+ applyInsertSectionBreakCommand: (breakType: EditorSectionBreakType) => void;
30
30
  applyInsertPageBreakCommand: () => void;
31
31
  canInsertFootnoteCommand: () => boolean;
32
32
  applyInsertFootnoteCommand: () => void;
@@ -1,9 +1,9 @@
1
- import { EditorParagraphStyle, EditorPosition, EditorState, EditorSection, EditorTabStop, EditorPageSettings } from '../model.js';
1
+ import { EditorParagraphStyle, EditorPosition, EditorState, EditorSection, EditorTabStop, EditorPageSettings, EditorSectionBreakType } from '../model.js';
2
2
  import { ValueParagraphStyleKey } from '../textStyle/textStyleKeys.js';
3
3
  export declare function moveBlockToPosition(state: EditorState, blockId: string, targetPosition: EditorPosition): EditorState;
4
4
  export declare function splitBlockAtSelection(state: EditorState): EditorState;
5
5
  export declare function insertPageBreakAtSelection(state: EditorState): EditorState;
6
- export declare function insertSectionBreakAtSelection(state: EditorState, breakType: "nextPage" | "continuous"): EditorState;
6
+ export declare function insertSectionBreakAtSelection(state: EditorState, breakType: EditorSectionBreakType): EditorState;
7
7
  export declare function updateSectionSettings(state: EditorState, sectionIndex: number, settings: Omit<Partial<EditorSection>, "pageSettings"> & {
8
8
  pageSettings?: Partial<EditorPageSettings>;
9
9
  }): EditorState;
@@ -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", "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"];
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", "sectionBreakEvenPage", "sectionBreakOddPage", "sectionBreakNextColumn", "setPageMargins", "setSectionPageNumbering", "setPaperSize", "setPaperSizePreset", "setColumns", "setColumnsPreset", "editHeader", "editFooter", "editFirstPageHeader", "editEvenPageHeader", "editFirstPageFooter", "editEvenPageFooter", "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];
@@ -1,9 +1,6 @@
1
- import { EditorState } from '../model.js';
2
- export type HeaderFooterSide = "header" | "footer";
3
- export type HeaderFooterStoryKind = "default" | "firstPage" | "evenPage";
4
- type HeaderFooterStoryKey = "header" | "firstPageHeader" | "evenPageHeader" | "footer" | "firstPageFooter" | "evenPageFooter";
5
- /** Map a (side, kind) pair onto the section's story array field name. */
6
- export declare function getHeaderFooterStoryKey(side: HeaderFooterSide, kind: HeaderFooterStoryKind): HeaderFooterStoryKey;
1
+ import { EditorState, HeaderFooterSide, HeaderFooterStoryKind } from '../model.js';
2
+ export type { HeaderFooterSide, HeaderFooterStoryKind } from '../model.js';
3
+ export { getHeaderFooterStoryKey } from '../model.js';
7
4
  /**
8
5
  * Ensure the active section has the requested header/footer story, seeding an
9
6
  * empty zone-styled paragraph only when the story is absent. Existing content
@@ -17,13 +14,12 @@ export declare function enableHeaderFooterStory(state: EditorState, side: Header
17
14
  */
18
15
  export declare function clearHeaderFooterStory(state: EditorState, side: HeaderFooterSide, kind?: HeaderFooterStoryKind): EditorState;
19
16
  /**
20
- * Enter header/footer editing: ensure the default story exists, move the caret
21
- * into its first paragraph and set the active zone to `header`/`footer`.
22
- *
23
- * Only the default story is editable through today's zone stack; first/even
24
- * variants are created via `enableHeaderFooterStory`.
17
+ * Enter header/footer editing: ensure the requested story exists, move the
18
+ * caret into its first paragraph, set the active zone to `header`/`footer` and
19
+ * record the active story so the editing-zone and write-back pipeline target
20
+ * it. Defaults to the `default` story when no kind is given.
25
21
  */
26
- export declare function editHeaderFooter(state: EditorState, side: HeaderFooterSide): EditorState;
22
+ export declare function editHeaderFooter(state: EditorState, side: HeaderFooterSide, kind?: HeaderFooterStoryKind): EditorState;
27
23
  /** Return the caret to the start of the section's main body. */
28
24
  export declare function exitHeaderFooter(state: EditorState): EditorState;
29
25
  /**
@@ -31,4 +27,3 @@ export declare function exitHeaderFooter(state: EditorState): EditorState;
31
27
  * footer or main body. Placeholder text is resolved during layout projection.
32
28
  */
33
29
  export declare function insertPageNumber(state: EditorState): EditorState;
34
- export {};
@@ -139,6 +139,9 @@ export interface OasisCommandPayloads {
139
139
  setOrientation: "portrait" | "landscape";
140
140
  sectionBreakNextPage: undefined;
141
141
  sectionBreakContinuous: undefined;
142
+ sectionBreakEvenPage: undefined;
143
+ sectionBreakOddPage: undefined;
144
+ sectionBreakNextColumn: undefined;
142
145
  setPageMargins: SetPageMarginsPayload;
143
146
  setSectionPageNumbering: {
144
147
  start?: number;
@@ -157,6 +160,10 @@ export interface OasisCommandPayloads {
157
160
  setColumnsPreset: string;
158
161
  editHeader: undefined;
159
162
  editFooter: undefined;
163
+ editFirstPageHeader: undefined;
164
+ editEvenPageHeader: undefined;
165
+ editFirstPageFooter: undefined;
166
+ editEvenPageFooter: undefined;
160
167
  insertPageNumber: undefined;
161
168
  insertPageNumberXOfY: undefined;
162
169
  placePageNumberTop: undefined;
@@ -1,6 +1,6 @@
1
- import { EditorBlockNode, EditorParagraphNode, EditorSection, EditorSelection, EditorState, EditorTableCellNode } from '../model.js';
1
+ import { EditorBlockNode, EditorParagraphNode, EditorSection, EditorSelection, EditorState, EditorTableCellNode, HeaderFooterStoryKind } from '../model.js';
2
2
  export declare function blocksContainTables(nodes: EditorBlockNode[]): boolean;
3
3
  export declare function replaceParagraphsInBlocks(blocks: EditorBlockNode[], newParagraphs: EditorParagraphNode[]): EditorBlockNode[];
4
- export declare function replaceParagraphsInSection(section: EditorSection, paragraphs: EditorParagraphNode[], zone: "main" | "header" | "footer"): EditorSection;
4
+ export declare function replaceParagraphsInSection(section: EditorSection, paragraphs: EditorParagraphNode[], zone: "main" | "header" | "footer", story?: HeaderFooterStoryKind): EditorSection;
5
5
  export declare function cloneStateWithParagraphs(state: EditorState, paragraphs: EditorParagraphNode[], selection: EditorSelection): EditorState;
6
6
  export declare function updateTableCellsInBlocks(blocks: EditorBlockNode[], selectedParagraphIds: Set<string>, updateCell: (cell: EditorTableCellNode) => EditorTableCellNode): EditorBlockNode[];
@@ -1,8 +1,11 @@
1
1
  import { EditorBlockNode, EditorParagraphNode } from './types/nodes.js';
2
2
  import { EditorState } from './editorState.js';
3
3
  import { EditorEditingZone } from './types/selection.js';
4
+ import { HeaderFooterStoryKind } from './headerFooterStories.js';
4
5
  export declare function getActiveSectionIndex(state: EditorState): number;
5
6
  export declare function getActiveZone(state: EditorState): EditorEditingZone;
7
+ /** Which header/footer story is active for header/footer zones. */
8
+ export declare function getActiveHeaderFooterStory(state: EditorState): HeaderFooterStoryKind;
6
9
  /**
7
10
  * Strict variant: returns `null` when the state is invalid for the zone
8
11
  * (e.g. footnote zone with no active footnote id). Use this when you
@@ -1,5 +1,6 @@
1
1
  import { EditorDocument } from './types/document.js';
2
2
  import { EditorPosition, EditorSelection, EditorEditingZone } from './types/selection.js';
3
+ import { HeaderFooterStoryKind } from './headerFooterStories.js';
3
4
  export interface EditorState {
4
5
  document: EditorDocument;
5
6
  selection: EditorSelection;
@@ -10,6 +11,11 @@ export interface EditorState {
10
11
  * Ignored for other zones.
11
12
  */
12
13
  activeFootnoteId?: string;
14
+ /**
15
+ * Which header/footer story is being edited when `activeZone` is `"header"`
16
+ * or `"footer"`. Defaults to `"default"` for those zones.
17
+ */
18
+ activeHeaderFooterStory?: HeaderFooterStoryKind;
13
19
  trackChangesEnabled?: boolean;
14
20
  showMargins?: boolean;
15
21
  showParagraphMarks?: boolean;
@@ -0,0 +1,11 @@
1
+ import { EditorBlockNode } from './types/nodes.js';
2
+ import { EditorSection } from './types/document.js';
3
+ export type HeaderFooterSide = "header" | "footer";
4
+ export type HeaderFooterStoryKind = "default" | "firstPage" | "evenPage";
5
+ export type HeaderFooterStoryKey = "header" | "firstPageHeader" | "evenPageHeader" | "footer" | "firstPageFooter" | "evenPageFooter";
6
+ /** Map a (side, kind) pair onto the section's story array field name. */
7
+ export declare function getHeaderFooterStoryKey(side: HeaderFooterSide, kind: HeaderFooterStoryKind): HeaderFooterStoryKey;
8
+ /** The block story array backing a (side, kind) pair, if present. */
9
+ export declare function getSectionHeaderFooterBlocks(section: EditorSection, side: HeaderFooterSide, kind: HeaderFooterStoryKind): EditorBlockNode[] | undefined;
10
+ /** Set the block story array for a (side, kind) pair, cloning the section. */
11
+ export declare function setSectionHeaderFooterBlocks(section: EditorSection, side: HeaderFooterSide, kind: HeaderFooterStoryKind, blocks: EditorBlockNode[] | undefined): EditorSection;
@@ -37,3 +37,5 @@ export type { EditorParagraphLocation, TableLocation, TablePathSegment, Document
37
37
  export { getBlockParagraphs, collectSectionParagraphs, } from './paragraphWalker.js';
38
38
  export { buildListLabels, resolveListLabel } from './listNumbering.js';
39
39
  export { getActiveSectionIndex, getActiveZone, getEditableBlocksForZone, tryGetEditableBlocksForZone, getActiveSectionBlocks, getParagraphs, syncActiveSectionToSelection, } from './editingZones.js';
40
+ export { getHeaderFooterStoryKey, getSectionHeaderFooterBlocks, setSectionHeaderFooterBlocks, } from './headerFooterStories.js';
41
+ export type { HeaderFooterSide, HeaderFooterStoryKind, HeaderFooterStoryKey, } from './headerFooterStories.js';