From 9781cdb9a36afed1997d4a08dd14bc17006ccfd6 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Sat, 18 Apr 2015 20:47:04 +0000 Subject: [PATCH] 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 --- src/wp-includes/js/tinymce/plugins/wpview/plugin.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/js/tinymce/plugins/wpview/plugin.js b/src/wp-includes/js/tinymce/plugins/wpview/plugin.js index db9db466fc..19fefd0b62 100644 --- a/src/wp-includes/js/tinymce/plugins/wpview/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wpview/plugin.js @@ -182,11 +182,11 @@ tinymce.PluginManager.add( 'wpview', function( editor ) { return; } - if ( selected ) { - removeView( selected ); - } - if ( ! event.load ) { + if ( selected ) { + removeView( selected ); + } + node = editor.selection.getNode(); 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 $( 'p[data-wpview-marker]', rootNode ).attr( 'data-wpview-marker', null ); + + // Reset the selected node if any + selected = null; } editor.on( 'PreProcess', function( event ) {