source: trunk/admin/inc/ckeditor/_source/plugins/templates/plugin.js@ 384

Last change on this file since 384 was 239, checked in by luc, 9 years ago

Admin: correzione visulaizzazione immissione dati spoglio per Chrome e Safari - Aggiornamento dell'editor da FCKeditor a CKeditor , accessibili anche a Chrome e Safari.

  • Property svn:executable set to *
File size: 2.3 KB
Line 
1/*
2Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
3For 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, 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 }
53
54 if ( toLoad.length )
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
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 */
84CKEDITOR.config.templates_files =
85 [
86 CKEDITOR.getUrl(
87 '_source/' + // @Packager.RemoveLine
88 'plugins/templates/templates/default.js' )
89 ];
90
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 */
99CKEDITOR.config.templates_replaceContent = true;
Note: See TracBrowser for help on using the repository browser.