oasis-editor 0.0.306 → 0.0.307

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,4 +1,5 @@
1
1
  import { EditorUnderlineStyle, EditorParagraphListStyle, EditorParagraphStyle, EditorSection, EditorSectionBreakType, EditorState, EditorTextStyle } from '../../core/model.js';
2
+ import { ShowMarkupPayload } from '../../core/commands/reviewMarkup.js';
2
3
  import { ImageBorderPatch } from '../../core/commands/image.js';
3
4
  import { TextCaseMode } from '../../core/commands/text.js';
4
5
  import { BooleanStyleKey, ParagraphStyleKey, ToolbarStyleState } from '../../ui/toolbarStyleState.js';
@@ -39,6 +40,7 @@ declare function createEditorCommandsControllerImpl(deps: EditorCommandsControll
39
40
  applyToggleTrackChangesCommand: () => void;
40
41
  applyToggleRevisionMarkupCommand: () => void;
41
42
  applySetReviewDisplayModeCommand: (mode: import('../../core/model.js').EditorState["reviewDisplayMode"]) => void;
43
+ applyShowMarkupCommand: (payload: ShowMarkupPayload) => void;
42
44
  applyToggleShowMarginsCommand: () => void;
43
45
  applyToggleShowParagraphMarksCommand: () => void;
44
46
  applyAcceptRevisionsCommand: () => void;
@@ -1,2 +1,2 @@
1
- export declare const OASIS_BUILTIN_COMMANDS: readonly ["selectAll", "selectWord", "selectSentence", "selectParagraph", "selectCollapse", "selectText", "selectRange", "insertFootnote", "insertText", "insertEquation", "updateEquation", "insertTableOfContents", "updateTableOfContents", "pastePlainText", "paste", "pasteAsPlainText", "pasteMergeFormatting", "formatPainter", "formatPainterContinuous", "cancelFormatPainter", "bold", "italic", "underline", "doubleUnderline", "wordUnderline", "strike", "doubleStrike", "smallCaps", "allCaps", "hidden", "noProof", "webHidden", "specVanish", "contextualAlternates", "characterBorder", "shadow", "emboss", "engrave", "outline", "superscript", "subscript", "link", "unlink", "alignLeft", "alignCenter", "alignRight", "alignJustify", "orderedList", "bulletList", "find", "replace", "replaceAll", "toggleTrackChanges", "toggleRevisionMarkup", "toggleOutlinePanel", "toggleRevisionsPanel", "openCommandSearch", "repeatLastAction", "acceptRevisions", "rejectRevisions", "setReviewDisplayMode", "acceptAllRevisions", "rejectAllRevisions", "requestAcceptAllRevisions", "requestRejectAllRevisions", "nextRevision", "previousRevision", "nextComment", "previousComment", "newComment", "replyComment", "editComment", "toggleCommentsPanel", "resolveComment", "reopenComment", "deleteComment", "toggleShowMargins", "toggleShowParagraphMarks", "togglePreciseFonts", "undo", "redo", "pageBreak", "lineBreak", "columnBreak", "splitBlock", "insertNonBreakingSpace", "insertNonBreakingHyphen", "insertOptionalHyphen", "insertEmDash", "insertEllipsis", "insertCopyright", "insertRegistered", "insertTrademark", "setFontFamily", "setFontSize", "increaseFontSize", "decreaseFontSize", "growFont1", "shrinkFont1", "changeTextCase", "clearFormatting", "setColor", "setHighlight", "setTextShading", "setStyleId", "setCharacterStyleId", "setUnderlineStyle", "applyUnderlineStyle", "setUnderlineColor", "setCharacterScale", "setCharacterSpacing", "setRunSnapToGrid", "setFitText", "setBaselineShift", "setEmphasisMark", "setTextEffect", "setKerning", "setLigatures", "setNumberSpacing", "setNumberForm", "setStylisticSet", "documentStyles", "print", "copy", "cut", "newDocument", "saveDocument", "exportDocx", "exportPdf", "importDocument", "insertHtml", "insertImage", "editImageAlt", "insertImageCaption", "imageContext", "imageWidthCm", "imageHeightCm", "imageCrop", "imageCropAspect", "imageCropShape", "imageCropFill", "imageCropFit", "imageCropReset", "imageFlip", "imageRotate", "imageBorder", "imageTransparency", "resetImage", "outdent", "indent", "moveParagraphsUp", "moveParagraphsDown", "togglePageBreakBefore", "toggleKeepWithNext", "toggleKeepLinesTogether", "toggleWidowControl", "toggleParagraphBidi", "setParagraphBidi", "setParagraphAlign", "sortParagraphs", "promote", "demote", "resetParagraphFormatting", "setParagraphTabStops", "setOutlineLevel", "setSpacingAfter", "setSpacingBefore", "setContextualSpacing", "setMirrorIndents", "setLineRule", "setTextDirection", "setSuppressAutoHyphens", "setSuppressLineNumbers", "setKinsoku", "setOverflowPunct", "setWordWrap", "setAutoSpaceDE", "setAutoSpaceDN", "setAdjustRightInd", "setTopLinePunct", "setPageBreakBefore", "setKeepWithNext", "setKeepLinesTogether", "setWidowControl", "setIndentLeft", "setIndentRight", "setIndentFirstLine", "setIndentHanging", "setSpecialIndent", "setParagraphShading", "applyParagraphBorders", "applyHorizontalLine", "setDropCap", "setLineHeight", "setListFormat", "setListStartAt", "setListLevel", "toggleOrientation", "setOrientation", "sectionBreakNextPage", "sectionBreakContinuous", "sectionBreakEvenPage", "sectionBreakOddPage", "sectionBreakNextColumn", "setPageMargins", "setMarginsPreset", "setSectionPageNumbering", "setPaperSize", "setPaperSizePreset", "setColumns", "setColumnsPreset", "setSectionVerticalAlign", "setSectionStart", "setSectionBidi", "setHyphenation", "editHeader", "editFooter", "editFirstPageHeader", "editEvenPageHeader", "editFirstPageFooter", "editEvenPageFooter", "insertPageNumber", "insertPageNumberXOfY", "placePageNumberTop", "placePageNumberBottom", "insertBookmark", "removeBookmark", "insertDateField", "insertDateTime", "insertCrossReference", "setNoteOptions", "exitHeaderFooter", "setDifferentFirstPage", "setDifferentOddEven", "applyDocumentTheme", "setDocumentColorScheme", "setDocumentFontScheme", "setDocumentParagraphSpacing", "setDocumentEffects", "setDocumentPageColor", "setDocumentWatermark", "setDocumentPageBorder", "setDocumentDesignDefault", "tableContext", "tableMerge", "tableSplit", "tableInsertColumnBefore", "tableInsertColumnAfter", "tableDeleteColumn", "tableDeleteCells", "tableInsertRowBefore", "tableInsertRowAfter", "tableDeleteRow", "tableCellShading", "tableCellBorders", "tableCellNoBorders", "tableApplyBorderPreset", "toggleTableDrawBorders", "toggleTableGridlines", "tableWidth100", "tableAlignLeft", "tableAlignCenter", "tableAlignRight", "tableSetCellAlignment", "tableSetCellVerticalAlign", "tableSetCellTextDirection", "tableToText", "textToTable", "tableSplitAtRow", "tableSortAscending", "tableSortDescending", "tableDelete", "tableRepeatHeaderRows", "tableSetCellMargins", "tableSetCellSpacing", "tableSetTableIndent", "tableSetAlignment", "tableFormula", "tableSelectCell", "tableSelectRow", "tableSelectColumn", "tableSelectTable", "tableSetRowHeight", "tableSetBreakAcrossPages", "tableSetHeaderRow", "tableSetColumnWidth", "tableSetTableWidth", "tableSetCellWidth", "tableSetCellNoWrap", "tableSetCellFitText", "tableToggleHeaderRow", "tableToggleTotalRow", "tableToggleBandedRows", "tableToggleFirstColumn", "tableToggleLastColumn", "tableToggleBandedColumns", "setTableStyle", "tableToggleAutoFit", "tableAutoFit", "tableDistributeColumns", "tableDistributeRows", "insertTable", "insertShape", "setShapeFill", "setShapeOutline", "setShapeOutlineWidth", "alignFloatingObject", "reorderFloatingObject", "nudgeFloatingObject", "setFloatingFixedPosition", "setFloatingRotation", "setFloatingWrapPreset", "setFloatingWrapText", "setFloatingPositionPreset", "setShapePreset", "setTextBoxTextDirection", "setTextBoxVerticalAlign", "editTextBoxAlt", "rotateTextBox", "textBoxWidthCm", "textBoxHeightCm", "openSymbolDialog", "openEquationDialog", "tableProperties", "openFontDialog", "openParagraphDialog"];
1
+ export declare const OASIS_BUILTIN_COMMANDS: readonly ["selectAll", "selectWord", "selectSentence", "selectParagraph", "selectCollapse", "selectText", "selectRange", "insertFootnote", "insertText", "insertEquation", "updateEquation", "insertTableOfContents", "updateTableOfContents", "pastePlainText", "paste", "pasteAsPlainText", "pasteMergeFormatting", "formatPainter", "formatPainterContinuous", "cancelFormatPainter", "bold", "italic", "underline", "doubleUnderline", "wordUnderline", "strike", "doubleStrike", "smallCaps", "allCaps", "hidden", "noProof", "webHidden", "specVanish", "contextualAlternates", "characterBorder", "shadow", "emboss", "engrave", "outline", "superscript", "subscript", "link", "unlink", "alignLeft", "alignCenter", "alignRight", "alignJustify", "orderedList", "bulletList", "find", "replace", "replaceAll", "toggleTrackChanges", "toggleRevisionMarkup", "showMarkupOptions", "applyShowMarkup", "toggleOutlinePanel", "toggleRevisionsPanel", "openCommandSearch", "repeatLastAction", "acceptRevisions", "rejectRevisions", "setReviewDisplayMode", "acceptAllRevisions", "rejectAllRevisions", "requestAcceptAllRevisions", "requestRejectAllRevisions", "nextRevision", "previousRevision", "nextComment", "previousComment", "newComment", "replyComment", "editComment", "toggleCommentsPanel", "resolveComment", "reopenComment", "deleteComment", "toggleShowMargins", "toggleShowParagraphMarks", "togglePreciseFonts", "undo", "redo", "pageBreak", "lineBreak", "columnBreak", "splitBlock", "insertNonBreakingSpace", "insertNonBreakingHyphen", "insertOptionalHyphen", "insertEmDash", "insertEllipsis", "insertCopyright", "insertRegistered", "insertTrademark", "setFontFamily", "setFontSize", "increaseFontSize", "decreaseFontSize", "growFont1", "shrinkFont1", "changeTextCase", "clearFormatting", "setColor", "setHighlight", "setTextShading", "setStyleId", "setCharacterStyleId", "setUnderlineStyle", "applyUnderlineStyle", "setUnderlineColor", "setCharacterScale", "setCharacterSpacing", "setRunSnapToGrid", "setFitText", "setBaselineShift", "setEmphasisMark", "setTextEffect", "setKerning", "setLigatures", "setNumberSpacing", "setNumberForm", "setStylisticSet", "documentStyles", "print", "copy", "cut", "newDocument", "saveDocument", "exportDocx", "exportPdf", "importDocument", "insertHtml", "insertImage", "editImageAlt", "insertImageCaption", "imageContext", "imageWidthCm", "imageHeightCm", "imageCrop", "imageCropAspect", "imageCropShape", "imageCropFill", "imageCropFit", "imageCropReset", "imageFlip", "imageRotate", "imageBorder", "imageTransparency", "resetImage", "outdent", "indent", "moveParagraphsUp", "moveParagraphsDown", "togglePageBreakBefore", "toggleKeepWithNext", "toggleKeepLinesTogether", "toggleWidowControl", "toggleParagraphBidi", "setParagraphBidi", "setParagraphAlign", "sortParagraphs", "promote", "demote", "resetParagraphFormatting", "setParagraphTabStops", "setOutlineLevel", "setSpacingAfter", "setSpacingBefore", "setContextualSpacing", "setMirrorIndents", "setLineRule", "setTextDirection", "setSuppressAutoHyphens", "setSuppressLineNumbers", "setKinsoku", "setOverflowPunct", "setWordWrap", "setAutoSpaceDE", "setAutoSpaceDN", "setAdjustRightInd", "setTopLinePunct", "setPageBreakBefore", "setKeepWithNext", "setKeepLinesTogether", "setWidowControl", "setIndentLeft", "setIndentRight", "setIndentFirstLine", "setIndentHanging", "setSpecialIndent", "setParagraphShading", "applyParagraphBorders", "applyHorizontalLine", "setDropCap", "setLineHeight", "setListFormat", "setListStartAt", "setListLevel", "toggleOrientation", "setOrientation", "sectionBreakNextPage", "sectionBreakContinuous", "sectionBreakEvenPage", "sectionBreakOddPage", "sectionBreakNextColumn", "setPageMargins", "setMarginsPreset", "setSectionPageNumbering", "setPaperSize", "setPaperSizePreset", "setColumns", "setColumnsPreset", "setSectionVerticalAlign", "setSectionStart", "setSectionBidi", "setHyphenation", "editHeader", "editFooter", "editFirstPageHeader", "editEvenPageHeader", "editFirstPageFooter", "editEvenPageFooter", "insertPageNumber", "insertPageNumberXOfY", "placePageNumberTop", "placePageNumberBottom", "insertBookmark", "removeBookmark", "insertDateField", "insertDateTime", "insertCrossReference", "setNoteOptions", "exitHeaderFooter", "setDifferentFirstPage", "setDifferentOddEven", "applyDocumentTheme", "setDocumentColorScheme", "setDocumentFontScheme", "setDocumentParagraphSpacing", "setDocumentEffects", "setDocumentPageColor", "setDocumentWatermark", "setDocumentPageBorder", "setDocumentDesignDefault", "tableContext", "tableMerge", "tableSplit", "tableInsertColumnBefore", "tableInsertColumnAfter", "tableDeleteColumn", "tableDeleteCells", "tableInsertRowBefore", "tableInsertRowAfter", "tableDeleteRow", "tableCellShading", "tableCellBorders", "tableCellNoBorders", "tableApplyBorderPreset", "toggleTableDrawBorders", "toggleTableGridlines", "tableWidth100", "tableAlignLeft", "tableAlignCenter", "tableAlignRight", "tableSetCellAlignment", "tableSetCellVerticalAlign", "tableSetCellTextDirection", "tableToText", "textToTable", "tableSplitAtRow", "tableSortAscending", "tableSortDescending", "tableDelete", "tableRepeatHeaderRows", "tableSetCellMargins", "tableSetCellSpacing", "tableSetTableIndent", "tableSetAlignment", "tableFormula", "tableSelectCell", "tableSelectRow", "tableSelectColumn", "tableSelectTable", "tableSetRowHeight", "tableSetBreakAcrossPages", "tableSetHeaderRow", "tableSetColumnWidth", "tableSetTableWidth", "tableSetCellWidth", "tableSetCellNoWrap", "tableSetCellFitText", "tableToggleHeaderRow", "tableToggleTotalRow", "tableToggleBandedRows", "tableToggleFirstColumn", "tableToggleLastColumn", "tableToggleBandedColumns", "setTableStyle", "tableToggleAutoFit", "tableAutoFit", "tableDistributeColumns", "tableDistributeRows", "insertTable", "insertShape", "setShapeFill", "setShapeOutline", "setShapeOutlineWidth", "alignFloatingObject", "reorderFloatingObject", "nudgeFloatingObject", "setFloatingFixedPosition", "setFloatingRotation", "setFloatingWrapPreset", "setFloatingWrapText", "setFloatingPositionPreset", "setShapePreset", "setTextBoxTextDirection", "setTextBoxVerticalAlign", "editTextBoxAlt", "rotateTextBox", "textBoxWidthCm", "textBoxHeightCm", "openSymbolDialog", "openEquationDialog", "tableProperties", "openFontDialog", "openParagraphDialog"];
2
2
  export type OasisBuiltinCommand = (typeof OASIS_BUILTIN_COMMANDS)[number];
@@ -4,6 +4,7 @@ import { SectionPageNumberFormat } from './pageNumber.js';
4
4
  import { TextCaseMode } from './text.js';
5
5
  import { TableBorderPreset, TableCellAlignment, TableRowHeight } from './table.js';
6
6
  import { DesignThemeId } from './design.js';
7
+ import { ShowMarkupPayload } from './reviewMarkup.js';
7
8
  /** Payload for the `insertTable` command. */
8
9
  export interface InsertTablePayload {
9
10
  rows: number;
@@ -122,6 +123,8 @@ export interface OasisCommandPayloads {
122
123
  replaceAll: ReplaceAllPayload;
123
124
  toggleTrackChanges: undefined;
124
125
  toggleRevisionMarkup: undefined;
126
+ showMarkupOptions: undefined;
127
+ applyShowMarkup: ShowMarkupPayload;
125
128
  toggleOutlinePanel: undefined;
126
129
  toggleRevisionsPanel: undefined;
127
130
  openCommandSearch: undefined;
@@ -0,0 +1,83 @@
1
+ import { EditorState } from '../model.js';
2
+ /** The display sections Word's Show Markup menu filters. */
3
+ export type MarkupSection = "insertions" | "deletions" | "comments";
4
+ /**
5
+ * View-only Show Markup presentation flags. They live on `EditorState`
6
+ * (never on the document), so Display for Review modes, tracked-change
7
+ * painting and the Reviewing Pane can be filtered without mutating
8
+ * revision data or DOCX output.
9
+ */
10
+ export interface MarkupVisibilityState {
11
+ /** Paint insertions (default on). */
12
+ showMarkupInsertions?: boolean;
13
+ /** Paint deletions (default on). */
14
+ showMarkupDeletions?: boolean;
15
+ /** Paint comment highlights (default on). */
16
+ showMarkupComments?: boolean;
17
+ /**
18
+ * Visible markup authors. `undefined` means every author is visible;
19
+ * an array is the explicit author allow-list.
20
+ */
21
+ markupAuthors?: string[];
22
+ }
23
+ /** Whether a markup section paints; every section is on by default. */
24
+ export declare function isMarkupSectionShown(state: EditorState, section: MarkupSection): boolean;
25
+ /** A single Show Markup menu action, dispatched through the command bus. */
26
+ export interface ShowMarkupPayload {
27
+ /** Toggle one revision/comment category. */
28
+ section?: MarkupSection;
29
+ /** Toggle one reviewer's markup. */
30
+ author?: string;
31
+ /** Show every reviewer (`true`) or none of them (`false`). */
32
+ allAuthors?: boolean;
33
+ }
34
+ /**
35
+ * Read-only snapshot of the Show Markup presentation state for the gallery
36
+ * menu. Never serialized to a document.
37
+ */
38
+ export interface MarkupOptionsSnapshot {
39
+ insertions: boolean;
40
+ deletions: boolean;
41
+ comments: boolean;
42
+ /** `true` when `markupAuthors` is absent (all authors visible). */
43
+ allAuthors: boolean;
44
+ /** Explicitly visible authors (empty when all authors are visible). */
45
+ visibleAuthors: string[];
46
+ /** Every author with markup in the document, sorted. */
47
+ knownAuthors: string[];
48
+ }
49
+ /** Build the reactive Show Markup menu snapshot from the live editor state. */
50
+ export declare function markupOptionsSnapshot(state: EditorState): MarkupOptionsSnapshot;
51
+ /**
52
+ * Apply one Show Markup menu action to a copy of the state. View-only: no
53
+ * revision data is edited, so the result belongs outside the undo stack.
54
+ */
55
+ export declare function applyShowMarkup(state: EditorState, payload: ShowMarkupPayload): EditorState;
56
+ /** Whether an author's markup paints; `undefined` means all authors. */
57
+ export declare function isMarkupAuthorShown(state: EditorState, author: string): boolean;
58
+ /** The explicit author allow-list, or null when all authors are shown. */
59
+ export declare function visibleMarkupAuthors(state: EditorState): string[] | null;
60
+ /** Flip one markup section; returns the same state when nothing changes. */
61
+ export declare function toggleShowMarkupSection(state: EditorState, section: MarkupSection): EditorState;
62
+ /**
63
+ * Set the explicit author allow-list. An empty array hides every author;
64
+ * `undefined` restores "all authors". No-op when unchanged.
65
+ */
66
+ export declare function setMarkupAuthors(state: EditorState, authors: string[] | undefined): EditorState;
67
+ /**
68
+ * Toggle one author in the visible set. The effective set starts from the
69
+ * explicit list (or every known author when all are visible). Hiding the last
70
+ * visible author is allowed and yields an explicit empty list (no authors
71
+ * shown), matching Word's "All Reviewers" unchecked state.
72
+ *
73
+ * When the resulting set equals *every* known author (compared by value, not
74
+ * just count), the explicit allow-list is redundant, so it collapses back to
75
+ * `undefined` ("all authors"). This keeps the state from going stale as new
76
+ * authors appear later.
77
+ */
78
+ export declare function toggleMarkupAuthor(state: EditorState, author: string, knownAuthors: readonly string[]): EditorState;
79
+ /**
80
+ * Every author with markup in the document: tracked-revision authors plus
81
+ * comment authors, sorted for a stable menu. Empty when nothing is marked.
82
+ */
83
+ export declare function collectMarkupAuthors(state: EditorState): string[];
@@ -31,5 +31,19 @@ export interface EditorState {
31
31
  reviewDisplayMode?: ReviewDisplayMode;
32
32
  /** Presentation toggle for painting tracked revisions (default on). */
33
33
  showRevisionMarkup?: boolean;
34
+ /**
35
+ * Show Markup presentation filters (Review > Tracking). View only: they
36
+ * never touch revision data or DOCX output.
37
+ * Paint insertions (default on). */
38
+ showMarkupInsertions?: boolean;
39
+ /** Paint deletions (default on). */
40
+ showMarkupDeletions?: boolean;
41
+ /** Paint comment highlights (default on). */
42
+ showMarkupComments?: boolean;
43
+ /**
44
+ * Visible markup authors. `undefined` means every author is visible;
45
+ * an array is the explicit author allow-list.
46
+ */
47
+ markupAuthors?: string[];
34
48
  }
35
49
  export type { EditorPosition, EditorSelection, EditorEditingZone };