oasis-editor 0.0.221 → 0.0.223

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.
@@ -9775,8 +9775,10 @@ while (n === s[++o] && n === s[++o] && n === s[++o] && n === s[++o] && n === s[+
9775
9775
  else if ("tab" === i.localName) p(" ");
9776
9776
  else if ("noBreakHyphen" === i.localName) p("‑");
9777
9777
  else if ("softHyphen" === i.localName) p("­");
9778
- else if ("br" === i.localName) p("page" === Pe(i, "type") ? "\f" : "\n");
9779
- else {
9778
+ else if ("br" === i.localName) {
9779
+ const e = Pe(i, "type");
9780
+ p("page" === e ? "\f" : "column" === e ? "\v" : "\n");
9781
+ } else {
9780
9782
  if ("lastRenderedPageBreak" === i.localName) continue;
9781
9783
  if ("bookmarkStart" === i.localName || "bookmarkEnd" === i.localName) {
9782
9784
  const e = Cr(i);
@@ -12655,7 +12657,7 @@ while (n === s[++o] && n === s[++o] && n === s[++o] && n === s[++o] && n === s[+
12655
12657
  function Oi(e) {
12656
12658
  if (0 === e.length) return "<w:t></w:t>";
12657
12659
  let t = "", r = "";
12658
- for (const n of e) "\n" !== n ? " " !== n ? "‑" !== n ? "­" !== n ? r += n : (t += Mi(r), r = "", t += "<w:softHyphen/>") : (t += Mi(r), r = "", t += "<w:noBreakHyphen/>") : (t += Mi(r), r = "", t += "<w:tab/>") : (t += Mi(r), r = "", t += "<w:br/>");
12660
+ for (const n of e) "\n" !== n ? "\v" !== n ? " " !== n ? "‑" !== n ? "­" !== n ? r += n : (t += Mi(r), r = "", t += "<w:softHyphen/>") : (t += Mi(r), r = "", t += "<w:noBreakHyphen/>") : (t += Mi(r), r = "", t += "<w:tab/>") : (t += Mi(r), r = "", t += "<w:br w:type=\"column\"/>") : (t += Mi(r), r = "", t += "<w:br/>");
12659
12661
  return t += Mi(r), t || "<w:t></w:t>";
12660
12662
  }
12661
12663
  function Li(e, t) {
@@ -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", "sectionBreakEvenPage", "sectionBreakOddPage", "sectionBreakNextColumn", "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", "columnBreak", "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 {};
@@ -83,6 +83,7 @@ export interface OasisCommandPayloads {
83
83
  redo: undefined;
84
84
  pageBreak: undefined;
85
85
  lineBreak: undefined;
86
+ columnBreak: undefined;
86
87
  splitBlock: undefined;
87
88
  setFontFamily: string | null;
88
89
  setFontSize: SetFontSizePayload | number | string | null;
@@ -160,6 +161,10 @@ export interface OasisCommandPayloads {
160
161
  setColumnsPreset: string;
161
162
  editHeader: undefined;
162
163
  editFooter: undefined;
164
+ editFirstPageHeader: undefined;
165
+ editEvenPageHeader: undefined;
166
+ editFirstPageFooter: undefined;
167
+ editEvenPageFooter: undefined;
163
168
  insertPageNumber: undefined;
164
169
  insertPageNumberXOfY: undefined;
165
170
  placePageNumberTop: undefined;
@@ -1,4 +1,4 @@
1
- export { moveOrCopySelectionToPosition, insertTextAtSelection, insertPlainTextAtSelection, insertMathAtSelection, updateMathRun, } from './textEditing.js';
1
+ export { moveOrCopySelectionToPosition, insertTextAtSelection, insertPlainTextAtSelection, insertMathAtSelection, insertColumnBreakAtSelection, updateMathRun, } from './textEditing.js';
2
2
  export { deleteBackward, deleteForward, deleteCharsBackwardRaw, } from './textDeletion.js';
3
3
  export { toggleTextStyle, clearSelectedTextFormatting, setTextStyleValue, } from './textFormatting.js';
4
4
  export { type TextCaseMode, transformSelectedText, changeSelectedTextCase, } from './textCase.js';
@@ -3,6 +3,7 @@ export declare function moveOrCopySelectionToPosition(state: EditorState, target
3
3
  copy?: boolean;
4
4
  }): EditorState;
5
5
  export declare function insertTextAtSelection(state: EditorState, text: string, styleOverride?: EditorTextStyle): EditorState;
6
+ export declare function insertColumnBreakAtSelection(state: EditorState): EditorState;
6
7
  export declare function insertMathAtSelection(state: EditorState, expression: EditorMathExpression): EditorState;
7
8
  export declare function updateMathRun(state: EditorState, runId: string, expression: EditorMathExpression): EditorState;
8
9
  export declare function insertPlainTextAtSelection(state: EditorState, text: string, styleOverride?: EditorTextStyle): EditorState;
@@ -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';
@@ -31,3 +31,12 @@ export declare const OOXML_ROTATION_UNITS = 60000;
31
31
  * `14.6667` so layout measurements remain byte-identical.
32
32
  */
33
33
  export declare const DEFAULT_FONT_SIZE_PX = 14.6667;
34
+ /**
35
+ * Inline marker for a hard column break (`<w:br w:type="column"/>`), stored as
36
+ * a literal control character inside `EditorTextRun.text`, exactly like the
37
+ * line-break `\n` and tab `\t` markers. The vertical-tab codepoint is distinct
38
+ * from the page-break marker `\u000C` so the two never collide. Shared across
39
+ * the core (commands), layout, import and export layers so every consumer
40
+ * references one symbol rather than a magic string.
41
+ */
42
+ export declare const COLUMN_BREAK_MARKER = "\v";