You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3.2 KiB

Get Data Command

How to Use

import Editor from "@hufe921/canvas-editor"

const instance = new Editor(container, <IElement[]>data, options)
const value = instance.command.commandName()

getValue

Feature: Get the current document value

Usage:

const {
  version: string;
  width: number;
  height: number;
  margins: IMargin;
  header?: IHeader;
  watermark?: IWatermark;
  data: IEditorData;
} = instance.command.getValue(options?: IGetValueOption)

getImage

Feature: Gets the base64 string of the current page image

Usage:

const base64StringList = await instance.command.getImage(option?: IGetImageOption)

getOptions

Feature: Get editor options

Usage:

const editorOption = await instance.command.getOptions()

getWordCount

Feature: Get document word count

Usage:

const wordCount = await instance.command.getWordCount()

getRange

Feature: Get range

Usage:

const range = instance.command.getRange()

getRangeText

Feature: Get range text

Usage:

const rangeText = instance.command.getRangeText()

getRangeContext

Feature: Get range context

Usage:

const rangeContext = instance.command.getRangeContext()

getRangeRow

Feature: Get range row element list

Usage:

const rowElementList = instance.command.getRangeRow()

getKeywordRangeList

Feature: Get range list by keyword

Usage:

const rangeList = instance.command.getKeywordRangeList()

getRangeParagraph

Feature: Get range paragraph element list

Usage:

const paragraphElementList = instance.command.getRangeParagraph()

getPaperMargin

Feature: Gets the margins

Usage:

const [top: number, right: number, bottom: number, left: number] =
  instance.command.getPaperMargin()

getSearchNavigateInfo

Feature: Get search navigation information

Usage:

const {
  index: number;
  count: number;
} = instance.command.getSearchNavigateInfo()

getCatalog

Feature: Get directory

Usage:

const catalog = await instance.command.getCatalog()

getHTML

Feature: Get HTML

Usage:

const {
  header: string
  main: string
  footer: string
} = await instance.command.getHTML()

getText

Feature: Get text

Usage:

const {
  header: string
  main: string
  footer: string
} = await instance.command.getText()

getLocale

Feature: Get current locale

Usage:

const locale = await instance.command.getLocale()

getGroupIds

Feature: Get all group ids

Usage:

const groupIds = await instance.command.getGroupIds()

getControlValue

Feature: Get control value

Usage:

const {
  value: string | null
  innerText: string | null
} = await instance.command.getControlValue(payload: IGetControlValueOption)

getControlList

Feature: Get control list

Usage:

const controlList = await instance.command.getControlList()

getContainer

Feature: Get editor container

Usage:

const container = await instance.command.getContainer()