mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-07 11:20:28 +01:00
c6afe2dd3e
- Cast off commands targeted to a view except undo, redo, RemoveFormat and mceToggleFormat (bold, italic, etc.). - Disable the link and unlink buttons when a view is selected. Props avryl, see #28595 Built from https://develop.svn.wordpress.org/trunk@29183 git-svn-id: http://core.svn.wordpress.org/trunk@28967 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 line
923 B
JavaScript
1 line
923 B
JavaScript
tinymce.PluginManager.add("wplink",function(a){function b(b,c){var d=a.dom.getParent(c,"a"),e=a.plugins.wpview?a.plugins.wpview.getView:function(){return!1};b.disabled(a.selection.isCollapsed()&&!d||d&&!d.href||e(c)),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})}); |