Skip to content
This repository has been archived by the owner on Oct 21, 2019. It is now read-only.

Latest commit

 

History

History
36 lines (23 loc) · 1.39 KB

tinymce-dom-domutils.md

File metadata and controls

36 lines (23 loc) · 1.39 KB

TinyMCE dom.DOMUtils

Covers the class of DOM manipulation APIs identified by dom.DOMUtils:

  • tinymce.dom.createFragment()
  • tinymce.dom.addClass()
  • tinymce.dom.removeClass()
  • tinymce.dom.select()
  • etc.

Overview

TinyMCE's dom.DOMUtils provides an API to the DOM within the TinyMCE editor.

It can be accessed globally (tinymce.dom) and also scoped to the active editor (tinymce.activeEditor.dom).

Some methods of object include select() (for selecting an element), createFragment() (for creating a new element), and so on.

Existing Usage

One existing use of dom.DOMUtils is to programmatically manipulate post content:

var innerHTML = '<!-- html-comment -->' + toolbar.element.innerHTML + '<!-- /html-comment -->';
var newEl = editor.dom.createFragment( innerHTML );
editor.dom.replace( newEl, origEl );

Please open a new issue to suggest additional examples of existing usage.

Gutenberg Equivalent

There isn't get an equivalent API in Gutenberg. See these issues for related conversation: