ComponentCommand
Commands the custom-components layer sends; each is one undo step.
Import from @reductoai/pptx/editor.
type ComponentCommand = { componentType: string; fallback: ComponentFallback; id: string; placement?: ComponentPlacement; slide?: number; state: unknown; type: "insertComponent" } | { fallback?: ComponentFallback; key: string; state: unknown; type: "setComponent" }EditorComponent
A component definition with an optional live view; the return of mount unmounts it.
Import from @reductoai/pptx-editor.
| Name | Type | Description |
|---|---|---|
type |
string |
Names the kind, such as “acme.kpi”: letters, digits, ‘.’, ‘_’ and ‘-’. |
fallback() |
(state: S) => ComponentFallback | Promise<ComponentFallback> |
What PowerPoint shows. Pure: same state, same fallback. Runs on every state change. |
mount()? |
(el: HTMLElement, ctx: ComponentContext<S>) => void | (() => void) |
|
read()? |
(rows: string[][], stored: S) => S |
A table component’s data lives in its cells, which a PowerPoint user may edit. read folds the cells back into the state; without it the stored state is taken as is. |
EditorMode
Normal view edits slides; Slide Master view edits each master and its layouts.
Import from @reductoai/pptx/editor.
type EditorMode = "slides" | "masters"EditorSelection
What the editor has selected on its current slide.
Import from @reductoai/pptx/editor.
type EditorSelection = { kind: "none" } | { keys: string[]; kind: "objects" } | { anchor: Position; focus: Position; key: string; kind: "text"; story: string } | { anchor: GridCell; focus: GridCell; key: string; kind: "cells" }EditorView
Import from @reductoai/pptx/editor.
| Name | Type | Description |
|---|---|---|
align? |
ParagraphAlign |
The alignment the selected paragraphs share. |
altText? |
AltTextView |
The one selected object’s alt text. |
animation? |
AnimationState |
The selected shapes’ animation, as the Animations tab shows it. |
animations? |
AnimationItem[] |
The current slide’s main sequence in play order, as the Animation Pane lists it. |
background? |
BackgroundView |
The current page’s background, as Format Background shows it. |
canGroup |
boolean |
|
canPaste |
boolean |
Whether paste has shapes to add. |
canRedo |
boolean |
|
canUndo |
boolean |
|
canUngroup |
boolean |
|
caret? |
Rect |
Text mode: the caret, in its line’s upright frame (rot turns it). |
chart? |
ChartView |
The selected chart. |
columns? |
TextColumns |
The text columns and their spacing the selected shapes share. |
comments |
SlideComment[] |
The current slide’s comment threads, oldest first. |
components |
ComponentInfo[] |
Custom components across the presentation, in slide and shape-tree order. |
design? |
string |
The id of the master the current slide follows. |
designs |
DesignView[] |
Design > Themes, This Presentation: each master with its theme’s name. |
direction? |
TextDirection |
The Text Direction the selected shapes share. |
gridSpacing |
number |
The grid’s spacing in points, from the view properties. |
guides |
GuideView[] |
The page’s drawing guides, in points from the top or left edge; its layout’s and master’s are locked. |
ir |
LayoutDocument |
Every slide, one page each; a page is replaced when its slide changes. |
layouts |
LayoutChoice[] |
Every slide layout, master by master. |
list? |
ListState |
The bullet or number the selected paragraphs show, and whether their level can move. |
markers |
LayoutLine[] |
Bullets of the edited story’s empty paragraphs; PowerPoint shows them only in edit mode. Painted like prompts. |
masterPages? |
MasterPage[] |
Slide Master view: what each page is. |
mode |
EditorMode |
|
notes |
string |
The current slide’s speaker notes; “” in Slide Master view. |
objects |
SlideObject[] |
The current slide’s shapes, back to front. |
painter? |
PainterState |
Format Painter holds a format; the host paints it on the next selection. Esc drops it. |
picture? |
PictureView |
The one selected picture’s crop and transparency. |
presenting |
boolean |
A slide show is running (present). |
prompts |
LayoutLine[] |
The prompts of the slide’s empty placeholders (“Click to add title”), laid out like their text. A host paints them over the slide; they are not part of it, so thumbnails leave them out. |
revision |
number |
Bumped on every change to the document. |
sections |
SectionView[] |
The deck’s sections in order; empty when it has none or in Slide Master view. |
selection |
EditorSelection |
|
selectionRects |
Rect[] |
|
shapeStyle? |
ShapeStyleState |
The fill and outline the selected shapes share, resolved through their style and theme. |
slide |
number |
|
slides |
SlideMeta[] |
Per slide, in deck order; empty in Slide Master view. |
slideSize |
{ height: number; width: number } |
The slide size in points. |
snapToGrid |
boolean |
Grid and Guides > Snap objects to grid. |
spacing? |
ParagraphSpacing |
The line spacing and space before and after the selected paragraphs share. |
table? |
TableView |
The table the selection is in. |
textBox? |
Partial<TextBoxOptions> |
The Format Shape > Text Box options the selected shapes share; one they differ on is absent. |
theme |
ThemeView |
The colour and font schemes of the current page’s master theme, as Design > Colors and Fonts mark them. |
themeColors |
string[] |
The current slide’s theme as #RRGGBB, one per THEME_PALETTE column: what a ShapeColor theme colour paints. |
transition? |
TransitionState |
The current slide’s transition, as the Transitions tab shows it; absent in Slide Master view. |
verticalAlign? |
TextAnchor |
Where the text sits in the selected shapes or cells, when they share it. |
Keybinding
Import from @reductoai/pptx-editor.
| Name | Type | Description |
|---|---|---|
args? |
unknown |
|
command |
string |
“-format.bold” removes the earlier bindings of that command (of key only, when given). |
hidden? |
boolean |
Works, but is not shown or offered as the command’s key. |
key? |
string |
“mod+shift+k”; a chord is two presses: “mod+k mod+c”. |
platform? |
Platform |
|
when? |
string |
KeybindingStore
Not exported by name. You get it from the API.
| Name | Type | Description |
|---|---|---|
load() |
() => UserKeybindings | Promise<UserKeybindings | null> | null |
|
save() |
(value: UserKeybindings) => void | Promise<void> |
|
subscribe()? |
(listener: (value: UserKeybindings | null) => void) => () => void |
Changes made elsewhere: another tab, another device. |
PptxCommand
Every edit is one of these, so a test, a script and the UI drive the editor the same way. Points are page hmm on the current slide.
Import from @reductoai/pptx/editor.
type PptxCommand = { slide: number; type: "goToSlide" } | { keys: string[]; type: "select" } | { extend?: boolean; type: "click"; x: number; y: number } | { type: "doubleClick"; x: number; y: number } | { at?: "start" | "end" | { x: number; y: number }; key: string; story?: string; type: "editText" } | { type: "escape" } | { frames: ({ key: string } & Frame)[]; type: "setFrames" } | { dx: number; dy: number; type: "nudge" } | { type: "deleteObjects" } | { frame: Frame; shape: GeometricShapeType; type: "addShape" } | { frame: Frame; type: "addLine" } & LineSpec | { type: "addFreeform" } & FreeformSpec | { frame: Frame; text?: string; type: "addTextBox" } | { at?: { x: number; y: number }; bytes: Uint8Array; size?: { height: number; width: number }; svg?: Uint8Array; type: "addPicture" } | { at?: { x: number; y: number }; bytes: Uint8Array; file?: Blob; poster: Uint8Array; size?: { height: number; width: number }; type: "addMedia" } | { type: "group" } | { type: "ungroup" } | { position: "BringToFront" | "SendToBack" | "BringForward" | "SendBackward"; type: "zOrder" } | { edge: AlignEdge; to?: ArrangeScope; type: "alignObjects" } | { by: number; type: "rotateObjects" } | { axis: DistributeAxis; type: "flipObjects" } | { color: ShapeColor | null; type: "shapeFill" } | { direction: GradientDirection; type: "shapeGradient"; variation: GradientVariation } | { type: "shapeGradient"; variation: null } | { edit?: GradientEdit; type: "shapeGradientFill" } | { bytes: Uint8Array; type: "shapePictureFill" } | { set: OutlinePatch; type: "shapeOutline" } | { axis: DistributeAxis; to?: ArrangeScope; type: "distributeObjects" } | { text: string; type: "insertText" } | { runs: PastedRun[]; type: "insertRuns" } | { code: number; font: string; type: "insertSymbol" } | { by?: DeleteUnit; type: "deleteBackward" } | { by?: DeleteUnit; type: "deleteForward" } | { extend?: boolean; move: CaretMove; type: "moveCaret" } | { extend?: boolean; type: "setCaret"; x: number; y: number } | { type: "selectAll" } | { end: number; start: number; story: string; type: "selectText" } | { format: TextFormat; type: "format" } | { type: "clearFormatting" } | { case: TextCase; type: "changeCase" } | { align: ParagraphAlign; type: "align" } | { kind: ListKind; type: "toggleList" } | { marker: ListMarker | null; type: "setList" } | { crop: CropInsets; type: "cropPicture" } | { aspect: PictureAspect; type: "pictureAspect" } | { mode: "fill" | "fit"; type: "pictureFit" } | { shape: GeometricShapeType; type: "changeShape" } | { type: "pictureTransparency"; value: number } | { recolor: PictureRecolor; type: "pictureRecolor" } | { bytes: Uint8Array; type: "changePicture" } | { set: ListFormat; type: "listFormat" } | { image: Uint8Array; type: "listPicture" } | { by: 1 | -1; type: "listLevel" } | { spacing: ParagraphSpacing; type: "paragraphSpacing" } | { anchor: TextAnchor; type: "verticalAlign" } | { direction: TextDirection; type: "textDirection" } | { count: number; spacing?: number; type: "textColumns" } | { options: Partial<TextBoxOptions>; type: "textBox" } | { type: "copy" } | { type: "cut" } | { type: "paste" } | { type: "duplicate" } | { after?: number; layout?: string; type: "addSlide" } | { layout: string; slides?: number[]; type: "setLayout" } | { slides?: number[]; type: "resetSlide" } | { slide?: number; type: "duplicateSlide" } | { slide?: number; type: "deleteSlide" } | { from: number; to: number; type: "moveSlide" } | { anchor: GridCell; focus: GridCell; key: string; type: "selectCells" } | { back?: boolean; type: "tab" } | { cols: number; frame?: Frame; rows: number; type: "addTable" } | { type: "tableInsert"; where: "above" | "below" | "left" | "right" } | { type: "tableDelete"; what: "rows" | "columns" | "table" } | { type: "mergeCells" } | { cols: number; rows: number; type: "splitCell" } | { color: string | null; type: "cellFill" } | { preset: BorderPreset; type: "cellBorders" } | { options: Partial<TableOptions>; type: "tableOptions" } | { id: string | null; type: "tableStyle" } | { margins: Partial<CellMargins>; type: "cellMargins" } | { settings: LinkSettings; type: "link" } | { type: "removeLink" } | { hidden: boolean; keys?: string[]; type: "hideObjects" } | { key: string; name: string; type: "renameObject" } | { end: ConnectorEnd; key: string; to: { key: string; site: number }; type: "glueConnector" } | { all?: boolean; settings: HeaderFooterSettings; slides?: number[]; type: "headerFooter" } | { height: number; scale?: SlideSizeScale; type: "slideSize"; width: number } | { scheme: ThemeColorSet; type: "themeColors" } | { scheme: ThemeFontSet; type: "themeFonts" } | { from: string; to: string; type: "replaceFont" } | { name?: string; slides?: number[]; template: Uint8Array | typeof OFFICE_THEME; type: "applyTemplate" } | { design: string; slides?: number[]; type: "applyDesign" } | { all?: boolean; fill: BackgroundFill; slides?: number[]; type: "slideBackground" } | { hidden: boolean; slides?: number[]; type: "backgroundGraphics" } | { preset: number | null; type: "shapeShadow" } | { orientation: GuideOrientation; position?: number; type: "addGuide" } | { id: number; position: number; type: "moveGuide" } | { id: number; type: "deleteGuide" } | { type: "centerGuides" } | { color: string; id: number; type: "guideColor" } | { snapToGrid?: boolean; spacing?: number; type: "gridSettings" } | { kind: EffectKind; preset: number | null; type: "shapeEffect" } | { type: "altText" } & AltTextPatch | { pen: Partial<TablePen>; type: "tablePen" } | { brush?: boolean; sticky?: boolean; type: "formatPainter" } | { type: "paintFormat" } | { type: "cancelFormatPainter" } | { axis: "col" | "row"; delta: number; edge: number; key: string; type: "resizeTrack" } | { axis: "col" | "row"; type: "distributeTracks" } | { axis: "col" | "row"; size: number; type: "trackSize" } | { mode: EditorMode; type: "setMode" } | { group?: string; slide?: number; text: string; type: "setNotes" } | { on: boolean; slide?: number; type: "present" } | { hidden: boolean; slide?: number; type: "hideSlide" } | { effect: TransitionEffect | "none"; option?: string; slides?: number[]; type: "transition" } | { slides?: number[]; type: "transitionTiming" } & TransitionTiming | { type: "applyTransitionToAll" } | { add?: boolean; effect: AnimationEffect | "none"; type: "animation" } | { option: string; type: "animationOption" } | { build: AnimationBuild; type: "animationBuild" } | { type: "animationTiming" } & AnimationTiming | { by: -1 | 1; type: "moveAnimation" } | { before?: number; name: string; type: "addSection" } | { index: number; name: string; type: "renameSection" } | { index: number; type: "removeSection"; withSlides?: boolean } | { from: number; to: number; type: "moveSection" } | { author: CommentAuthor; cell?: GridCell; key?: string; range?: CommentSpanRange; slide?: number; text: string; type: "addComment" } | { author: CommentAuthor; id: string; slide?: number; text: string; type: "replyComment" } | { id: string; slide?: number; text: string; type: "editComment" } | { id: string; slide?: number; type: "deleteComment" } | { id: string; resolved: boolean; slide?: number; type: "resolveComment" } | { scope: "slide" | "deck"; slide?: number; type: "deleteComments" } | { chartType: string; frame?: Frame; type: "addChart" } | { categories: string[]; group?: string; series: ChartSeriesData[]; type: "chartData" } | { chartType: string; type: "chartType" } | { group?: string; title: string | null; type: "chartTitle" } | { caches: ChartRefCache[]; group?: string; source?: ChartSource; type: "chartWorkbook"; visibleOnly?: boolean; workbook: Uint8Array } | { empty: ChartEmptyCells; type: "chartEmptyCells" } | { position: ChartLegend; type: "chartLegend" } | { on: boolean; type: "chartLabels" } | { group?: string; set: ChartDesignPatch; type: "chartDesign" } | { edit: ChartSeriesEdit; type: "chartSeries" } | { part: string; type: "chartPart" } | { group?: string; part?: string; set: ChartFormatPatch; type: "chartFormat" } | { type: "undo" } | { type: "redo" } | ComponentCommandUserKeybindings
Not exported by name. You get it from the API.
| Name | Type | Description |
|---|---|---|
bindings |
Keybinding[] |
|
version |
1 |