oasis-editor 0.0.224 → 0.0.226

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", "acceptAllRevisions", "rejectAllRevisions", "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"];
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", "acceptAllRevisions", "rejectAllRevisions", "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", "tableSetCellVerticalAlign", "tableSetCellTextDirection", "tableToText", "textToTable", "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];
@@ -207,6 +207,10 @@ export interface OasisCommandPayloads {
207
207
  tableAlignLeft: undefined;
208
208
  tableAlignCenter: undefined;
209
209
  tableAlignRight: undefined;
210
+ tableSetCellVerticalAlign: "top" | "middle" | "bottom";
211
+ tableSetCellTextDirection: "lrTb" | "tbRl" | "btLr" | "lrTbV" | "tbRlV";
212
+ tableToText: undefined;
213
+ textToTable: undefined;
210
214
  tableSetCellWidth: string | number;
211
215
  tableToggleHeaderRow: undefined;
212
216
  tableToggleTotalRow: undefined;
@@ -19,4 +19,46 @@ export declare function resolveActiveTableLocation(state: EditorState): ActiveTa
19
19
  * structural sharing for every unrelated block and cell.
20
20
  */
21
21
  export declare function updateTableAtPath(blocks: EditorBlockNode[], tablePath: readonly TablePathSegment[], updateTable: (table: EditorTableNode) => EditorTableNode): EditorBlockNode[];
22
+ /**
23
+ * Reads the innermost table identified by `tablePath` from a block story
24
+ * (`getBlocksForZone` + the top-level path), following nested hops into the
25
+ * parent cell's `blocks` array as `updateTableAtPath` does.
26
+ */
27
+ export declare function readInnermostTableAtPath(blocks: readonly EditorBlockNode[] | undefined, tablePath: readonly TablePathSegment[]): EditorTableNode | null;
28
+ /**
29
+ * Splices a list of replacement blocks in place of the innermost table
30
+ * identified by `tablePath`. Mirrors `updateTableAtPath` structurally, but
31
+ * replaces the target table with `replacement` (Word's Convert Table to Text).
32
+ */
33
+ export declare function replaceInnermostTableAtPath(blocks: EditorBlockNode[], tablePath: readonly TablePathSegment[], replacement: readonly EditorBlockNode[]): EditorBlockNode[] | null;
34
+ /**
35
+ * Resolves the block story that contains the active table (the story whose
36
+ * paragraph owns the caret), based on the same zone/story-selection rules
37
+ * `updateSelectedSectionStory` uses: for main/header/footer it picks the
38
+ * section's relevant story (first page / even page / default), and for
39
+ * footnotes it picks the owning note's `blocks`.
40
+ */
41
+ export declare function getActiveTableStory(state: EditorState): EditorBlockNode[] | null;
42
+ /**
43
+ * Table-free variant of `getActiveTableStory`: resolves the block story that
44
+ * owns the caret (from `getActiveZone`), used when the caret is not inside a
45
+ * table (e.g. Text to Table). Returns `null` when the caret sits in no
46
+ * editable story.
47
+ */
48
+ export declare function getActiveCaretStory(state: EditorState): EditorBlockNode[] | null;
49
+ /**
50
+ * Replaces the active table (the innermost table containing the caret) with a
51
+ * list of replacement blocks, mirroring `updateActiveTableBlocks` but for the
52
+ * Convert Table to Text splice operation. Handles footnote and all section
53
+ * stories; a no-op when no active table resolves.
54
+ */
55
+ export declare function replaceActiveTableWithBlocks(state: EditorState, replacement: readonly EditorBlockNode[]): EditorState;
22
56
  export declare function updateActiveTableBlocks(state: EditorState, updateTable: (table: EditorTableNode) => EditorTableNode): EditorState;
57
+ /**
58
+ * Applies `updateBlocks` to the block story that owns the caret, regardless of
59
+ * whether the caret sits inside a table. Resolves the story from the active
60
+ * editing zone (footnote, or the section main/header/footer story), mirroring
61
+ * `updateActiveTableBlocks` but without requiring a table location. Used by the
62
+ * Text to Table conversion which splices a table into a paragraph run.
63
+ */
64
+ export declare function updateActiveCaretBlocks(state: EditorState, updateBlocks: (blocks: EditorBlockNode[]) => EditorBlockNode[]): EditorState;
@@ -0,0 +1,12 @@
1
+ import { EditorParagraphNode, EditorState, EditorTableNode } from '../../model.js';
2
+ /** True when the caret sits inside an editable table that can be converted. */
3
+ export declare function canConvertActiveTableToText(state: EditorState): boolean;
4
+ /**
5
+ * Word's "Convert Table to Text": replaces the active (innermost) table with
6
+ * a run of body paragraphs, one per cell paragraph in document order, keeping
7
+ * each cell's paragraph content. The caret lands at the start of the first
8
+ * produced paragraph. A no-op when the caret is outside a table.
9
+ */
10
+ export declare function convertActiveTableToText(state: EditorState): EditorState;
11
+ /** Flattens a table's cell paragraphs, in document order, as fresh clones. */
12
+ export declare function tableToParagraphs(table: EditorTableNode): EditorParagraphNode[];
@@ -0,0 +1,20 @@
1
+ import { EditorParagraphNode, EditorState, EditorTableNode } from '../../model.js';
2
+ /**
3
+ * True when the caret can be turned into a table: it must sit in an editable
4
+ * story (main/header/footer/footnote) but NOT inside an existing table.
5
+ */
6
+ export declare function canConvertActiveTextToTable(state: EditorState): boolean;
7
+ /**
8
+ * Word's "Convert Text to Table": splits the selected paragraphs on TAB into
9
+ * cells (each paragraph becomes a row, every tab-separated segment a column),
10
+ * splices the resulting table in place of the selection, and lands the caret in
11
+ * the first cell. A no-op when the caret is inside a table or outside an
12
+ * editable story.
13
+ */
14
+ export declare function convertActiveTextToTable(state: EditorState): EditorState;
15
+ /**
16
+ * Builds a table from a list of source paragraphs. Each paragraph becomes one
17
+ * row; tab-separated run segments become the row's cells. Rows shorter than the
18
+ * widest row are padded with empty cells so the grid stays rectangular.
19
+ */
20
+ export declare function buildTableFromParagraphs(paragraphs: EditorParagraphNode[]): EditorTableNode;
@@ -4,3 +4,5 @@ export * from './table/tableRowCommands.js';
4
4
  export * from './table/tableColumnCommands.js';
5
5
  export * from './table/insertTableCommand.js';
6
6
  export * from './table/tableFloatingCommands.js';
7
+ export * from './table/tableConvertCommands.js';
8
+ export * from './table/tableTextToTableCommands.js';
@@ -31,7 +31,11 @@ export declare const MERGE_KEYS: {
31
31
  readonly tableBorders: "tableBorders";
32
32
  readonly tableWidth: "tableWidth";
33
33
  readonly tableAlign: "tableAlign";
34
+ readonly tableCellVerticalAlign: "tableCellVerticalAlign";
35
+ readonly tableCellTextDirection: "tableCellTextDirection";
34
36
  readonly tableCellWidth: "tableCellWidth";
37
+ readonly tableToText: "tableToText";
38
+ readonly textToTable: "textToTable";
35
39
  readonly tableStyleOptions: "tableStyleOptions";
36
40
  readonly tableStyleGallery: "tableStyleGallery";
37
41
  readonly tableDistribute: "tableDistribute";