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-28 18:53:15 -05:00
|
|
|
/* global tinymce */
|
|
|
|
tinymce.PluginManager.add( 'wplink', function( editor ) {
|
|
|
|
editor.addCommand( 'WP_Link', function() {
|
2015-03-10 22:40:27 -04:00
|
|
|
window.wpLink && window.wpLink.open( editor.id );
|
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-28 18:53:15 -05:00
|
|
|
});
|
|
|
|
|
2014-03-06 22:09:14 -05:00
|
|
|
// WP default shortcut
|
2015-03-10 23:01:27 -04:00
|
|
|
editor.addShortcut( 'Alt+Shift+A', '', 'WP_Link' );
|
2014-03-06 22:09:14 -05:00
|
|
|
// The "de-facto standard" shortcut, see #27305
|
2015-03-10 23:01:27 -04:00
|
|
|
editor.addShortcut( 'Meta+K', '', 'WP_Link' );
|
2014-03-06 22:09:14 -05: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-28 18:53:15 -05:00
|
|
|
editor.addButton( 'link', {
|
|
|
|
icon: 'link',
|
|
|
|
tooltip: 'Insert/edit link',
|
|
|
|
cmd: 'WP_Link',
|
2015-03-10 22:40:27 -04:00
|
|
|
stateSelector: 'a[href]'
|
2014-03-06 21:02:13 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
editor.addButton( 'unlink', {
|
|
|
|
icon: 'unlink',
|
|
|
|
tooltip: 'Remove link',
|
2015-03-10 22:40:27 -04:00
|
|
|
cmd: 'unlink'
|
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-28 18:53:15 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
editor.addMenuItem( 'link', {
|
|
|
|
icon: 'link',
|
2015-04-08 12:59:26 -04:00
|
|
|
text: 'Insert/edit link',
|
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-28 18:53:15 -05:00
|
|
|
cmd: 'WP_Link',
|
|
|
|
stateSelector: 'a[href]',
|
|
|
|
context: 'insert',
|
|
|
|
prependToContext: true
|
|
|
|
});
|
2015-03-09 16:00:27 -04:00
|
|
|
|
|
|
|
editor.on( 'pastepreprocess', function( event ) {
|
2015-06-17 01:05:24 -04:00
|
|
|
var pastedStr = event.content,
|
|
|
|
regExp = /^(?:https?:)?\/\/\S+$/i;
|
2015-03-09 16:00:27 -04:00
|
|
|
|
2015-06-17 01:05:24 -04:00
|
|
|
if ( ! editor.selection.isCollapsed() && ! regExp.test( editor.selection.getContent() ) ) {
|
2015-03-09 16:00:27 -04:00
|
|
|
pastedStr = pastedStr.replace( /<[^>]+>/g, '' );
|
|
|
|
pastedStr = tinymce.trim( pastedStr );
|
|
|
|
|
2015-06-17 01:05:24 -04:00
|
|
|
if ( regExp.test( pastedStr ) ) {
|
2015-03-09 16:00:27 -04:00
|
|
|
editor.execCommand( 'mceInsertLink', false, {
|
|
|
|
href: editor.dom.decode( pastedStr )
|
|
|
|
} );
|
|
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} );
|
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-28 18:53:15 -05:00
|
|
|
});
|