TinyMCE 5 webinar: Q1 review, migration tips, roadmap —  Register today
TinyMCE 5 webinar : Q1 review, migration tips, roadmap

tinymce.Annotator

This is the annotator api.

Methods

name summary defined by
annotate() Applies the annotation at the current selection using data tinymce.Annotator
annotationChanged() Executes the specified callback when the current selection matches the annotation or not. tinymce.Annotator
getAll() Retrieve all the annotations for a given name tinymce.Annotator
register() Registers a specific annotator by name tinymce.Annotator

Methods

annotate

annotate(name:String, data:Object)

Applies the annotation at the current selection using data

Parameters
  • name (String) - the name of the annotation to apply
  • data (Object) - information to pass through to this particular annotation

annotationChanged

annotationChanged(name:String, callback:function)

Executes the specified callback when the current selection matches the annotation or not.

Parameters
  • name (String) - Name of annotation to listen for
  • callback (function) - Calback with (state, name, and data) fired when the annotation at the cursor changes. If state if false, data will not be provided.

getAll

getAll(name:String):Object

Retrieve all the annotations for a given name

Parameters
  • name (String) - the name of the annotations to retrieve
Return value
  • Object - an index of annotations from uid => DOM nodes

register

register(name:String, settings:Object)

Registers a specific annotator by name

Parameters
  • name (String) - the name of the annotation
  • settings (Object) - settings for the annotation (e.g. decorate)

Can't find what you're looking for? Let us know.

Except as otherwise noted, the content of this page is licensed under the Creative Commons BY-NC-SA 3.0 License, and code samples are licensed under the Apache 2.0 License.