TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-29 00:53:15 +01:00
|
|
|
/* global tinymce */
|
|
|
|
tinymce.PluginManager.add( 'wplink', function( editor ) {
|
2014-03-07 04:09:14 +01:00
|
|
|
var linkButton;
|
|
|
|
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-29 00:53:15 +01:00
|
|
|
// Register a command so that it can be invoked by using tinyMCE.activeEditor.execCommand( 'WP_Link' );
|
|
|
|
editor.addCommand( 'WP_Link', function() {
|
2014-03-07 04:09:14 +01:00
|
|
|
if ( ( ! linkButton || ! linkButton.disabled() ) && typeof window.wpLink !== 'undefined' ) {
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-29 00:53:15 +01:00
|
|
|
window.wpLink.open( editor.id );
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-03-07 04:09:14 +01:00
|
|
|
// WP default shortcut
|
|
|
|
editor.addShortcut( 'alt+shift+a', '', 'WP_Link' );
|
|
|
|
// The "de-facto standard" shortcut, see #27305
|
|
|
|
editor.addShortcut( 'ctrl+k', '', 'WP_Link' );
|
|
|
|
|
2014-04-03 22:05:31 +02:00
|
|
|
function setState( button, node ) {
|
2014-04-22 23:11:14 +02:00
|
|
|
var parent = editor.dom.getParent( node, 'a' );
|
|
|
|
|
|
|
|
button.disabled( ( editor.selection.isCollapsed() && ! parent ) || ( parent && ! parent.href ) );
|
|
|
|
button.active( parent && parent.href );
|
2014-04-03 22:05:31 +02:00
|
|
|
}
|
|
|
|
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-29 00:53:15 +01:00
|
|
|
editor.addButton( 'link', {
|
|
|
|
icon: 'link',
|
|
|
|
tooltip: 'Insert/edit link',
|
|
|
|
shortcut: 'Alt+Shift+A',
|
|
|
|
cmd: 'WP_Link',
|
2014-03-07 03:02:13 +01:00
|
|
|
|
|
|
|
onPostRender: function() {
|
2014-03-07 04:09:14 +01:00
|
|
|
linkButton = this;
|
2014-03-07 03:02:13 +01:00
|
|
|
|
|
|
|
editor.on( 'nodechange', function( event ) {
|
2014-04-03 22:05:31 +02:00
|
|
|
setState( linkButton, event.element );
|
2014-03-07 03:02:13 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
editor.addButton( 'unlink', {
|
|
|
|
icon: 'unlink',
|
|
|
|
tooltip: 'Remove link',
|
|
|
|
cmd: 'unlink',
|
2014-04-03 22:05:31 +02:00
|
|
|
|
|
|
|
onPostRender: function() {
|
|
|
|
var unlinkButton = this;
|
|
|
|
|
|
|
|
editor.on( 'nodechange', function( event ) {
|
|
|
|
setState( unlinkButton, event.element );
|
|
|
|
});
|
|
|
|
}
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-29 00:53:15 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
editor.addMenuItem( 'link', {
|
|
|
|
icon: 'link',
|
|
|
|
text: 'Insert link',
|
|
|
|
shortcut: 'Alt+Shift+A',
|
|
|
|
cmd: 'WP_Link',
|
|
|
|
stateSelector: 'a[href]',
|
|
|
|
context: 'insert',
|
|
|
|
prependToContext: true
|
|
|
|
});
|
|
|
|
});
|