/CKEditor/_source/core/config.js

# · JavaScript · 439 lines · 89 code · 32 blank · 318 comment · 0 complexity · c2ea45c7311a94b010b2982f79e46d96 MD5 · raw file

  1. /*
  2. Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
  3. For licensing, see LICENSE.html or http://ckeditor.com/license
  4. */
  5. /**
  6. * @fileOverview Defines the <code>{@link CKEDITOR.config}</code> object that stores the
  7. * default configuration settings.
  8. */
  9. /**
  10. * Used in conjunction with <code>{@link CKEDITOR.config.enterMode}</code>
  11. * and <code>{@link CKEDITOR.config.shiftEnterMode}</code> configuration
  12. * settings to make the editor produce <code>&lt;p&gt;</code> tags when
  13. * using the <em>Enter</em> key.
  14. * @constant
  15. */
  16. CKEDITOR.ENTER_P = 1;
  17. /**
  18. * Used in conjunction with <code>{@link CKEDITOR.config.enterMode}</code>
  19. * and <code>{@link CKEDITOR.config.shiftEnterMode}</code> configuration
  20. * settings to make the editor produce <code>&lt;br&gt;</code> tags when
  21. * using the <em>Enter</em> key.
  22. * @constant
  23. */
  24. CKEDITOR.ENTER_BR = 2;
  25. /**
  26. * Used in conjunction with <code>{@link CKEDITOR.config.enterMode}</code>
  27. * and <code>{@link CKEDITOR.config.shiftEnterMode}</code> configuration
  28. * settings to make the editor produce <code>&lt;div&gt;</code> tags when
  29. * using the <em>Enter</em> key.
  30. * @constant
  31. */
  32. CKEDITOR.ENTER_DIV = 3;
  33. /**
  34. * @namespace Stores default configuration settings. Changes to this object are
  35. * reflected in all editor instances, if not specified otherwise for a particular
  36. * instance.
  37. */
  38. CKEDITOR.config =
  39. {
  40. /**
  41. * The URL path for the custom configuration file to be loaded. If not
  42. * overloaded with inline configuration, it defaults to the <code>config.js</code>
  43. * file present in the root of the CKEditor installation directory.<br /><br />
  44. *
  45. * CKEditor will recursively load custom configuration files defined inside
  46. * other custom configuration files.
  47. * @type String
  48. * @default <code>'<em>&lt;CKEditor folder&gt;</em>/config.js'</code>
  49. * @example
  50. * // Load a specific configuration file.
  51. * CKEDITOR.replace( 'myfield', { customConfig : '/myconfig.js' } );
  52. * @example
  53. * // Do not load any custom configuration file.
  54. * CKEDITOR.replace( 'myfield', { customConfig : '' } );
  55. */
  56. customConfig : 'config.js',
  57. /**
  58. * Whether the replaced element (usually a <code>&lt;textarea&gt;</code>)
  59. * is to be updated automatically when posting the form containing the editor.
  60. * @type Boolean
  61. * @default <code>true</code>
  62. * @example
  63. * config.autoUpdateElement = true;
  64. */
  65. autoUpdateElement : true,
  66. /**
  67. * The base href URL used to resolve relative and absolute URLs in the
  68. * editor content.
  69. * @type String
  70. * @default <code>''</code> (empty)
  71. * @example
  72. * config.baseHref = 'http://www.example.com/path/';
  73. */
  74. baseHref : '',
  75. /**
  76. * The CSS file(s) to be used to apply style to editor contents. It should
  77. * reflect the CSS used in the final pages where the contents are to be
  78. * used.
  79. * @type String|Array
  80. * @default <code>'<em>&lt;CKEditor folder&gt;</em>/contents.css'</code>
  81. * @example
  82. * config.contentsCss = '/css/mysitestyles.css';
  83. * config.contentsCss = ['/css/mysitestyles.css', '/css/anotherfile.css'];
  84. */
  85. contentsCss : CKEDITOR.basePath + 'contents.css',
  86. /**
  87. * The writing direction of the language used to create the editor
  88. * contents. Allowed values are:
  89. * <ul>
  90. * <li><code>'ui'</code> &ndash; indicates that content direction will be the same as the user interface language direction;</li>
  91. * <li><code>'ltr'</code> &ndash; for Left-To-Right language (like English);</li>
  92. * <li><code>'rtl'</code> &ndash; for Right-To-Left languages (like Arabic).</li>
  93. * </ul>
  94. * @default <code>'ui'</code>
  95. * @type String
  96. * @example
  97. * config.contentsLangDirection = 'rtl';
  98. */
  99. contentsLangDirection : 'ui',
  100. /**
  101. * Language code of the writing language which is used to create the editor
  102. * contents.
  103. * @default Same value as editor UI language.
  104. * @type String
  105. * @example
  106. * config.contentsLanguage = 'fr';
  107. */
  108. contentsLanguage : '',
  109. /**
  110. * The user interface language localization to use. If left empty, the editor
  111. * will automatically be localized to the user language. If the user language is not supported,
  112. * the language specified in the <code>{@link CKEDITOR.config.defaultLanguage}</code>
  113. * configuration setting is used.
  114. * @default <code>''</code> (empty)
  115. * @type String
  116. * @example
  117. * // Load the German interface.
  118. * config.language = 'de';
  119. */
  120. language : '',
  121. /**
  122. * The language to be used if the <code>{@link CKEDITOR.config.language}</code>
  123. * setting is left empty and it is not possible to localize the editor to the user language.
  124. * @default <code>'en'</code>
  125. * @type String
  126. * @example
  127. * config.defaultLanguage = 'it';
  128. */
  129. defaultLanguage : 'en',
  130. /**
  131. * Sets the behavior of the <em>Enter</em> key. It also determines other behavior
  132. * rules of the editor, like whether the <code>&lt;br&gt;</code> element is to be used
  133. * as a paragraph separator when indenting text.
  134. * The allowed values are the following constants that cause the behavior outlined below:
  135. * <ul>
  136. * <li><code>{@link CKEDITOR.ENTER_P}</code> (1) &ndash; new <code>&lt;p&gt;</code> paragraphs are created;</li>
  137. * <li><code>{@link CKEDITOR.ENTER_BR}</code> (2) &ndash; lines are broken with <code>&lt;br&gt;</code> elements;</li>
  138. * <li><code>{@link CKEDITOR.ENTER_DIV}</code> (3) &ndash; new <code>&lt;div&gt;</code> blocks are created.</li>
  139. * </ul>
  140. * <strong>Note</strong>: It is recommended to use the
  141. * <code>{@link CKEDITOR.ENTER_P}</code> setting because of its semantic value and
  142. * correctness. The editor is optimized for this setting.
  143. * @type Number
  144. * @default <code>{@link CKEDITOR.ENTER_P}</code>
  145. * @example
  146. * // Not recommended.
  147. * config.enterMode = CKEDITOR.ENTER_BR;
  148. */
  149. enterMode : CKEDITOR.ENTER_P,
  150. /**
  151. * Force the use of <code>{@link CKEDITOR.config.enterMode}</code> as line break regardless
  152. * of the context. If, for example, <code>{@link CKEDITOR.config.enterMode}</code> is set
  153. * to <code>{@link CKEDITOR.ENTER_P}</code>, pressing the <em>Enter</em> key inside a
  154. * <code>&lt;div&gt;</code> element will create a new paragraph with <code>&lt;p&gt;</code>
  155. * instead of a <code>&lt;div&gt;</code>.
  156. * @since 3.2.1
  157. * @type Boolean
  158. * @default <code>false</code>
  159. * @example
  160. * // Not recommended.
  161. * config.forceEnterMode = true;
  162. */
  163. forceEnterMode : false,
  164. /**
  165. * Similarly to the <code>{@link CKEDITOR.config.enterMode}</code> setting, it defines the behavior
  166. * of the <em>Shift+Enter</em> key combination.
  167. * The allowed values are the following constants the behavior outlined below:
  168. * <ul>
  169. * <li><code>{@link CKEDITOR.ENTER_P}</code> (1) &ndash; new <code>&lt;p&gt;</code> paragraphs are created;</li>
  170. * <li><code>{@link CKEDITOR.ENTER_BR}</code> (2) &ndash; lines are broken with <code>&lt;br&gt;</code> elements;</li>
  171. * <li><code>{@link CKEDITOR.ENTER_DIV}</code> (3) &ndash; new <code>&lt;div&gt;</code> blocks are created.</li>
  172. * </ul>
  173. * @type Number
  174. * @default <code>{@link CKEDITOR.ENTER_BR}</code>
  175. * @example
  176. * config.shiftEnterMode = CKEDITOR.ENTER_P;
  177. */
  178. shiftEnterMode : CKEDITOR.ENTER_BR,
  179. /**
  180. * A comma separated list of plugins that are not related to editor
  181. * instances. Reserved for plugins that extend the core code only.<br /><br />
  182. *
  183. * There are no ways to override this setting except by editing the source
  184. * code of CKEditor (<code>_source/core/config.js</code>).
  185. * @type String
  186. * @example
  187. */
  188. corePlugins : '',
  189. /**
  190. * Sets the <code>DOCTYPE</code> to be used when loading the editor content as HTML.
  191. * @type String
  192. * @default <code>'&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;'</code>
  193. * @example
  194. * // Set the DOCTYPE to the HTML 4 (Quirks) mode.
  195. * config.docType = '&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"&gt;';
  196. */
  197. docType : '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
  198. /**
  199. * Sets the <code>id</code> attribute to be used on the <code>body</code> element
  200. * of the editing area. This can be useful when you intend to reuse the original CSS
  201. * file you are using on your live website and want to assign the editor the same ID
  202. * as the section that will include the contents. In this way ID-specific CSS rules will
  203. * be enabled.
  204. * @since 3.1
  205. * @type String
  206. * @default <code>''</code> (empty)
  207. * @example
  208. * config.bodyId = 'contents_id';
  209. */
  210. bodyId : '',
  211. /**
  212. * Sets the <code>class</code> attribute to be used on the <code>body</code> element
  213. * of the editing area. This can be useful when you intend to reuse the original CSS
  214. * file you are using on your live website and want to assign the editor the same class
  215. * as the section that will include the contents. In this way class-specific CSS rules will
  216. * be enabled.
  217. * @since 3.1
  218. * @type String
  219. * @default <code>''</code> (empty)
  220. * @example
  221. * config.bodyClass = 'contents';
  222. */
  223. bodyClass : '',
  224. /**
  225. * Indicates whether the contents to be edited are being input as a full
  226. * HTML page. A full page includes the <code>&lt;html&gt;</code>,
  227. * <code>&lt;head&gt;</code>, and <code>&lt;body&gt;</code> elements.
  228. * The final output will also reflect this setting, including the
  229. * <code>&lt;body&gt;</code> contents only if this setting is disabled.
  230. * @since 3.1
  231. * @type Boolean
  232. * @default <code>false</code>
  233. * @example
  234. * config.fullPage = true;
  235. */
  236. fullPage : false,
  237. /**
  238. * The height of the editing area (that includes the editor content),
  239. * in relative or absolute units, e.g. <code>30px</code>, <code>5em</code>.
  240. * <strong>Note:</strong> Percentage units, like <code>30%</code>, are not supported yet.
  241. * @type Number|String
  242. * @default <code>'200'</code>
  243. * @example
  244. * config.height = 500;
  245. * config.height = '25em';
  246. * config.height = '300px';
  247. */
  248. height : 200,
  249. /**
  250. * Comma separated list of plugins to be loaded and initialized for an editor
  251. * instance. This setting should rarely be changed. It is recommended to use the
  252. * <code>{@link CKEDITOR.config.extraPlugins}</code> and
  253. * <code>{@link CKEDITOR.config.removePlugins}</code> for customization purposes instead.
  254. * @type String
  255. * @example
  256. */
  257. plugins :
  258. 'about,' +
  259. 'a11yhelp,' +
  260. 'basicstyles,' +
  261. 'bidi,' +
  262. 'blockquote,' +
  263. 'button,' +
  264. 'clipboard,' +
  265. 'colorbutton,' +
  266. 'colordialog,' +
  267. 'contextmenu,' +
  268. 'dialogadvtab,' +
  269. 'div,' +
  270. 'elementspath,' +
  271. 'enterkey,' +
  272. 'entities,' +
  273. 'filebrowser,' +
  274. 'find,' +
  275. 'flash,' +
  276. 'font,' +
  277. 'format,' +
  278. 'forms,' +
  279. 'horizontalrule,' +
  280. 'htmldataprocessor,' +
  281. 'iframe,' +
  282. 'image,' +
  283. 'indent,' +
  284. 'justify,' +
  285. 'keystrokes,' +
  286. 'link,' +
  287. 'list,' +
  288. 'liststyle,' +
  289. 'maximize,' +
  290. 'newpage,' +
  291. 'pagebreak,' +
  292. 'pastefromword,' +
  293. 'pastetext,' +
  294. 'popup,' +
  295. 'preview,' +
  296. 'print,' +
  297. 'removeformat,' +
  298. 'resize,' +
  299. 'save,' +
  300. 'scayt,' +
  301. 'smiley,' +
  302. 'showblocks,' +
  303. 'showborders,' +
  304. 'sourcearea,' +
  305. 'stylescombo,' +
  306. 'table,' +
  307. 'tabletools,' +
  308. 'specialchar,' +
  309. 'tab,' +
  310. 'templates,' +
  311. 'toolbar,' +
  312. 'undo,' +
  313. 'wysiwygarea,' +
  314. 'wsc',
  315. /**
  316. * A list of additional plugins to be loaded. This setting makes it easier
  317. * to add new plugins without having to touch and potentially break the
  318. * <code>{@link CKEDITOR.config.plugins}</code> setting.
  319. * @type String
  320. * @example
  321. * config.extraPlugins = 'myplugin,anotherplugin';
  322. */
  323. extraPlugins : '',
  324. /**
  325. * A list of plugins that must not be loaded. This setting makes it possible
  326. * to avoid loading some plugins defined in the <code>{@link CKEDITOR.config.plugins}</code>
  327. * setting, without having to touch it and potentially break it.
  328. * @type String
  329. * @example
  330. * config.removePlugins = 'elementspath,save,font';
  331. */
  332. removePlugins : '',
  333. /**
  334. * List of regular expressions to be executed on input HTML,
  335. * indicating HTML source code that when matched, must <strong>not</strong> be available in the WYSIWYG
  336. * mode for editing.
  337. * @type Array
  338. * @default <code>[]</code> (empty array)
  339. * @example
  340. * config.protectedSource.push( /<\?[\s\S]*?\?>/g ); // PHP code
  341. * config.protectedSource.push( /<%[\s\S]*?%>/g ); // ASP code
  342. * config.protectedSource.push( /(<asp:[^\>]+>[\s|\S]*?<\/asp:[^\>]+>)|(<asp:[^\>]+\/>)/gi ); // ASP.Net code
  343. */
  344. protectedSource : [],
  345. /**
  346. * The editor <code>tabindex</code> value.
  347. * @type Number
  348. * @default <code>0</code> (zero)
  349. * @example
  350. * config.tabIndex = 1;
  351. */
  352. tabIndex : 0,
  353. /**
  354. * The theme to be used to build the user interface.
  355. * @type String
  356. * @default <code>'default'</code>
  357. * @see CKEDITOR.config.skin
  358. * @example
  359. * config.theme = 'default';
  360. */
  361. theme : 'default',
  362. /**
  363. * The skin to load. It may be the name of the skin folder inside the
  364. * editor installation path, or the name and the path separated by a comma.
  365. * @type String
  366. * @default <code>'default'</code>
  367. * @example
  368. * config.skin = 'v2';
  369. * @example
  370. * config.skin = 'myskin,/customstuff/myskin/';
  371. */
  372. skin : 'kama',
  373. /**
  374. * The editor width in CSS-defined units or an integer denoting a value in pixels.
  375. * @type String|Number
  376. * @default <code>''</code> (empty)
  377. * @example
  378. * config.width = 850;
  379. * @example
  380. * config.width = '75%';
  381. */
  382. width : '',
  383. /**
  384. * The base Z-index for floating dialog windows and popups.
  385. * @type Number
  386. * @default <code>10000</code>
  387. * @example
  388. * config.baseFloatZIndex = 2000
  389. */
  390. baseFloatZIndex : 10000
  391. };
  392. /**
  393. * Indicates that some of the editor features, like alignment and text
  394. * direction, should use the "computed value" of the feature to indicate its
  395. * on/off state instead of using the "real value".<br />
  396. * <br />
  397. * If enabled in a Left-To-Right written document, the "Left Justify"
  398. * alignment button will be shown as active, even if the alignment style is not
  399. * explicitly applied to the current paragraph in the editor.
  400. * @name CKEDITOR.config.useComputedState
  401. * @type Boolean
  402. * @default <code>true</code>
  403. * @since 3.4
  404. * @example
  405. * config.useComputedState = false;
  406. */
  407. // PACKAGER_RENAME( CKEDITOR.config )