TinyMCE wpView:

- Remove selected views when inserting content but not when loading all content.
- Remove the ref. to the selected view node on resetting the views.
Fixes #31998.

git-svn-id: https://develop.svn.wordpress.org/trunk@32140 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2015-04-18 20:47:04 +00:00
parent bf3773dbfb
commit 9781cdb9a3
1 changed files with 7 additions and 4 deletions

View File

@ -182,11 +182,11 @@ tinymce.PluginManager.add( 'wpview', function( editor ) {
return; return;
} }
if ( selected ) {
removeView( selected );
}
if ( ! event.load ) { if ( ! event.load ) {
if ( selected ) {
removeView( selected );
}
node = editor.selection.getNode(); node = editor.selection.getNode();
if ( node && node !== editor.getBody() && /^\s*https?:\/\/\S+\s*$/i.test( event.content ) ) { if ( node && node !== editor.getBody() && /^\s*https?:\/\/\S+\s*$/i.test( event.content ) ) {
@ -361,6 +361,9 @@ tinymce.PluginManager.add( 'wpview', function( editor ) {
// Remove marker attributes // Remove marker attributes
$( 'p[data-wpview-marker]', rootNode ).attr( 'data-wpview-marker', null ); $( 'p[data-wpview-marker]', rootNode ).attr( 'data-wpview-marker', null );
// Reset the selected node if any
selected = null;
} }
editor.on( 'PreProcess', function( event ) { editor.on( 'PreProcess', function( event ) {