web api interface
EditContext
Limited availability
The EditContext interface represents the text edit context of an element that was made editable by using the EditContext API.
The EditContext API can be used to build rich text editors on the web that support advanced text input experiences, such as Input Method Editor (IME) composition, emoji picker, or any other platform-specific editing-related UI surfaces.
Constructor
EditContext()Experimental- : Returns a new
EditContextinstance.
- : Returns a new
Instance properties
textRead only Experimental- : The editable content of the element.
selectionStartRead only Experimental- : The offset, within the editable text content, of the start of the current selection.
selectionEndRead only Experimental- : The offset, within the editable text content, of the end of the current selection.
characterBoundsRangeStartRead only Experimental- : The offset, within the editable text content, where the last IME composition started.
Instance methods
EditContext is based on the EventTarget interface, and includes its methods.
attachedElements()Experimental- : An
Arraycontaining oneHTMLElementobject which is the element that’s associated with theEditContextobject.
- : An
characterBounds()Experimental- : The list of bounding rectangles for the characters in the
EditContextobject.
- : The list of bounding rectangles for the characters in the
updateText()Experimental- : Updates the internal text content of the
EditContextobject.
- : Updates the internal text content of the
updateSelection()Experimental- : Updates the internal state of the selection within the editable text context.
updateControlBounds()Experimental- : Informs the operating system about the position and size of the editable text region.
updateSelectionBounds()Experimental- : Informs the operating system about the position and size of the selection within the editable text region.
updateCharacterBounds()Experimental- : Informs the operating system about the position and size of the characters in the
EditContextobject.
- : Informs the operating system about the position and size of the characters in the
Events
textupdateExperimental- : Fired when the user has made changes to the text or selection.
textformatupdateExperimental- : Fired when composition using an Input Method Editor (IME) window is happening and the IME decides that certain parts of the text being composed should be formatted differently to indicate the composition state.
characterboundsupdateExperimental- : Fired when the operating system needs to know the size and position of certain characters within the editable text region of the
EditContextobject, in order to display an IME window.
- : Fired when the operating system needs to know the size and position of certain characters within the editable text region of the
compositionstartExperimental- : Fired when composition using an IME window is starting.
compositionendExperimental- : Fired when composition using an IME window is ending.
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.