CoreFiles by mySites.guru
plugin.js51 lines, 1,303 bytes, from wordpress-3.9-beta3.zip
Raw History Compare with 3.9-beta2
md5
1b038923f93947032088ca655de175ff
sha1
7171f2036ad3c53982d7263c77271a0ecf60e4e5
sha256
96db61187c9bdcac1728fd29e2de499d79a670b8aed7633706e76b64ee4dc8f5
/* global tinymce */
tinymce.PluginManager.add( 'wplink', function( editor ) {
	var linkButton;
	
	// Register a command so that it can be invoked by using tinyMCE.activeEditor.execCommand( 'WP_Link' );
	editor.addCommand( 'WP_Link', function() {
		if ( ( ! linkButton || ! linkButton.disabled() ) && typeof window.wpLink !== 'undefined' ) {
			window.wpLink.open( editor.id );
		}
	});

	// WP default shortcut
	editor.addShortcut( 'alt+shift+a', '', 'WP_Link' );
	// The "de-facto standard" shortcut, see #27305
	editor.addShortcut( 'ctrl+k', '', 'WP_Link' );

	editor.addButton( 'link', {
		icon: 'link',
		tooltip: 'Insert/edit link',
		shortcut: 'Alt+Shift+A',
		cmd: 'WP_Link',

		onPostRender: function() {
			linkButton = this;

			editor.on( 'nodechange', function( event ) {
				var node = event.element;

				linkButton.disabled( editor.selection.isCollapsed() && node.nodeName !== 'A' );
				linkButton.active( node.nodeName === 'A' && ! node.name );
			});
		}
	});

	editor.addButton( 'unlink', {
		icon: 'unlink',
		tooltip: 'Remove link',
		cmd: 'unlink',
		stateSelector: 'a[href]'
	});

	editor.addMenuItem( 'link', {
		icon: 'link',
		text: 'Insert link',
		shortcut: 'Alt+Shift+A',
		cmd: 'WP_Link',
		stateSelector: 'a[href]',
		context: 'insert',
		prependToContext: true
	});
});

The same content is in 3 releases, WordPress 3.9-beta1 to 3.9-beta3. See them all, or every version of this file.