config.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. /**
  2. * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or http://ckeditor.com/license
  4. */
  5. /**
  6. * @fileOverview Defines the {@link CKEDITOR.config} object that stores the
  7. * default configuration settings.
  8. */
  9. /**
  10. * Used in conjunction with {@link CKEDITOR.config#enterMode}
  11. * and {@link CKEDITOR.config#shiftEnterMode} configuration
  12. * settings to make the editor produce `<p>` tags when
  13. * using the *Enter* key.
  14. *
  15. * @readonly
  16. * @property {Number} [=1]
  17. * @member CKEDITOR
  18. */
  19. CKEDITOR.ENTER_P = 1;
  20. /**
  21. * Used in conjunction with {@link CKEDITOR.config#enterMode}
  22. * and {@link CKEDITOR.config#shiftEnterMode} configuration
  23. * settings to make the editor produce `<br>` tags when
  24. * using the *Enter* key.
  25. *
  26. * @readonly
  27. * @property {Number} [=2]
  28. * @member CKEDITOR
  29. */
  30. CKEDITOR.ENTER_BR = 2;
  31. /**
  32. * Used in conjunction with {@link CKEDITOR.config#enterMode}
  33. * and {@link CKEDITOR.config#shiftEnterMode} configuration
  34. * settings to make the editor produce `<div>` tags when
  35. * using the *Enter* key.
  36. *
  37. * @readonly
  38. * @property {Number} [=3]
  39. * @member CKEDITOR
  40. */
  41. CKEDITOR.ENTER_DIV = 3;
  42. /**
  43. * Stores default configuration settings. Changes to this object are
  44. * reflected in all editor instances, if not specified otherwise for a particular
  45. * instance.
  46. *
  47. * Read more about setting CKEditor configuration in the
  48. * [Developer's Guide](#!/guide/dev_configuration).
  49. *
  50. * @class
  51. * @singleton
  52. */
  53. CKEDITOR.config = {
  54. /**
  55. * The URL path for the custom configuration file to be loaded. If not
  56. * overloaded with inline configuration, it defaults to the `config.js`
  57. * file present in the root of the CKEditor installation directory.
  58. *
  59. * CKEditor will recursively load custom configuration files defined inside
  60. * other custom configuration files.
  61. *
  62. * // Load a specific configuration file.
  63. * CKEDITOR.replace( 'myfield', { customConfig: '/myconfig.js' } );
  64. *
  65. * // Do not load any custom configuration file.
  66. * CKEDITOR.replace( 'myfield', { customConfig: '' } );
  67. *
  68. * @cfg {String} [="<CKEditor folder>/config.js"]
  69. */
  70. customConfig: 'config.js',
  71. /**
  72. * Whether the replaced element (usually a `<textarea>`)
  73. * is to be updated automatically when posting the form containing the editor.
  74. *
  75. * @cfg
  76. */
  77. autoUpdateElement: true,
  78. /**
  79. * The user interface language localization to use. If left empty, the editor
  80. * will automatically be localized to the user language. If the user language is not supported,
  81. * the language specified in the {@link CKEDITOR.config#defaultLanguage}
  82. * configuration setting is used.
  83. *
  84. * // Load the German interface.
  85. * config.language = 'de';
  86. *
  87. * @cfg
  88. */
  89. language: '',
  90. /**
  91. * The language to be used if the {@link CKEDITOR.config#language}
  92. * setting is left empty and it is not possible to localize the editor to the user language.
  93. *
  94. * config.defaultLanguage = 'it';
  95. *
  96. * @cfg
  97. */
  98. defaultLanguage: 'en',
  99. /**
  100. * The writing direction of the language which is used to create editor contents.
  101. * Allowed values are:
  102. *
  103. * * `''` (an empty string) &ndash; Indicates that content direction will be the same as either
  104. * the editor UI direction or the page element direction depending on the editor type:
  105. * * Classic editor &ndash; The same as the user interface language direction.
  106. * * Inline editor &ndash; The same as the editable element text direction.
  107. * * `'ltr'` &ndash; Indicates a Left-To-Right text direction (like in English).
  108. * * `'rtl'` &ndash; Indicates a Right-To-Left text direction (like in Arabic).
  109. *
  110. * Example:
  111. *
  112. * config.contentsLangDirection = 'rtl';
  113. *
  114. * @cfg
  115. */
  116. contentsLangDirection: '',
  117. /**
  118. * Sets the behavior of the *Enter* key. It also determines other behavior
  119. * rules of the editor, like whether the `<br>` element is to be used
  120. * as a paragraph separator when indenting text.
  121. * The allowed values are the following constants that cause the behavior outlined below:
  122. *
  123. * * {@link CKEDITOR#ENTER_P} (1) &ndash; new `<p>` paragraphs are created;
  124. * * {@link CKEDITOR#ENTER_BR} (2) &ndash; lines are broken with `<br>` elements;
  125. * * {@link CKEDITOR#ENTER_DIV} (3) &ndash; new `<div>` blocks are created.
  126. *
  127. * **Note**: It is recommended to use the {@link CKEDITOR#ENTER_P} setting because of
  128. * its semantic value and correctness. The editor is optimized for this setting.
  129. *
  130. * // Not recommended.
  131. * config.enterMode = CKEDITOR.ENTER_BR;
  132. *
  133. * @cfg {Number} [=CKEDITOR.ENTER_P]
  134. */
  135. enterMode: CKEDITOR.ENTER_P,
  136. /**
  137. * Force the use of {@link CKEDITOR.config#enterMode} as line break regardless
  138. * of the context. If, for example, {@link CKEDITOR.config#enterMode} is set
  139. * to {@link CKEDITOR#ENTER_P}, pressing the *Enter* key inside a
  140. * `<div>` element will create a new paragraph with `<p>`
  141. * instead of a `<div>`.
  142. *
  143. * // Not recommended.
  144. * config.forceEnterMode = true;
  145. *
  146. * @since 3.2.1
  147. * @cfg
  148. */
  149. forceEnterMode: false,
  150. /**
  151. * Similarly to the {@link CKEDITOR.config#enterMode} setting, it defines the behavior
  152. * of the *Shift+Enter* key combination.
  153. *
  154. * The allowed values are the following constants the behavior outlined below:
  155. *
  156. * * {@link CKEDITOR#ENTER_P} (1) &ndash; new `<p>` paragraphs are created;
  157. * * {@link CKEDITOR#ENTER_BR} (2) &ndash; lines are broken with `<br>` elements;
  158. * * {@link CKEDITOR#ENTER_DIV} (3) &ndash; new `<div>` blocks are created.
  159. *
  160. * Example:
  161. *
  162. * config.shiftEnterMode = CKEDITOR.ENTER_P;
  163. *
  164. * @cfg {Number} [=CKEDITOR.ENTER_BR]
  165. */
  166. shiftEnterMode: CKEDITOR.ENTER_BR,
  167. /**
  168. * Sets the `DOCTYPE` to be used when loading the editor content as HTML.
  169. *
  170. * // Set the DOCTYPE to the HTML 4 (Quirks) mode.
  171. * config.docType = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
  172. *
  173. * @cfg
  174. */
  175. docType: '<!DOCTYPE html>',
  176. /**
  177. * Sets the `id` attribute to be used on the `body` element
  178. * of the editing area. This can be useful when you intend to reuse the original CSS
  179. * file you are using on your live website and want to assign the editor the same ID
  180. * as the section that will include the contents. In this way ID-specific CSS rules will
  181. * be enabled.
  182. *
  183. * config.bodyId = 'contents_id';
  184. *
  185. * @since 3.1
  186. * @cfg
  187. */
  188. bodyId: '',
  189. /**
  190. * Sets the `class` attribute to be used on the `body` element
  191. * of the editing area. This can be useful when you intend to reuse the original CSS
  192. * file you are using on your live website and want to assign the editor the same class
  193. * as the section that will include the contents. In this way class-specific CSS rules will
  194. * be enabled.
  195. *
  196. * config.bodyClass = 'contents';
  197. *
  198. * **Note:** Editor needs to load stylesheets containing contents styles. You can either
  199. * copy them to the `contents.css` file that editor loads by default or set the {@link #contentsCss}
  200. * option.
  201. *
  202. * **Note:** This setting applies only to the classic editor (the one that uses `iframe`).
  203. *
  204. * @since 3.1
  205. * @cfg
  206. */
  207. bodyClass: '',
  208. /**
  209. * Indicates whether the contents to be edited are being input as a full HTML page.
  210. * A full page includes the `<html>`, `<head>`, and `<body>` elements.
  211. * The final output will also reflect this setting, including the
  212. * `<body>` contents only if this setting is disabled.
  213. *
  214. * config.fullPage = true;
  215. *
  216. * @since 3.1
  217. * @cfg
  218. */
  219. fullPage: false,
  220. /**
  221. * The height of the editing area that includes the editor content. This configuration
  222. * option accepts an integer (to denote a value in pixels) or any CSS-defined length unit
  223. * except percent (`%`) values which are not supported.
  224. *
  225. * **Note:** This configuration option is ignored by [inline editor](#!/guide/dev_inline).
  226. *
  227. * config.height = 500; // 500 pixels.
  228. * config.height = '25em'; // CSS length.
  229. * config.height = '300px'; // CSS length.
  230. *
  231. * @cfg {Number/String}
  232. */
  233. height: 200,
  234. /**
  235. * Comma-separated list of plugins to be used in an editor instance. Note that
  236. * the actual plugins that are to be loaded could still be affected by two other settings:
  237. * {@link CKEDITOR.config#extraPlugins} and {@link CKEDITOR.config#removePlugins}.
  238. *
  239. * @cfg {String} [="<default list of plugins>"]
  240. */
  241. plugins: '', // %REMOVE_LINE%
  242. /**
  243. * A list of additional plugins to be loaded. This setting makes it easier
  244. * to add new plugins without having to touch the {@link CKEDITOR.config#plugins} setting.
  245. *
  246. * **Note:** The most recommended way to
  247. * [add CKEditor plugins](http://docs.ckeditor.com/#!/guide/dev_plugins) is through
  248. * [CKEditor Builder](http://ckeditor.com/builder).
  249. *
  250. * config.extraPlugins = 'myplugin,anotherplugin';
  251. *
  252. * @cfg
  253. */
  254. extraPlugins: '',
  255. /**
  256. * A list of plugins that must not be loaded. This setting makes it possible
  257. * to avoid loading some plugins defined in the {@link CKEDITOR.config#plugins}
  258. * setting, without having to touch it.
  259. *
  260. * **Note:** A plugin required by another plugin cannot be removed and will cause
  261. * an error to be thrown. So for example if `contextmenu` is required by `tabletools`,
  262. * it can only be removed if `tabletools` is not loaded.
  263. *
  264. * config.removePlugins = 'elementspath,save,font';
  265. *
  266. * @cfg
  267. */
  268. removePlugins: '',
  269. /**
  270. * A list of regular expressions to be executed on input HTML,
  271. * indicating HTML source code that when matched, must **not** be available in the WYSIWYG
  272. * mode for editing.
  273. *
  274. * config.protectedSource.push( /<\?[\s\S]*?\?>/g ); // PHP code
  275. * config.protectedSource.push( /<%[\s\S]*?%>/g ); // ASP code
  276. * config.protectedSource.push( /(<asp:[^\>]+>[\s|\S]*?<\/asp:[^\>]+>)|(<asp:[^\>]+\/>)/gi ); // ASP.Net code
  277. *
  278. * @cfg
  279. */
  280. protectedSource: [],
  281. /**
  282. * The editor `tabindex` value.
  283. *
  284. * config.tabIndex = 1;
  285. *
  286. * @cfg
  287. */
  288. tabIndex: 0,
  289. /**
  290. * The editor UI outer width. This configuration option accepts an integer
  291. * (to denote a value in pixels) or any CSS-defined length unit.
  292. *
  293. * Unlike the {@link CKEDITOR.config#height} setting, this
  294. * one will set the outer width of the entire editor UI, not for the
  295. * editing area only.
  296. *
  297. * **Note:** This configuration option is ignored by [inline editor](#!/guide/dev_inline).
  298. *
  299. * config.width = 850; // 850 pixels wide.
  300. * config.width = '75%'; // CSS unit.
  301. *
  302. * @cfg {String/Number}
  303. */
  304. width: '',
  305. /**
  306. * The base Z-index for floating dialog windows and popups.
  307. *
  308. * config.baseFloatZIndex = 2000;
  309. *
  310. * @cfg
  311. */
  312. baseFloatZIndex: 10000,
  313. /**
  314. * The keystrokes that are blocked by default as the browser implementation
  315. * is buggy. These default keystrokes are handled by the editor.
  316. *
  317. * // Default setting.
  318. * config.blockedKeystrokes = [
  319. * CKEDITOR.CTRL + 66, // CTRL+B
  320. * CKEDITOR.CTRL + 73, // CTRL+I
  321. * CKEDITOR.CTRL + 85 // CTRL+U
  322. * ];
  323. *
  324. * @cfg {Array} [blockedKeystrokes=see example]
  325. */
  326. blockedKeystrokes: [
  327. CKEDITOR.CTRL + 66, // CTRL+B
  328. CKEDITOR.CTRL + 73, // CTRL+I
  329. CKEDITOR.CTRL + 85 // CTRL+U
  330. ]
  331. };
  332. /**
  333. * Indicates that some of the editor features, like alignment and text
  334. * direction, should use the "computed value" of the feature to indicate its
  335. * on/off state instead of using the "real value".
  336. *
  337. * If enabled in a Left-To-Right written document, the "Left Justify"
  338. * alignment button will be shown as active, even if the alignment style is not
  339. * explicitly applied to the current paragraph in the editor.
  340. *
  341. * config.useComputedState = false;
  342. *
  343. * @since 3.4
  344. * @cfg {Boolean} [useComputedState=true]
  345. */
  346. /**
  347. * The base user interface color to be used by the editor. Not all skins are
  348. * compatible with this setting.
  349. *
  350. * // Using a color code.
  351. * config.uiColor = '#AADC6E';
  352. *
  353. * // Using an HTML color name.
  354. * config.uiColor = 'Gold';
  355. *
  356. * @cfg {String} uiColor
  357. */
  358. // PACKAGER_RENAME( CKEDITOR.config )