[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/ckeditor/plugins/linktonode/ -> plugin.js (source)

   1  /*
   2  Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
   3  For licensing, see LICENSE.html or http://ckeditor.com/license
   4  */
   5  CKEDITOR.plugins.add( 'linktonode',
   6  {
   7      init : function( editor )
   8      {
   9          // Add the link and unlink buttons.
  10          editor.addCommand( 'linktonode', new CKEDITOR.dialogCommand( 'linktonode' ) );
  11          editor.ui.addButton( 'LinkToNode',
  12              {
  13                  label : 'Link to node',
  14                  icon : this.path + 'images/linktonode.gif',
  15                  command : 'linktonode'
  16              } );
  17          CKEDITOR.dialog.add( 'linktonode', this.path + 'dialogs/link.js' );
  18  
  19          // If the "menu" plugin is loaded, register the menu items.
  20          if ( editor.addMenuItems )
  21          {
  22              editor.addMenuItems(
  23                  {
  24                      linktomenu :
  25                      {
  26                          label : 'Link to node',
  27                          command : 'linktonode',
  28                          group : 'linktonode',
  29                          order : 1
  30                      }
  31                  });
  32          }
  33  
  34          // If the "contextmenu" plugin is loaded, register the listeners.
  35          if ( editor.contextMenu )
  36          {
  37              editor.contextMenu.addListener( function( element, selection )
  38                  {
  39                      if ( !element )
  40                          return null;
  41  
  42                      var isAnchor = ( element.is( 'img' ) && element.getAttribute( '_cke_real_element_type' ) == 'anchor' );
  43  
  44                      if ( !isAnchor )
  45                      {
  46                          if ( !( element = element.getAscendant( 'a', true ) ) )
  47                              return null;
  48  
  49                          isAnchor = ( element.getAttribute( 'name' ) && !element.getAttribute( 'href' ) );
  50                      }
  51  
  52                      return { linktomenu : CKEDITOR.TRISTATE_OFF };
  53                  });
  54          }
  55      }
  56  } );


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7