wp/wp-includes/js/tinymce/plugins/wplink/editor_plugin_src.js
changeset 0 d970ebf37754
equal deleted inserted replaced
-1:000000000000 0:d970ebf37754
       
     1 (function() {
       
     2 	tinymce.create('tinymce.plugins.wpLink', {
       
     3 		/**
       
     4 		 * Initializes the plugin, this will be executed after the plugin has been created.
       
     5 		 * This call is done before the editor instance has finished its initialization so use the onInit event
       
     6 		 * of the editor instance to intercept that event.
       
     7 		 *
       
     8 		 * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
       
     9 		 * @param {string} url Absolute URL to where the plugin is located.
       
    10 		 */
       
    11 		init : function(ed, url) {
       
    12 			var disabled = true;
       
    13 
       
    14 			// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
       
    15 			ed.addCommand('WP_Link', function() {
       
    16 				if ( disabled )
       
    17 					return;
       
    18 				ed.windowManager.open({
       
    19 					id : 'wp-link',
       
    20 					width : 480,
       
    21 					height : "auto",
       
    22 					wpDialog : true,
       
    23 					title : ed.getLang('advlink.link_desc')
       
    24 				}, {
       
    25 					plugin_url : url // Plugin absolute URL
       
    26 				});
       
    27 			});
       
    28 
       
    29 			// Register example button
       
    30 			ed.addButton('link', {
       
    31 				title : 'advanced.link_desc',
       
    32 				cmd : 'WP_Link'
       
    33 			});
       
    34 
       
    35 			ed.onNodeChange.add(function(ed, cm, n, co) {
       
    36 				disabled = co && n.nodeName != 'A';
       
    37 			});
       
    38 		},
       
    39 		/**
       
    40 		 * Returns information about the plugin as a name/value array.
       
    41 		 * The current keys are longname, author, authorurl, infourl and version.
       
    42 		 *
       
    43 		 * @return {Object} Name/value array containing information about the plugin.
       
    44 		 */
       
    45 		getInfo : function() {
       
    46 			return {
       
    47 				longname : 'WordPress Link Dialog',
       
    48 				author : 'WordPress',
       
    49 				authorurl : 'http://wordpress.org',
       
    50 				infourl : '',
       
    51 				version : "1.0"
       
    52 			};
       
    53 		}
       
    54 	});
       
    55 
       
    56 	// Register plugin
       
    57 	tinymce.PluginManager.add('wplink', tinymce.plugins.wpLink);
       
    58 })();
       
    59