From f81a107ceec1db8ba629b21bbe9b09946b0c2f46 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Tue, 22 Apr 2014 21:11:14 +0000 Subject: [PATCH] TinyMCE: fix the "active" state of the Link button when an image wrapped in a link is selected, see #27847, for trunk. Built from https://develop.svn.wordpress.org/trunk@28185 git-svn-id: http://core.svn.wordpress.org/trunk@28016 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../js/tinymce/plugins/wplink/plugin.js | 6 ++++-- .../js/tinymce/plugins/wplink/plugin.min.js | 2 +- wp-includes/js/tinymce/wp-tinymce.js.gz | Bin 122941 -> 122946 bytes 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/wp-includes/js/tinymce/plugins/wplink/plugin.js b/wp-includes/js/tinymce/plugins/wplink/plugin.js index 1d6820a12b..d992360b86 100644 --- a/wp-includes/js/tinymce/plugins/wplink/plugin.js +++ b/wp-includes/js/tinymce/plugins/wplink/plugin.js @@ -15,8 +15,10 @@ tinymce.PluginManager.add( 'wplink', function( editor ) { editor.addShortcut( 'ctrl+k', '', 'WP_Link' ); function setState( button, node ) { - button.disabled( editor.selection.isCollapsed() && node.nodeName !== 'A' ); - button.active( node.nodeName === 'A' && ! node.name ); + var parent = editor.dom.getParent( node, 'a' ); + + button.disabled( ( editor.selection.isCollapsed() && ! parent ) || ( parent && ! parent.href ) ); + button.active( parent && parent.href ); } editor.addButton( 'link', { diff --git a/wp-includes/js/tinymce/plugins/wplink/plugin.min.js b/wp-includes/js/tinymce/plugins/wplink/plugin.min.js index af8751d289..dc282b9f3c 100644 --- a/wp-includes/js/tinymce/plugins/wplink/plugin.min.js +++ b/wp-includes/js/tinymce/plugins/wplink/plugin.min.js @@ -1 +1 @@ -tinymce.PluginManager.add("wplink",function(a){function b(b,c){b.disabled(a.selection.isCollapsed()&&"A"!==c.nodeName),b.active("A"===c.nodeName&&!c.name)}var c;a.addCommand("WP_Link",function(){c&&c.disabled()||"undefined"==typeof window.wpLink||window.wpLink.open(a.id)}),a.addShortcut("alt+shift+a","","WP_Link"),a.addShortcut("ctrl+k","","WP_Link"),a.addButton("link",{icon:"link",tooltip:"Insert/edit link",shortcut:"Alt+Shift+A",cmd:"WP_Link",onPostRender:function(){c=this,a.on("nodechange",function(a){b(c,a.element)})}}),a.addButton("unlink",{icon:"unlink",tooltip:"Remove link",cmd:"unlink",onPostRender:function(){var c=this;a.on("nodechange",function(a){b(c,a.element)})}}),a.addMenuItem("link",{icon:"link",text:"Insert link",shortcut:"Alt+Shift+A",cmd:"WP_Link",stateSelector:"a[href]",context:"insert",prependToContext:!0})}); \ No newline at end of file +tinymce.PluginManager.add("wplink",function(a){function b(b,c){var d=a.dom.getParent(c,"a");b.disabled(a.selection.isCollapsed()&&!d||d&&!d.href),b.active(d&&d.href)}var c;a.addCommand("WP_Link",function(){c&&c.disabled()||"undefined"==typeof window.wpLink||window.wpLink.open(a.id)}),a.addShortcut("alt+shift+a","","WP_Link"),a.addShortcut("ctrl+k","","WP_Link"),a.addButton("link",{icon:"link",tooltip:"Insert/edit link",shortcut:"Alt+Shift+A",cmd:"WP_Link",onPostRender:function(){c=this,a.on("nodechange",function(a){b(c,a.element)})}}),a.addButton("unlink",{icon:"unlink",tooltip:"Remove link",cmd:"unlink",onPostRender:function(){var c=this;a.on("nodechange",function(a){b(c,a.element)})}}),a.addMenuItem("link",{icon:"link",text:"Insert link",shortcut:"Alt+Shift+A",cmd:"WP_Link",stateSelector:"a[href]",context:"insert",prependToContext:!0})}); \ No newline at end of file diff --git a/wp-includes/js/tinymce/wp-tinymce.js.gz b/wp-includes/js/tinymce/wp-tinymce.js.gz index 65dced4f3e394dbb71932752e6df315998fb19ae..dc55c90391d10fbe8ef482fa9af2baaeb919dbbe 100644 GIT binary patch delta 1766 zcmV2Y|Ezb=iMCv@TLyiGIj_0kA0&gQmpU3R&?|nKmW}d9jylHVOW; z;7=w)@F#U+@`Twq>R86snQ+0`!D%N)JuPqwY(4C{u|23q}sVXT17#(k{8 z^BOQzME9jm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