wpView: use `data-mce-selected` instead of adding a class to mark a view as selected. This prevents adding an unneeded undo level. Props avryl, fixes #28313

Built from https://develop.svn.wordpress.org/trunk@28684


git-svn-id: http://core.svn.wordpress.org/trunk@28502 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2014-06-06 02:12:14 +00:00
parent d593293556
commit 60e323d911
4 changed files with 9 additions and 10 deletions

View File

@ -73,7 +73,7 @@ tinymce.PluginManager.add( 'wpview', function( editor ) {
deselect(); deselect();
selected = viewNode; selected = viewNode;
dom.addClass( viewNode, 'selected' ); dom.setAttrib( viewNode, 'data-mce-selected', 1 );
clipboard = dom.create( 'div', { clipboard = dom.create( 'div', {
'class': 'wpview-clipboard', 'class': 'wpview-clipboard',
@ -109,7 +109,7 @@ tinymce.PluginManager.add( 'wpview', function( editor ) {
dom.remove( clipboard ); dom.remove( clipboard );
dom.unbind( selected, 'beforedeactivate focusin focusout click mouseup', _stop ); dom.unbind( selected, 'beforedeactivate focusin focusout click mouseup', _stop );
dom.removeClass( selected, 'selected' ); dom.setAttrib( selected, 'data-mce-selected', null );
} }
selected = null; selected = null;

File diff suppressed because one or more lines are too long

View File

@ -231,13 +231,13 @@ audio {
border: 1px solid transparent; border: 1px solid transparent;
} }
.wpview-wrap.selected { .wpview-wrap[data-mce-selected] {
background-color: rgba(0,0,0,0.1); background-color: rgba(0,0,0,0.1);
border-color: rgba(0,0,0,0.3); border-color: rgba(0,0,0,0.3);
} }
.ie8 .wpview-wrap.selected, .ie8 .wpview-wrap[data-mce-selected],
.ie7 .wpview-wrap.selected { .ie7 .wpview-wrap[data-mce-selected] {
background-color: #e5e5e5; background-color: #e5e5e5;
border-color: #777; border-color: #777;
} }
@ -250,7 +250,7 @@ audio {
left: 0; left: 0;
} }
.wpview-wrap.selected .wpview-overlay { .wpview-wrap[data-mce-selected] .wpview-overlay {
display: none; display: none;
} }
@ -262,7 +262,7 @@ audio {
z-index: 100; z-index: 100;
} }
.wpview-wrap.selected .toolbar { .wpview-wrap[data-mce-selected] .toolbar {
display: block; display: block;
} }
@ -310,7 +310,7 @@ audio {
margin: 0; margin: 0;
} }
.selected .wpview-error { .wpview-wrap[data-mce-selected] .wpview-error {
border-color: transparent; border-color: transparent;
} }
@ -328,7 +328,6 @@ audio {
font-family: 'Open Sans', sans-serif; font-family: 'Open Sans', sans-serif;
} }
.wpview-wrap .toolbar div:hover, .wpview-wrap .toolbar div:hover,
#wp-image-toolbar i:hover { #wp-image-toolbar i:hover {
box-shadow: 0 1px 3px rgba(0,0,0,0.8); box-shadow: 0 1px 3px rgba(0,0,0,0.8);