[ Index ]

WordPress Cross Reference

title

Body

[close]

/wp-includes/js/tinymce/plugins/wplink/ -> editor_plugin_src.js (source)

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


Generated: Tue Mar 25 01:41:18 2014 WordPress honlapkészítés: online1.hu