Important changes to Tiny Cloud pricing > Find out more

NOTE: TinyMCE 5 reached End of Support in April 2023. No more bug fixes, security updates, or new features will be introduced to TinyMCE 5. We recommend you upgrade to TinyMCE 6 or consider TinyMCE 5 Long Term Support (LTS) if you need more time.

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
remove() Removes any annotations from the current selection that match the 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)

remove

remove(name:String)

Removes any annotations from the current selection that match the name

Parameters
  • name (String) - the name of the annotation to remove

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.