Nation Notes module contributed by Z&H Healthcare.
[openemr.git] / library / custom_template / ckeditor / _source / plugins / templates / plugin.js
blobbfdad5cdcbc3dec87f88671891c0acbf9987dcaa
1 /*
2 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
3 For licensing, see LICENSE.html or http://ckeditor.com/license
4 */
6 (function()
8         CKEDITOR.plugins.add( 'templates',
9                 {
10                         requires : [ 'dialog' ],
12                         init : function( editor )
13                         {
14                                 CKEDITOR.dialog.add( 'templates', CKEDITOR.getUrl( this.path + 'dialogs/templates.js' ) );
16                                 editor.addCommand( 'templates', new CKEDITOR.dialogCommand( 'templates' ) );
18                                 editor.ui.addButton( 'Templates',
19                                         {
20                                                 label : editor.lang.templates.button,
21                                                 command : 'templates'
22                                         });
23                         }
24                 });
26         var templates = {},
27                 loadedTemplatesFiles = {};
29         CKEDITOR.addTemplates = function( name, definition )
30         {
31                 templates[ name ] = definition;
32         };
34         CKEDITOR.getTemplates = function( name )
35         {
36                 return templates[ name ];
37         };
39         CKEDITOR.loadTemplates = function( templateFiles, callback )
40         {
41                 // Holds the templates files to be loaded.
42                 var toLoad = [];
44                 // Look for pending template files to get loaded.
45                 for ( var i = 0, count = templateFiles.length ; i < count ; i++ )
46                 {
47                         if ( !loadedTemplatesFiles[ templateFiles[ i ] ] )
48                         {
49                                 toLoad.push( templateFiles[ i ] );
50                                 loadedTemplatesFiles[ templateFiles[ i ] ] = 1;
51                         }
52                 }
54                 if ( toLoad.length )
55                         CKEDITOR.scriptLoader.load( toLoad, callback );
56                 else
57                         setTimeout( callback, 0 );
58         };
59 })();
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  */
72 /**
73  * The list of templates definition files to load.
74  * @type (String) Array
75  * @default [ 'plugins/templates/templates/default.js' ]
76  * @example
77  * config.templates_files =
78  *     [
79  *         '/editor_templates/site_default.js',
80  *         'http://www.example.com/user_templates.js
81  *     ];
82  *
83  */
84 CKEDITOR.config.templates_files =
85         [
86                 CKEDITOR.getUrl(
87                         '_source/' + // @Packager.RemoveLine
88                         'plugins/templates/templates/default.js' )
89         ];
91 /**
92  * Whether the "Replace actual contents" checkbox is checked by default in the
93  * Templates dialog.
94  * @type Boolean
95  * @default true
96  * @example
97  * config.templates_replaceContent = false;
98  */
99 CKEDITOR.config.templates_replaceContent = true;