WordPress/wp-includes/js/tinymce/plugins/wplink/plugin.min.js
Andrew Ozz c6afe2dd3e TinyMCE wpView:
- 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
2014-07-16 00:10:17 +00:00

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})});