Execute Command
How to Use
import Editor from "@hufe921/canvas-editor"
const instance = new Editor(container, <IElement[]>data, options)
instance.command.commandName()
executeMode
Feature: Switch editor mode (Edit, Clean, Read only)
Usage:
instance.command.executeMode(editorMode: EditorMode)
executeCut
Feature: Cut
Usage:
instance.command.executeCut()
executeCopy
Feature: Copy
Usage:
instance.command.executeCopy(payload?: ICopyOption)
executePaste
Feature: Paste
Usage:
instance.command.executePaste(payload?: IPasteOption)
executeSelectAll
Feature: Select all
Usage:
instance.command.executeSelectAll()
executeBackspace
Feature: Forward delete
Usage:
instance.command.executeBackspace()
executeSetRange
Feature: Set range
Usage:
instance.command.executeSetRange(
startIndex: number,
endIndex: number,
tableId?: string,
startTdIndex?: number,
endTdIndex?: number,
startTrIndex?: number,
endTrIndex?: number
)
executeReplaceRange
Feature: Replace range
Usage:
instance.command.executeReplaceRange(range: IRange)
executeSetPositionContext
Feature: Set position context
Usage:
instance.command.executeSetPositionContext(range: IRange)
executeForceUpdate
Feature: force update editor
Usage:
instance.command.executeForceUpdate(options?: IForceUpdateOption)
executeBlur
Feature: Set editor blur
Usage:
instance.command.executeBlur()
executeUndo
Feature: Undo
Usage:
instance.command.executeUndo()
executeRedo
Feature: Redo
Usage:
instance.command.executeRedo()
executePainter
Feature: Format Brush - Copy style
Usage:
instance.command.executePainter()
executeApplyPainterStyle
Feature: Format brush - Apply style
Usage:
instance.command.executeApplyPainterStyle()
executeFormat
Feature: Clear format
Usage:
instance.command.executeFormat(options?: IRichtextOption)
executeFont
Feature: Set font
Usage:
instance.command.executeFont(font: string, options?: IRichtextOption)
executeSize
Feature: Set font size
Usage:
instance.command.executeSize(size: number, options?: IRichtextOption)
executeSizeAdd
Feature: Increase the font size
Usage:
instance.command.executeSizeAdd(options?: IRichtextOption)
executeSizeMinus
Feature: Reduce the font size
Usage:
instance.command.executeSizeMinus(options?: IRichtextOption)
executeBold
Feature: Bold
Usage:
instance.command.executeBold(options?: IRichtextOption)
executeItalic
Feature: Italic
Usage:
instance.command.executeItalic(options?: IRichtextOption)
executeUnderline
Feature: Underline
Usage:
instance.command.executeUnderline(textDecoration?: ITextDecoration, options?: IRichtextOption)
executeStrikeout
Feature: Strikeout
Usage:
instance.command.executeStrikeout(options?: IRichtextOption)
executeSuperscript
Feature: Superscript
Usage:
instance.command.executeSuperscript(options?: IRichtextOption)
executeSubscript
Feature: Subscript
Usage:
instance.command.executeSubscript(options?: IRichtextOption)
executeColor
Feature: Font color
Usage:
instance.command.executeColor(color: string | null, options?: IRichtextOption)
executeHighlight
Feature: Highlight
Usage:
instance.command.executeHighlight(color: string | null, options?: IRichtextOption)
executeTitle
Feature: Set title
Usage:
instance.command.executeTitle(TitleLevel | null)
executeList
Feature: Set list
Usage:
instance.command.executeList(listType: ListType | null, listStyle?: ListStyle)
executeRowFlex
Feature: Line alignment
Usage:
instance.command.executeRowFlex(rowFlex: RowFlex)
executeRowMargin
Feature: Line spacing
Usage:
instance.command.executeRowMargin(rowMargin: number)
executeInsertTable
Feature: Insert table
Usage:
instance.command.executeInsertTable(row: number, col: number)
executeInsertTableTopRow
Feature: Insert a row up
Usage:
instance.command.executeInsertTableTopRow()
executeInsertTableBottomRow
Feature: Insert a row down
Usage:
instance.command.executeInsertTableBottomRow()
executeInsertTableLeftCol
Feature: Insert a column to the left
Usage:
instance.command.executeInsertTableLeftCol()
executeInsertTableRightCol
Feature: Insert a column to the right
Usage:
instance.command.executeInsertTableRightCol()
executeDeleteTableRow
Feature: Deletes the current row
Usage:
instance.command.executeDeleteTableRow()
executeDeleteTableCol
Feature: Delete the current column
Usage:
instance.command.executeDeleteTableCol()
executeDeleteTable
Feature: Delete the table
Usage:
instance.command.executeDeleteTable()
executeMergeTableCell
Feature: Merge tables
Usage:
instance.command.executeMergeTableCell()
executeCancelMergeTableCell
Feature: Cancel the merge form
Usage:
instance.command.executeCancelMergeTableCell()
executeSplitVerticalTableCell
Feature: Split table cell (vertical)
Usage:
instance.command.executeSplitVerticalTableCell()
executeSplitHorizontalTableCell
Feature: Split table cell (horizontal)
Usage:
instance.command.executeSplitHorizontalTableCell()
executeTableTdVerticalAlign
Feature: Table cell vertical alignment
Usage:
instance.command.executeTableTdVerticalAlign(payload: VerticalAlign)
executeTableBorderType
Feature: Table border type
Usage:
instance.command.executeTableBorderType(payload: TableBorder)
executeTableBorderColor
Feature: Table border color
Usage:
instance.command.executeTableBorderColor(payload: string)
executeTableTdBorderType
Feature: Table td border type
Usage:
instance.command.executeTableTdBorderType(payload: TdBorder)
executeTableTdSlashType
Feature: Table td slash type
Usage:
instance.command.executeTableTdSlashType(payload: TdSlash)
executeTableTdBackgroundColor
Feature: Table cell background color
Usage:
instance.command.executeTableTdBackgroundColor(payload: string)
executeTableSelectAll
Feature: Select the entire table
Usage:
instance.command.executeTableSelectAll()
executeImage
Feature: Insert a picture
Usage:
instance.command.executeImage({
id?: string;
width: number;
height: number;
value: string;
imgDisplay?: ImageDisplay;
})
executeHyperlink
Feature: Insert a link
Usage:
instance.command.executeHyperlink({
type: ElementType.HYPERLINK,
value: string,
url: string,
valueList: IElement[]
})
executeDeleteHyperlink
Feature: Delete the link
Usage:
instance.command.executeDeleteHyperlink()
executeCancelHyperlink
Feature: Unlink
Usage:
instance.command.executeCancelHyperlink()
executeEditHyperlink
Feature: Edit the link
Usage:
instance.command.executeEditHyperlink(newUrl: string)
executeSeparator
Feature: Insert a dividing line
Usage:
instance.command.executeSeparator(dashArray: number[])
executePageBreak
Feature: Page breaks
Usage:
instance.command.executePageBreak()
executeAddWatermark
Feature: Add a watermark
Usage:
instance.command.executeAddWatermark({
data: string;
color?: string;
opacity?: number;
size?: number;
font?: string;
})
executeDeleteWatermark
Feature: Remove the watermark
Usage:
instance.command.executeDeleteWatermark()
executeSearch
Feature: 搜索
Usage:
instance.command.executeSearch(keyword: string)
executeSearchNavigatePre
Feature: Search Navigation - Previous
Usage:
instance.command.executeSearchNavigatePre()
executeSearchNavigateNext
Feature: Search Navigation - Next
Usage:
instance.command.executeSearchNavigateNext()
executeReplace
Feature: Search for replacement
Usage:
instance.command.executeReplace(newWord: string, option?: IReplaceOption)
executePrint
Feature: Print
Usage:
instance.command.executePrint()
executeReplaceImageElement
Feature: Replace the picture
Usage:
instance.command.executeReplaceImageElement(newUrl: string)
executeSaveAsImageElement
Feature: Save as picture
Usage:
instance.command.executeSaveAsImageElement()
executeChangeImageDisplay
Feature: Change how image rows are displayed
Usage:
instance.command.executeChangeImageDisplay(element: IElement, display: ImageDisplay)
executePageMode
Feature: Page mode
Usage:
instance.command.executePageMode(pageMode: PageMode)
executePageScale
Feature: Set page scale
Usage:
instance.command.executePageScale(scale: number)
executePageScaleRecovery
Feature: Restore the original zoom factor of the page
Usage:
instance.command.executePageScaleRecovery()
executePageScaleMinus
Feature: Page zoom out
Usage:
instance.command.executePageScaleMinus()
executePageScaleAdd
Feature: Page zoom in
Usage:
instance.command.executePageScaleAdd()
executePaperSize
Feature: Set the paper size
Usage:
instance.command.executePaperSize(width: number, height: number)
executePaperDirection
Feature: Set the paper orientation
Usage:
instance.command.executePaperDirection(paperDirection: PaperDirection)
executeSetPaperMargin
Feature: Set the paper margins
Usage:
instance.command.executeSetPaperMargin([top: number, right: number, bottom: number, left: number])
executeSetMainBadge
Feature: Set main badge
Usage:
instance.command.executeSetMainBadge(payload: IBadge | null)
executeSetAreaBadge
Feature: Set area badge
Usage:
instance.command.executeSetAreaBadge(payload: IAreaBadge[])
executeInsertElementList
Feature: Insert an element
Usage:
instance.command.executeInsertElementList(elementList: IElement[], options?: IInsertElementListOption)
executeAppendElementList
Feature: Append elements
Usage:
instance.command.executeAppendElementList(elementList: IElement[], options?: IAppendElementListOption)
executeUpdateElementById
Feature: Update element by id
Usage:
instance.command.executeUpdateElementById(payload: IUpdateElementByIdOption)
executeDeleteElementById
Feature: Delete element by id
Usage:
instance.command.executeDeleteElementById(payload: IDeleteElementByIdOption)
executeSetValue
Feature: Set the editor data
Usage:
instance.command.executeSetValue(payload: Partial<IEditorData>, options?: ISetValueOption)
executeRemoveControl
Feature: Delete the control
Usage:
instance.command.executeRemoveControl(payload?: IRemoveControlOption)
executeSetLocale
Feature: Set local language
Usage:
instance.command.executeSetLocale(locale: string)
executeLocationCatalog
Feature: Locate directory location
Usage:
instance.command.executeLocationCatalog(titleId: string)
executeWordTool
Feature: Word Tool (Delete blank lines and leading Spaces)
Usage:
instance.command.executeWordTool()
executeSetHTML
Feature: Set the editor HTML data
Usage:
instance.command.executeSetHTML(payload: Partial<IEditorHTML)
executeSetGroup
Feature: Set group
Usage:
instance.command.executeSetGroup()
executeDeleteGroup
Feature: Delete group
Usage:
instance.command.executeDeleteGroup(groupId: string)
executeLocationGroup
Feature: Positioning group position
Usage:
instance.command.executeLocationGroup(groupId: string)
executeSetZone
Feature: Set active zone (header, main, footer)
Usage:
instance.command.executeSetZone(zone: EditorZone)
executeSetControlValue
Feature: Set control value
Usage:
instance.command.executeSetControlValue(payload: ISetControlValueOption)
executeSetControlValueList
Feature: Batch set control value
Usage:
instance.command.executeSetControlValueList(payload: ISetControlValueOption[])
executeSetControlExtension
Feature: Set control extension value
Usage:
instance.command.executeSetControlExtension(payload: ISetControlExtensionOption)
executeSetControlExtensionList
Feature: Batch set control extension value
Usage:
instance.command.executeSetControlExtensionList(payload: ISetControlExtensionOption[])
executeSetControlProperties
Feature: Set control properties
Usage:
instance.command.executeSetControlProperties(payload: ISetControlProperties)
executeSetControlPropertiesList
Feature: Batch set control properties
Usage:
instance.command.executeSetControlPropertiesList(payload: ISetControlProperties[])
executeSetControlHighlight
Feature: Set control highlight (by keyword)
Usage:
instance.command.executeSetControlHighlight(payload: ISetControlHighlightOption)
executeLocationControl
Feature: Positioning and activating control
Usage:
instance.command.executeLocationControl(controlId: string, options?: ILocationControlOption)
executeInsertControl
Feature: Insert control
Usage:
instance.command.executeInsertControl(payload: IElement)
executeUpdateOptions
Feature: Update options
Usage:
instance.command.executeUpdateOptions(payload: IUpdateOption)
executeInsertTitle
Feature: Insert title
Usage:
instance.command.executeInsertTitle(payload: IElement)
executeFocus
Feature: focus
Usage:
instance.command.executeFocus(payload?: IFocusOption)
executeInsertArea
Feature: insert area element
Usage:
const areaId = instance.command.executeInsertArea(payload: IInsertAreaOption)
executeSetAreaProperties
Feature: set area properties
Usage:
instance.command.executeSetAreaProperties(payload: ISetAreaPropertiesOption)
executeLocationArea
Feature: positioning area position
Usage:
instance.command.executeLocationArea(areaId: string)