Contenteditable

Summary

A modern React-compatible contenteditable

This component is fully React-compatible and behaves like a standard controlled input.

getInitialState: function() {
  return {value: '<strong>Hello!</strong>'};
},
handleChange: function(event) {
  this.setState({value: event.target.value});
},
render: function() {
  var value = this.state.value;
  return <Contenteditable type="text" value={value} onChange={this.handleChange} />;
}

Instance Methods

atomicEdit(editingFunction)

perform an editing operation on the Contenteditable If the current selection at the time of running the extension is out of scope, it will be set to the last saved state. This ensures extensions operate on a valid {ExtendedSelection}. Edits made within the editing function will eventually fire _onDOMMutated

Parameters

Argument Description
editingFunction A function to mutate the DOM and {ExtendedSelection}. It gets passed an {EditorAPI} object that contains mutating methods.

results matching ""

    No results matching ""