TinyMCE: wpView improvements: introduce getText() and remove() methods, improved getInstance(), better docs. Props iseulde. See #31412.

git-svn-id: https://develop.svn.wordpress.org/trunk@31559 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2015-02-26 19:31:27 +00:00
parent 21f4857a32
commit 01eb7466ae
2 changed files with 77 additions and 46 deletions

View File

@@ -72,11 +72,9 @@ tinymce.PluginManager.add( 'wpview', function( editor ) {
}
function removeView( view ) {
// TODO: trigger an event to run a clean up function.
// Maybe `jQuery( view ).trigger( 'remove' );`?
editor.undoManager.transact( function() {
handleEnter( view );
editor.dom.remove( view );
wp.mce.views.remove( editor, view );
});
}
@@ -107,7 +105,7 @@ tinymce.PluginManager.add( 'wpview', function( editor ) {
clipboard = dom.create( 'div', {
'class': 'wpview-clipboard',
'contenteditable': 'true'
}, decodeURIComponent( editor.dom.getAttrib( viewNode, 'data-wpview-text' ) ) );
}, wp.mce.views.getText( viewNode ) );
editor.dom.select( '.wpview-body', viewNode )[0].appendChild( clipboard );