# EditorContext

Start from base library version 2.7.0. Please remaining backward compatible.

EditorContext Example, you can use the wx.createSelectorQuery Get.

EditorContext adopt id With one. editor Component binding, the corresponding editor Component.

# method

# EditorContext.format(string name, string value)

Modify Style

# EditorContext.insertDivider()

Insert split line

# EditorContext.insertImage(Object object)

Insert picture.

When the address is a temporary file, the contents of the editor html format obtained in the Tag Add Properties data-local,delta Pictures in Format Content attributes Attribute increase data-local Field, which is the temporary file address that was passed in.

The developer can choose to upload the image to the server during the submission phase, obtain the network address and replace it. Replace the html content with the of src Value, for the delta Content should be replaced insert { image: abc } Value.

# EditorContext.insertText(Object object)

Overwrite the current selection, set a text

# EditorContext.setContents(Object object)

Initializes editor content, only delta takes effect when html and delta exist together

# EditorContext.getContents()

Get editor content

# EditorContext.clear()

Clear editor content

# EditorContext.removeFormat()

Clear the style of the current selection

# EditorContext.undo()

Revoke

# EditorContext.redo()

restore

# EditorContext.blur()

The editor is out of focus and the keyboard is retracted.

# EditorContext.scrollIntoView()

Scrolls the editor cursor to the viewable area of the window.

# EditorContext.getSelectionText()

Gets the plain text content in the selected area of the editor. Returns empty when the editor is out of focus or an interval is not selected.