WordPress/wp-includes/js/tinymce/plugins/wplink/plugin.min.js

1 line
750 B
JavaScript

tinymce.PluginManager.add("wplink",function(a){a.addCommand("WP_Link",function(){window.wpLink&&window.wpLink.open(a.id)}),a.addShortcut("Alt+Shift+A","","WP_Link"),a.addShortcut("Meta+K","","WP_Link"),a.addButton("link",{icon:"link",tooltip:"Insert/edit link",cmd:"WP_Link",stateSelector:"a[href]"}),a.addButton("unlink",{icon:"unlink",tooltip:"Remove link",cmd:"unlink"}),a.addMenuItem("link",{icon:"link",text:"Insert/edit link",cmd:"WP_Link",stateSelector:"a[href]",context:"insert",prependToContext:!0}),a.on("pastepreprocess",function(b){var c=b.content;a.selection.isCollapsed()||(c=c.replace(/<[^>]+>/g,""),c=tinymce.trim(c),/^(?:https?:)?\/\/\S+$/i.test(c)&&(a.execCommand("mceInsertLink",!1,{href:a.dom.decode(c)}),b.preventDefault()))})});