[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/libraries/ckeditor/_source/plugins/templates/ -> plugin.js (source)

   1  /*

   2  Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.

   3  For licensing, see LICENSE.html or http://ckeditor.com/license

   4  */
   5  
   6  (function()
   7  {
   8      CKEDITOR.plugins.add( 'templates',
   9          {
  10              requires : [ 'dialog' ],
  11  
  12              init : function( editor )
  13              {
  14                  CKEDITOR.dialog.add( 'templates', CKEDITOR.getUrl( this.path + 'dialogs/templates.js' ) );
  15  
  16                  editor.addCommand( 'templates', new CKEDITOR.dialogCommand( 'templates' ) );
  17  
  18                  editor.ui.addButton( 'Templates',
  19                      {
  20                          label : editor.lang.templates.button,
  21                          command : 'templates'
  22                      });
  23              }
  24          });
  25  
  26      var templates = {},
  27          loadedTemplatesFiles = {};
  28  
  29      CKEDITOR.addTemplates = function( name, definition )
  30      {
  31          templates[ name ] = definition;
  32      };
  33  
  34      CKEDITOR.getTemplates = function( name )
  35      {
  36          return templates[ name ];
  37      };
  38  
  39      CKEDITOR.loadTemplates = function( templateFiles, callback )
  40      {
  41          // Holds the templates files to be loaded.

  42          var toLoad = [];
  43  
  44          // Look for pending template files to get loaded.

  45          for ( var i = 0 ; i < templateFiles.length ; i++ )
  46          {
  47              if ( !loadedTemplatesFiles[ templateFiles[ i ] ] )
  48              {
  49                  toLoad.push( templateFiles[ i ] );
  50                  loadedTemplatesFiles[ templateFiles[ i ] ] = 1;
  51              }
  52          }
  53  
  54          if ( toLoad.length > 0 )
  55              CKEDITOR.scriptLoader.load( toLoad, callback );
  56          else
  57              setTimeout( callback, 0 );
  58      };
  59  })();
  60  
  61  
  62  
  63  /**

  64   * The templates definition set to use. It accepts a list of names separated by

  65   * comma. It must match definitions loaded with the templates_files setting.

  66   * @type String

  67   * @default 'default'

  68   * @example

  69   * config.templates = 'my_templates';

  70   */
  71  CKEDITOR.config.templates = 'default';
  72  
  73  /**

  74   * The list of templates definition files to load.

  75   * @type (String) Array

  76   * @default [ 'plugins/templates/templates/default.js' ]

  77   * @example

  78   * config.templates_files =

  79   *     [

  80   *         '/editor_templates/site_default.js',

  81   *         'http://www.example.com/user_templates.js

  82   *     ];

  83   *

  84   */
  85  CKEDITOR.config.templates_files =
  86      [
  87          CKEDITOR.getUrl(
  88              '_source/' + // @Packager.RemoveLine
  89              'plugins/templates/templates/default.js' )
  90      ];
  91  
  92  /**

  93   * Whether the "Replace actual contents" checkbox is checked by default in the

  94   * Templates dialog.

  95   * @type Boolean

  96   * @default true

  97   * @example

  98   * config.templates_replaceContent = false;

  99   */
 100  CKEDITOR.config.templates_replaceContent = true;


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