You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1281 lines
46 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>The source code</title>
  6. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  7. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  8. <style type="text/css">
  9. .highlight { display: block; background-color: #ddd; }
  10. </style>
  11. <script type="text/javascript">
  12. function highlight() {
  13. document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
  14. }
  15. </script>
  16. </head>
  17. <body onload="prettyPrint(); highlight();">
  18. <pre class="prettyprint lang-js"><span id='Ext-form-HtmlEditor-method-constructor'><span id='Ext-form-HtmlEditor'>/**
  19. </span></span> * @class Ext.form.HtmlEditor
  20. * @extends Ext.form.Field
  21. * Provides a lightweight HTML Editor component. Some toolbar features are not supported by Safari and will be
  22. * automatically hidden when needed. These are noted in the config options where appropriate.
  23. * &lt;br&gt;&lt;br&gt;The editor's toolbar buttons have tooltips defined in the {@link #buttonTips} property, but they are not
  24. * enabled by default unless the global {@link Ext.QuickTips} singleton is {@link Ext.QuickTips#init initialized}.
  25. * &lt;br&gt;&lt;br&gt;&lt;b&gt;Note: The focus/blur and validation marking functionality inherited from Ext.form.Field is NOT
  26. * supported by this editor.&lt;/b&gt;
  27. * &lt;br&gt;&lt;br&gt;An Editor is a sensitive component that can't be used in all spots standard fields can be used. Putting an Editor within
  28. * any element that has display set to 'none' can cause problems in Safari and Firefox due to their default iframe reloading bugs.
  29. * &lt;br&gt;&lt;br&gt;Example usage:
  30. * &lt;pre&gt;&lt;code&gt;
  31. // Simple example rendered with default options:
  32. Ext.QuickTips.init(); // enable tooltips
  33. new Ext.form.HtmlEditor({
  34. renderTo: Ext.getBody(),
  35. width: 800,
  36. height: 300
  37. });
  38. // Passed via xtype into a container and with custom options:
  39. Ext.QuickTips.init(); // enable tooltips
  40. new Ext.Panel({
  41. title: 'HTML Editor',
  42. renderTo: Ext.getBody(),
  43. width: 600,
  44. height: 300,
  45. frame: true,
  46. layout: 'fit',
  47. items: {
  48. xtype: 'htmleditor',
  49. enableColors: false,
  50. enableAlignments: false
  51. }
  52. });
  53. &lt;/code&gt;&lt;/pre&gt;
  54. * @constructor
  55. * Create a new HtmlEditor
  56. * @param {Object} config
  57. * @xtype htmleditor
  58. */
  59. Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, {
  60. <span id='Ext-form-HtmlEditor-cfg-enableFormat'> /**
  61. </span> * @cfg {Boolean} enableFormat Enable the bold, italic and underline buttons (defaults to true)
  62. */
  63. enableFormat : true,
  64. <span id='Ext-form-HtmlEditor-cfg-enableFontSize'> /**
  65. </span> * @cfg {Boolean} enableFontSize Enable the increase/decrease font size buttons (defaults to true)
  66. */
  67. enableFontSize : true,
  68. <span id='Ext-form-HtmlEditor-cfg-enableColors'> /**
  69. </span> * @cfg {Boolean} enableColors Enable the fore/highlight color buttons (defaults to true)
  70. */
  71. enableColors : true,
  72. <span id='Ext-form-HtmlEditor-cfg-enableAlignments'> /**
  73. </span> * @cfg {Boolean} enableAlignments Enable the left, center, right alignment buttons (defaults to true)
  74. */
  75. enableAlignments : true,
  76. <span id='Ext-form-HtmlEditor-cfg-enableLists'> /**
  77. </span> * @cfg {Boolean} enableLists Enable the bullet and numbered list buttons. Not available in Safari. (defaults to true)
  78. */
  79. enableLists : true,
  80. <span id='Ext-form-HtmlEditor-cfg-enableSourceEdit'> /**
  81. </span> * @cfg {Boolean} enableSourceEdit Enable the switch to source edit button. Not available in Safari. (defaults to true)
  82. */
  83. enableSourceEdit : true,
  84. <span id='Ext-form-HtmlEditor-cfg-enableLinks'> /**
  85. </span> * @cfg {Boolean} enableLinks Enable the create link button. Not available in Safari. (defaults to true)
  86. */
  87. enableLinks : true,
  88. <span id='Ext-form-HtmlEditor-cfg-enableFont'> /**
  89. </span> * @cfg {Boolean} enableFont Enable font selection. Not available in Safari. (defaults to true)
  90. */
  91. enableFont : true,
  92. <span id='Ext-form-HtmlEditor-cfg-createLinkText'> /**
  93. </span> * @cfg {String} createLinkText The default text for the create link prompt
  94. */
  95. createLinkText : 'Please enter the URL for the link:',
  96. <span id='Ext-form-HtmlEditor-cfg-defaultLinkValue'> /**
  97. </span> * @cfg {String} defaultLinkValue The default value for the create link prompt (defaults to http:/ /)
  98. */
  99. defaultLinkValue : 'http:/'+'/',
  100. <span id='Ext-form-HtmlEditor-cfg-fontFamilies'> /**
  101. </span> * @cfg {Array} fontFamilies An array of available font families
  102. */
  103. fontFamilies : [
  104. 'Arial',
  105. 'Courier New',
  106. 'Tahoma',
  107. 'Times New Roman',
  108. 'Verdana'
  109. ],
  110. <span id='Ext-form-HtmlEditor-property-defaultFont'> defaultFont: 'tahoma',
  111. </span><span id='Ext-form-HtmlEditor-cfg-defaultValue'> /**
  112. </span> * @cfg {String} defaultValue A default value to be put into the editor to resolve focus issues (defaults to &amp;#160; (Non-breaking space) in Opera and IE6, &amp;#8203; (Zero-width space) in all other browsers).
  113. */
  114. defaultValue: (Ext.isOpera || Ext.isIE6) ? '&amp;#160;' : '&amp;#8203;',
  115. <span id='Ext-form-HtmlEditor-property-actionMode'> // private properties
  116. </span> actionMode: 'wrap',
  117. <span id='Ext-form-HtmlEditor-cfg-validationEvent'> validationEvent : false,
  118. </span><span id='Ext-form-HtmlEditor-property-deferHeight'> deferHeight: true,
  119. </span><span id='Ext-form-HtmlEditor-property-initialized'> initialized : false,
  120. </span><span id='Ext-form-HtmlEditor-property-activated'> activated : false,
  121. </span><span id='Ext-form-HtmlEditor-property-sourceEditMode'> sourceEditMode : false,
  122. </span><span id='Ext-form-HtmlEditor-method-onFocus'> onFocus : Ext.emptyFn,
  123. </span><span id='Ext-form-HtmlEditor-property-iframePad'> iframePad:3,
  124. </span><span id='Ext-form-HtmlEditor-cfg-hideMode'> hideMode:'offsets',
  125. </span><span id='Ext-form-HtmlEditor-property-defaultAutoCreate'> defaultAutoCreate : {
  126. </span> tag: &quot;textarea&quot;,
  127. style:&quot;width:500px;height:300px;&quot;,
  128. autocomplete: &quot;off&quot;
  129. },
  130. <span id='Ext-form-HtmlEditor-method-initComponent'> // private
  131. </span> initComponent : function(){
  132. this.addEvents(
  133. <span id='Ext-form-HtmlEditor-event-initialize'> /**
  134. </span> * @event initialize
  135. * Fires when the editor is fully initialized (including the iframe)
  136. * @param {HtmlEditor} this
  137. */
  138. 'initialize',
  139. <span id='Ext-form-HtmlEditor-event-activate'> /**
  140. </span> * @event activate
  141. * Fires when the editor is first receives the focus. Any insertion must wait
  142. * until after this event.
  143. * @param {HtmlEditor} this
  144. */
  145. 'activate',
  146. <span id='Ext-form-HtmlEditor-event-beforesync'> /**
  147. </span> * @event beforesync
  148. * Fires before the textarea is updated with content from the editor iframe. Return false
  149. * to cancel the sync.
  150. * @param {HtmlEditor} this
  151. * @param {String} html
  152. */
  153. 'beforesync',
  154. <span id='Ext-form-HtmlEditor-event-beforepush'> /**
  155. </span> * @event beforepush
  156. * Fires before the iframe editor is updated with content from the textarea. Return false
  157. * to cancel the push.
  158. * @param {HtmlEditor} this
  159. * @param {String} html
  160. */
  161. 'beforepush',
  162. <span id='Ext-form-HtmlEditor-event-sync'> /**
  163. </span> * @event sync
  164. * Fires when the textarea is updated with content from the editor iframe.
  165. * @param {HtmlEditor} this
  166. * @param {String} html
  167. */
  168. 'sync',
  169. <span id='Ext-form-HtmlEditor-event-push'> /**
  170. </span> * @event push
  171. * Fires when the iframe editor is updated with content from the textarea.
  172. * @param {HtmlEditor} this
  173. * @param {String} html
  174. */
  175. 'push',
  176. <span id='Ext-form-HtmlEditor-event-editmodechange'> /**
  177. </span> * @event editmodechange
  178. * Fires when the editor switches edit modes
  179. * @param {HtmlEditor} this
  180. * @param {Boolean} sourceEdit True if source edit, false if standard editing.
  181. */
  182. 'editmodechange'
  183. );
  184. Ext.form.HtmlEditor.superclass.initComponent.call(this);
  185. },
  186. <span id='Ext-form-HtmlEditor-method-createFontOptions'> // private
  187. </span> createFontOptions : function(){
  188. var buf = [], fs = this.fontFamilies, ff, lc;
  189. for(var i = 0, len = fs.length; i&lt; len; i++){
  190. ff = fs[i];
  191. lc = ff.toLowerCase();
  192. buf.push(
  193. '&lt;option value=&quot;',lc,'&quot; style=&quot;font-family:',ff,';&quot;',
  194. (this.defaultFont == lc ? ' selected=&quot;true&quot;&gt;' : '&gt;'),
  195. ff,
  196. '&lt;/option&gt;'
  197. );
  198. }
  199. return buf.join('');
  200. },
  201. <span id='Ext-form-HtmlEditor-method-createToolbar'> /*
  202. </span> * Protected method that will not generally be called directly. It
  203. * is called when the editor creates its toolbar. Override this method if you need to
  204. * add custom toolbar buttons.
  205. * @param {HtmlEditor} editor
  206. */
  207. createToolbar : function(editor){
  208. var items = [];
  209. var tipsEnabled = Ext.QuickTips &amp;&amp; Ext.QuickTips.isEnabled();
  210. function btn(id, toggle, handler){
  211. return {
  212. itemId : id,
  213. cls : 'x-btn-icon',
  214. iconCls: 'x-edit-'+id,
  215. enableToggle:toggle !== false,
  216. scope: editor,
  217. handler:handler||editor.relayBtnCmd,
  218. clickEvent:'mousedown',
  219. tooltip: tipsEnabled ? editor.buttonTips[id] || undefined : undefined,
  220. overflowText: editor.buttonTips[id].title || undefined,
  221. tabIndex:-1
  222. };
  223. }
  224. if(this.enableFont &amp;&amp; !Ext.isSafari2){
  225. var fontSelectItem = new Ext.Toolbar.Item({
  226. autoEl: {
  227. tag:'select',
  228. cls:'x-font-select',
  229. html: this.createFontOptions()
  230. }
  231. });
  232. items.push(
  233. fontSelectItem,
  234. '-'
  235. );
  236. }
  237. if(this.enableFormat){
  238. items.push(
  239. btn('bold'),
  240. btn('italic'),
  241. btn('underline')
  242. );
  243. }
  244. if(this.enableFontSize){
  245. items.push(
  246. '-',
  247. btn('increasefontsize', false, this.adjustFont),
  248. btn('decreasefontsize', false, this.adjustFont)
  249. );
  250. }
  251. if(this.enableColors){
  252. items.push(
  253. '-', {
  254. itemId:'forecolor',
  255. cls:'x-btn-icon',
  256. iconCls: 'x-edit-forecolor',
  257. clickEvent:'mousedown',
  258. tooltip: tipsEnabled ? editor.buttonTips.forecolor || undefined : undefined,
  259. tabIndex:-1,
  260. menu : new Ext.menu.ColorMenu({
  261. allowReselect: true,
  262. focus: Ext.emptyFn,
  263. value:'000000',
  264. plain:true,
  265. listeners: {
  266. scope: this,
  267. select: function(cp, color){
  268. this.execCmd('forecolor', Ext.isWebKit || Ext.isIE ? '#'+color : color);
  269. this.deferFocus();
  270. }
  271. },
  272. clickEvent:'mousedown'
  273. })
  274. }, {
  275. itemId:'backcolor',
  276. cls:'x-btn-icon',
  277. iconCls: 'x-edit-backcolor',
  278. clickEvent:'mousedown',
  279. tooltip: tipsEnabled ? editor.buttonTips.backcolor || undefined : undefined,
  280. tabIndex:-1,
  281. menu : new Ext.menu.ColorMenu({
  282. focus: Ext.emptyFn,
  283. value:'FFFFFF',
  284. plain:true,
  285. allowReselect: true,
  286. listeners: {
  287. scope: this,
  288. select: function(cp, color){
  289. if(Ext.isGecko){
  290. this.execCmd('useCSS', false);
  291. this.execCmd('hilitecolor', color);
  292. this.execCmd('useCSS', true);
  293. this.deferFocus();
  294. }else{
  295. this.execCmd(Ext.isOpera ? 'hilitecolor' : 'backcolor', Ext.isWebKit || Ext.isIE ? '#'+color : color);
  296. this.deferFocus();
  297. }
  298. }
  299. },
  300. clickEvent:'mousedown'
  301. })
  302. }
  303. );
  304. }
  305. if(this.enableAlignments){
  306. items.push(
  307. '-',
  308. btn('justifyleft'),
  309. btn('justifycenter'),
  310. btn('justifyright')
  311. );
  312. }
  313. if(!Ext.isSafari2){
  314. if(this.enableLinks){
  315. items.push(
  316. '-',
  317. btn('createlink', false, this.createLink)
  318. );
  319. }
  320. if(this.enableLists){
  321. items.push(
  322. '-',
  323. btn('insertorderedlist'),
  324. btn('insertunorderedlist')
  325. );
  326. }
  327. if(this.enableSourceEdit){
  328. items.push(
  329. '-',
  330. btn('sourceedit', true, function(btn){
  331. this.toggleSourceEdit(!this.sourceEditMode);
  332. })
  333. );
  334. }
  335. }
  336. // build the toolbar
  337. var tb = new Ext.Toolbar({
  338. renderTo: this.wrap.dom.firstChild,
  339. items: items
  340. });
  341. if (fontSelectItem) {
  342. this.fontSelect = fontSelectItem.el;
  343. this.mon(this.fontSelect, 'change', function(){
  344. var font = this.fontSelect.dom.value;
  345. this.relayCmd('fontname', font);
  346. this.deferFocus();
  347. }, this);
  348. }
  349. // stop form submits
  350. this.mon(tb.el, 'click', function(e){
  351. e.preventDefault();
  352. });
  353. this.tb = tb;
  354. this.tb.doLayout();
  355. },
  356. <span id='Ext-form-HtmlEditor-method-onDisable'> onDisable: function(){
  357. </span> this.wrap.mask();
  358. Ext.form.HtmlEditor.superclass.onDisable.call(this);
  359. },
  360. <span id='Ext-form-HtmlEditor-method-onEnable'> onEnable: function(){
  361. </span> this.wrap.unmask();
  362. Ext.form.HtmlEditor.superclass.onEnable.call(this);
  363. },
  364. <span id='Ext-form-HtmlEditor-method-setReadOnly'> setReadOnly: function(readOnly){
  365. </span>
  366. Ext.form.HtmlEditor.superclass.setReadOnly.call(this, readOnly);
  367. if(this.initialized){
  368. if(Ext.isIE){
  369. this.getEditorBody().contentEditable = !readOnly;
  370. }else{
  371. this.setDesignMode(!readOnly);
  372. }
  373. var bd = this.getEditorBody();
  374. if(bd){
  375. bd.style.cursor = this.readOnly ? 'default' : 'text';
  376. }
  377. this.disableItems(readOnly);
  378. }
  379. },
  380. <span id='Ext-form-HtmlEditor-method-getDocMarkup'> /**
  381. </span> * Protected method that will not generally be called directly. It
  382. * is called when the editor initializes the iframe with HTML contents. Override this method if you
  383. * want to change the initialization markup of the iframe (e.g. to add stylesheets).
  384. *
  385. * Note: IE8-Standards has unwanted scroller behavior, so the default meta tag forces IE7 compatibility
  386. */
  387. getDocMarkup : function(){
  388. var h = Ext.fly(this.iframe).getHeight() - this.iframePad * 2;
  389. return String.format('&lt;html&gt;&lt;head&gt;&lt;style type=&quot;text/css&quot;&gt;body{border: 0; margin: 0; padding: {0}px; height: {1}px; cursor: text}&lt;/style&gt;&lt;/head&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;', this.iframePad, h);
  390. },
  391. <span id='Ext-form-HtmlEditor-method-getEditorBody'> // private
  392. </span> getEditorBody : function(){
  393. var doc = this.getDoc();
  394. return doc.body || doc.documentElement;
  395. },
  396. <span id='Ext-form-HtmlEditor-method-getDoc'> // private
  397. </span> getDoc : function(){
  398. return Ext.isIE ? this.getWin().document : (this.iframe.contentDocument || this.getWin().document);
  399. },
  400. <span id='Ext-form-HtmlEditor-method-getWin'> // private
  401. </span> getWin : function(){
  402. return Ext.isIE ? this.iframe.contentWindow : window.frames[this.iframe.name];
  403. },
  404. <span id='Ext-form-HtmlEditor-method-onRender'> // private
  405. </span> onRender : function(ct, position){
  406. Ext.form.HtmlEditor.superclass.onRender.call(this, ct, position);
  407. this.el.dom.style.border = '0 none';
  408. this.el.dom.setAttribute('tabIndex', -1);
  409. this.el.addClass('x-hidden');
  410. if(Ext.isIE){ // fix IE 1px bogus margin
  411. this.el.applyStyles('margin-top:-1px;margin-bottom:-1px;');
  412. }
  413. this.wrap = this.el.wrap({
  414. cls:'x-html-editor-wrap', cn:{cls:'x-html-editor-tb'}
  415. });
  416. this.createToolbar(this);
  417. this.disableItems(true);
  418. this.tb.doLayout();
  419. this.createIFrame();
  420. if(!this.width){
  421. var sz = this.el.getSize();
  422. this.setSize(sz.width, this.height || sz.height);
  423. }
  424. this.resizeEl = this.positionEl = this.wrap;
  425. },
  426. <span id='Ext-form-HtmlEditor-method-createIFrame'> createIFrame: function(){
  427. </span> var iframe = document.createElement('iframe');
  428. iframe.name = Ext.id();
  429. iframe.frameBorder = '0';
  430. iframe.style.overflow = 'auto';
  431. iframe.src = Ext.SSL_SECURE_URL;
  432. this.wrap.dom.appendChild(iframe);
  433. this.iframe = iframe;
  434. this.monitorTask = Ext.TaskMgr.start({
  435. run: this.checkDesignMode,
  436. scope: this,
  437. interval:100
  438. });
  439. },
  440. <span id='Ext-form-HtmlEditor-method-initFrame'> initFrame : function(){
  441. </span> Ext.TaskMgr.stop(this.monitorTask);
  442. var doc = this.getDoc();
  443. this.win = this.getWin();
  444. doc.open();
  445. doc.write(this.getDocMarkup());
  446. doc.close();
  447. this.readyTask = { // must defer to wait for browser to be ready
  448. run : function(){
  449. var doc = this.getDoc();
  450. if(doc.body || doc.readyState == 'complete'){
  451. Ext.TaskMgr.stop(this.readyTask);
  452. this.setDesignMode(true);
  453. this.initEditor.defer(10, this);
  454. }
  455. },
  456. interval : 10,
  457. duration:10000,
  458. scope: this
  459. };
  460. Ext.TaskMgr.start(this.readyTask);
  461. },
  462. <span id='Ext-form-HtmlEditor-method-checkDesignMode'> checkDesignMode : function(){
  463. </span> if(this.wrap &amp;&amp; this.wrap.dom.offsetWidth){
  464. var doc = this.getDoc();
  465. if(!doc){
  466. return;
  467. }
  468. if(!doc.editorInitialized || this.getDesignMode() != 'on'){
  469. this.initFrame();
  470. }
  471. }
  472. },
  473. <span id='Ext-form-HtmlEditor-method-setDesignMode'> /* private
  474. </span> * set current design mode. To enable, mode can be true or 'on', off otherwise
  475. */
  476. setDesignMode : function(mode){
  477. var doc = this.getDoc();
  478. if (doc) {
  479. if(this.readOnly){
  480. mode = false;
  481. }
  482. doc.designMode = (/on|true/i).test(String(mode).toLowerCase()) ?'on':'off';
  483. }
  484. },
  485. <span id='Ext-form-HtmlEditor-method-getDesignMode'> // private
  486. </span> getDesignMode : function(){
  487. var doc = this.getDoc();
  488. if(!doc){ return ''; }
  489. return String(doc.designMode).toLowerCase();
  490. },
  491. <span id='Ext-form-HtmlEditor-method-disableItems'> disableItems: function(disabled){
  492. </span> if(this.fontSelect){
  493. this.fontSelect.dom.disabled = disabled;
  494. }
  495. this.tb.items.each(function(item){
  496. if(item.getItemId() != 'sourceedit'){
  497. item.setDisabled(disabled);
  498. }
  499. });
  500. },
  501. <span id='Ext-form-HtmlEditor-method-onResize'> // private
  502. </span> onResize : function(w, h){
  503. Ext.form.HtmlEditor.superclass.onResize.apply(this, arguments);
  504. if(this.el &amp;&amp; this.iframe){
  505. if(Ext.isNumber(w)){
  506. var aw = w - this.wrap.getFrameWidth('lr');
  507. this.el.setWidth(aw);
  508. this.tb.setWidth(aw);
  509. this.iframe.style.width = Math.max(aw, 0) + 'px';
  510. }
  511. if(Ext.isNumber(h)){
  512. var ah = h - this.wrap.getFrameWidth('tb') - this.tb.el.getHeight();
  513. this.el.setHeight(ah);
  514. this.iframe.style.height = Math.max(ah, 0) + 'px';
  515. var bd = this.getEditorBody();
  516. if(bd){
  517. bd.style.height = Math.max((ah - (this.iframePad*2)), 0) + 'px';
  518. }
  519. }
  520. }
  521. },
  522. <span id='Ext-form-HtmlEditor-method-toggleSourceEdit'> /**
  523. </span> * Toggles the editor between standard and source edit mode.
  524. * @param {Boolean} sourceEdit (optional) True for source edit, false for standard
  525. */
  526. toggleSourceEdit : function(sourceEditMode){
  527. var iframeHeight,
  528. elHeight;
  529. if (sourceEditMode === undefined) {
  530. sourceEditMode = !this.sourceEditMode;
  531. }
  532. this.sourceEditMode = sourceEditMode === true;
  533. var btn = this.tb.getComponent('sourceedit');
  534. if (btn.pressed !== this.sourceEditMode) {
  535. btn.toggle(this.sourceEditMode);
  536. if (!btn.xtbHidden) {
  537. return;
  538. }
  539. }
  540. if (this.sourceEditMode) {
  541. // grab the height of the containing panel before we hide the iframe
  542. this.previousSize = this.getSize();
  543. iframeHeight = Ext.get(this.iframe).getHeight();
  544. this.disableItems(true);
  545. this.syncValue();
  546. this.iframe.className = 'x-hidden';
  547. this.el.removeClass('x-hidden');
  548. this.el.dom.removeAttribute('tabIndex');
  549. this.el.focus();
  550. this.el.dom.style.height = iframeHeight + 'px';
  551. }
  552. else {
  553. elHeight = parseInt(this.el.dom.style.height, 10);
  554. if (this.initialized) {
  555. this.disableItems(this.readOnly);
  556. }
  557. this.pushValue();
  558. this.iframe.className = '';
  559. this.el.addClass('x-hidden');
  560. this.el.dom.setAttribute('tabIndex', -1);
  561. this.deferFocus();
  562. this.setSize(this.previousSize);
  563. delete this.previousSize;
  564. this.iframe.style.height = elHeight + 'px';
  565. }
  566. this.fireEvent('editmodechange', this, this.sourceEditMode);
  567. },
  568. <span id='Ext-form-HtmlEditor-method-createLink'> // private used internally
  569. </span> createLink : function() {
  570. var url = prompt(this.createLinkText, this.defaultLinkValue);
  571. if(url &amp;&amp; url != 'http:/'+'/'){
  572. this.relayCmd('createlink', url);
  573. }
  574. },
  575. <span id='Ext-form-HtmlEditor-method-initEvents'> // private
  576. </span> initEvents : function(){
  577. this.originalValue = this.getValue();
  578. },
  579. <span id='Ext-form-HtmlEditor-method-markInvalid'> /**
  580. </span> * Overridden and disabled. The editor element does not support standard valid/invalid marking. @hide
  581. * @method
  582. */
  583. markInvalid : Ext.emptyFn,
  584. <span id='Ext-form-HtmlEditor-method-clearInvalid'> /**
  585. </span> * Overridden and disabled. The editor element does not support standard valid/invalid marking. @hide
  586. * @method
  587. */
  588. clearInvalid : Ext.emptyFn,
  589. <span id='Ext-form-HtmlEditor-method-setValue'> // docs inherit from Field
  590. </span> setValue : function(v){
  591. Ext.form.HtmlEditor.superclass.setValue.call(this, v);
  592. this.pushValue();
  593. return this;
  594. },
  595. <span id='Ext-form-HtmlEditor-method-cleanHtml'> /**
  596. </span> * Protected method that will not generally be called directly. If you need/want
  597. * custom HTML cleanup, this is the method you should override.
  598. * @param {String} html The HTML to be cleaned
  599. * @return {String} The cleaned HTML
  600. */
  601. cleanHtml: function(html) {
  602. html = String(html);
  603. if(Ext.isWebKit){ // strip safari nonsense
  604. html = html.replace(/\sclass=&quot;(?:Apple-style-span|khtml-block-placeholder)&quot;/gi, '');
  605. }
  606. /*
  607. * Neat little hack. Strips out all the non-digit characters from the default
  608. * value and compares it to the character code of the first character in the string
  609. * because it can cause encoding issues when posted to the server.
  610. */
  611. if(html.charCodeAt(0) == this.defaultValue.replace(/\D/g, '')){
  612. html = html.substring(1);
  613. }
  614. return html;
  615. },
  616. <span id='Ext-form-HtmlEditor-method-syncValue'> /**
  617. </span> * Protected method that will not generally be called directly. Syncs the contents
  618. * of the editor iframe with the textarea.
  619. */
  620. syncValue : function(){
  621. if(this.initialized){
  622. var bd = this.getEditorBody();
  623. var html = bd.innerHTML;
  624. if(Ext.isWebKit){
  625. var bs = bd.getAttribute('style'); // Safari puts text-align styles on the body element!
  626. var m = bs.match(/text-align:(.*?);/i);
  627. if(m &amp;&amp; m[1]){
  628. html = '&lt;div style=&quot;'+m[0]+'&quot;&gt;' + html + '&lt;/div&gt;';
  629. }
  630. }
  631. html = this.cleanHtml(html);
  632. if(this.fireEvent('beforesync', this, html) !== false){
  633. this.el.dom.value = html;
  634. this.fireEvent('sync', this, html);
  635. }
  636. }
  637. },
  638. <span id='Ext-form-HtmlEditor-method-getValue'> //docs inherit from Field
  639. </span> getValue : function() {
  640. this[this.sourceEditMode ? 'pushValue' : 'syncValue']();
  641. return Ext.form.HtmlEditor.superclass.getValue.call(this);
  642. },
  643. <span id='Ext-form-HtmlEditor-method-pushValue'> /**
  644. </span> * Protected method that will not generally be called directly. Pushes the value of the textarea
  645. * into the iframe editor.
  646. */
  647. pushValue : function(){
  648. if(this.initialized){
  649. var v = this.el.dom.value;
  650. if(!this.activated &amp;&amp; v.length &lt; 1){
  651. v = this.defaultValue;
  652. }
  653. if(this.fireEvent('beforepush', this, v) !== false){
  654. this.getEditorBody().innerHTML = v;
  655. if(Ext.isGecko){
  656. // Gecko hack, see: https://bugzilla.mozilla.org/show_bug.cgi?id=232791#c8
  657. this.setDesignMode(false); //toggle off first
  658. this.setDesignMode(true);
  659. }
  660. this.fireEvent('push', this, v);
  661. }
  662. }
  663. },
  664. <span id='Ext-form-HtmlEditor-method-deferFocus'> // private
  665. </span> deferFocus : function(){
  666. this.focus.defer(10, this);
  667. },
  668. <span id='Ext-form-HtmlEditor-method-focus'> // docs inherit from Field
  669. </span> focus : function(){
  670. if(this.win &amp;&amp; !this.sourceEditMode){
  671. this.win.focus();
  672. }else{
  673. this.el.focus();
  674. }
  675. },
  676. <span id='Ext-form-HtmlEditor-method-initEditor'> // private
  677. </span> initEditor : function(){
  678. //Destroying the component during/before initEditor can cause issues.
  679. try{
  680. var dbody = this.getEditorBody(),
  681. ss = this.el.getStyles('font-size', 'font-family', 'background-image', 'background-repeat', 'background-color', 'color'),
  682. doc,
  683. fn;
  684. ss['background-attachment'] = 'fixed'; // w3c
  685. dbody.bgProperties = 'fixed'; // ie
  686. Ext.DomHelper.applyStyles(dbody, ss);
  687. doc = this.getDoc();
  688. if(doc){
  689. try{
  690. Ext.EventManager.removeAll(doc);
  691. }catch(e){}
  692. }
  693. /*
  694. * We need to use createDelegate here, because when using buffer, the delayed task is added
  695. * as a property to the function. When the listener is removed, the task is deleted from the function.
  696. * Since onEditorEvent is shared on the prototype, if we have multiple html editors, the first time one of the editors
  697. * is destroyed, it causes the fn to be deleted from the prototype, which causes errors. Essentially, we're just anonymizing the function.
  698. */
  699. fn = this.onEditorEvent.createDelegate(this);
  700. Ext.EventManager.on(doc, {
  701. mousedown: fn,
  702. dblclick: fn,
  703. click: fn,
  704. keyup: fn,
  705. buffer:100
  706. });
  707. if(Ext.isGecko){
  708. Ext.EventManager.on(doc, 'keypress', this.applyCommand, this);
  709. }
  710. if(Ext.isIE || Ext.isWebKit || Ext.isOpera){
  711. Ext.EventManager.on(doc, 'keydown', this.fixKeys, this);
  712. }
  713. doc.editorInitialized = true;
  714. this.initialized = true;
  715. this.pushValue();
  716. this.setReadOnly(this.readOnly);
  717. this.fireEvent('initialize', this);
  718. }catch(e){}
  719. },
  720. <span id='Ext-form-HtmlEditor-method-beforeDestroy'> // private
  721. </span> beforeDestroy : function(){
  722. if(this.monitorTask){
  723. Ext.TaskMgr.stop(this.monitorTask);
  724. }
  725. if(this.readyTask){
  726. Ext.TaskMgr.stop(this.readyTask);
  727. }
  728. if(this.rendered){
  729. Ext.destroy(this.tb);
  730. var doc = this.getDoc();
  731. Ext.EventManager.removeFromSpecialCache(doc);
  732. if(doc){
  733. try{
  734. Ext.EventManager.removeAll(doc);
  735. for (var prop in doc){
  736. delete doc[prop];
  737. }
  738. }catch(e){}
  739. }
  740. if(this.wrap){
  741. this.wrap.dom.innerHTML = '';
  742. this.wrap.remove();
  743. }
  744. }
  745. Ext.form.HtmlEditor.superclass.beforeDestroy.call(this);
  746. },
  747. <span id='Ext-form-HtmlEditor-method-onFirstFocus'> // private
  748. </span> onFirstFocus : function(){
  749. this.activated = true;
  750. this.disableItems(this.readOnly);
  751. if(Ext.isGecko){ // prevent silly gecko errors
  752. this.win.focus();
  753. var s = this.win.getSelection();
  754. if(!s.focusNode || s.focusNode.nodeType != 3){
  755. var r = s.getRangeAt(0);
  756. r.selectNodeContents(this.getEditorBody());
  757. r.collapse(true);
  758. this.deferFocus();
  759. }
  760. try{
  761. this.execCmd('useCSS', true);
  762. this.execCmd('styleWithCSS', false);
  763. }catch(e){}
  764. }
  765. this.fireEvent('activate', this);
  766. },
  767. <span id='Ext-form-HtmlEditor-method-adjustFont'> // private
  768. </span> adjustFont: function(btn){
  769. var adjust = btn.getItemId() == 'increasefontsize' ? 1 : -1,
  770. doc = this.getDoc(),
  771. v = parseInt(doc.queryCommandValue('FontSize') || 2, 10);
  772. if((Ext.isSafari &amp;&amp; !Ext.isSafari2) || Ext.isChrome || Ext.isAir){
  773. // Safari 3 values
  774. // 1 = 10px, 2 = 13px, 3 = 16px, 4 = 18px, 5 = 24px, 6 = 32px
  775. if(v &lt;= 10){
  776. v = 1 + adjust;
  777. }else if(v &lt;= 13){
  778. v = 2 + adjust;
  779. }else if(v &lt;= 16){
  780. v = 3 + adjust;
  781. }else if(v &lt;= 18){
  782. v = 4 + adjust;
  783. }else if(v &lt;= 24){
  784. v = 5 + adjust;
  785. }else {
  786. v = 6 + adjust;
  787. }
  788. v = v.constrain(1, 6);
  789. }else{
  790. if(Ext.isSafari){ // safari
  791. adjust *= 2;
  792. }
  793. v = Math.max(1, v+adjust) + (Ext.isSafari ? 'px' : 0);
  794. }
  795. this.execCmd('FontSize', v);
  796. },
  797. <span id='Ext-form-HtmlEditor-method-onEditorEvent'> // private
  798. </span> onEditorEvent : function(e){
  799. this.updateToolbar();
  800. },
  801. <span id='Ext-form-HtmlEditor-method-updateToolbar'> /**
  802. </span> * Protected method that will not generally be called directly. It triggers
  803. * a toolbar update by reading the markup state of the current selection in the editor.
  804. */
  805. updateToolbar: function(){
  806. if(this.readOnly){
  807. return;
  808. }
  809. if(!this.activated){
  810. this.onFirstFocus();
  811. return;
  812. }
  813. var btns = this.tb.items.map,
  814. doc = this.getDoc();
  815. if(this.enableFont &amp;&amp; !Ext.isSafari2){
  816. var name = (doc.queryCommandValue('FontName')||this.defaultFont).toLowerCase();
  817. if(name != this.fontSelect.dom.value){
  818. this.fontSelect.dom.value = name;
  819. }
  820. }
  821. if(this.enableFormat){
  822. btns.bold.toggle(doc.queryCommandState('bold'));
  823. btns.italic.toggle(doc.queryCommandState('italic'));
  824. btns.underline.toggle(doc.queryCommandState('underline'));
  825. }
  826. if(this.enableAlignments){
  827. btns.justifyleft.toggle(doc.queryCommandState('justifyleft'));
  828. btns.justifycenter.toggle(doc.queryCommandState('justifycenter'));
  829. btns.justifyright.toggle(doc.queryCommandState('justifyright'));
  830. }
  831. if(!Ext.isSafari2 &amp;&amp; this.enableLists){
  832. btns.insertorderedlist.toggle(doc.queryCommandState('insertorderedlist'));
  833. btns.insertunorderedlist.toggle(doc.queryCommandState('insertunorderedlist'));
  834. }
  835. Ext.menu.MenuMgr.hideAll();
  836. this.syncValue();
  837. },
  838. <span id='Ext-form-HtmlEditor-method-relayBtnCmd'> // private
  839. </span> relayBtnCmd : function(btn){
  840. this.relayCmd(btn.getItemId());
  841. },
  842. <span id='Ext-form-HtmlEditor-method-relayCmd'> /**
  843. </span> * Executes a Midas editor command on the editor document and performs necessary focus and
  844. * toolbar updates. &lt;b&gt;This should only be called after the editor is initialized.&lt;/b&gt;
  845. * @param {String} cmd The Midas command
  846. * @param {String/Boolean} value (optional) The value to pass to the command (defaults to null)
  847. */
  848. relayCmd : function(cmd, value){
  849. (function(){
  850. this.focus();
  851. this.execCmd(cmd, value);
  852. this.updateToolbar();
  853. }).defer(10, this);
  854. },
  855. <span id='Ext-form-HtmlEditor-method-execCmd'> /**
  856. </span> * Executes a Midas editor command directly on the editor document.
  857. * For visual commands, you should use {@link #relayCmd} instead.
  858. * &lt;b&gt;This should only be called after the editor is initialized.&lt;/b&gt;
  859. * @param {String} cmd The Midas command
  860. * @param {String/Boolean} value (optional) The value to pass to the command (defaults to null)
  861. */
  862. execCmd : function(cmd, value){
  863. var doc = this.getDoc();
  864. doc.execCommand(cmd, false, value === undefined ? null : value);
  865. this.syncValue();
  866. },
  867. <span id='Ext-form-HtmlEditor-method-applyCommand'> // private
  868. </span> applyCommand : function(e){
  869. if(e.ctrlKey){
  870. var c = e.getCharCode(), cmd;
  871. if(c &gt; 0){
  872. c = String.fromCharCode(c);
  873. switch(c){
  874. case 'b':
  875. cmd = 'bold';
  876. break;
  877. case 'i':
  878. cmd = 'italic';
  879. break;
  880. case 'u':
  881. cmd = 'underline';
  882. break;
  883. }
  884. if(cmd){
  885. this.win.focus();
  886. this.execCmd(cmd);
  887. this.deferFocus();
  888. e.preventDefault();
  889. }
  890. }
  891. }
  892. },
  893. <span id='Ext-form-HtmlEditor-method-insertAtCursor'> /**
  894. </span> * Inserts the passed text at the current cursor position. Note: the editor must be initialized and activated
  895. * to insert text.
  896. * @param {String} text
  897. */
  898. insertAtCursor : function(text){
  899. if(!this.activated){
  900. return;
  901. }
  902. if(Ext.isIE){
  903. this.win.focus();
  904. var doc = this.getDoc(),
  905. r = doc.selection.createRange();
  906. if(r){
  907. r.pasteHTML(text);
  908. this.syncValue();
  909. this.deferFocus();
  910. }
  911. }else{
  912. this.win.focus();
  913. this.execCmd('InsertHTML', text);
  914. this.deferFocus();
  915. }
  916. },
  917. <span id='Ext-form-HtmlEditor-property-fixKeys'> // private
  918. </span> fixKeys : function(){ // load time branching for fastest keydown performance
  919. if(Ext.isIE){
  920. return function(e){
  921. var k = e.getKey(),
  922. doc = this.getDoc(),
  923. r;
  924. if(k == e.TAB){
  925. e.stopEvent();
  926. r = doc.selection.createRange();
  927. if(r){
  928. r.collapse(true);
  929. r.pasteHTML('&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;');
  930. this.deferFocus();
  931. }
  932. }else if(k == e.ENTER){
  933. r = doc.selection.createRange();
  934. if(r){
  935. var target = r.parentElement();
  936. if(!target || target.tagName.toLowerCase() != 'li'){
  937. e.stopEvent();
  938. r.pasteHTML('&lt;br /&gt;');
  939. r.collapse(false);
  940. r.select();
  941. }
  942. }
  943. }
  944. };
  945. }else if(Ext.isOpera){
  946. return function(e){
  947. var k = e.getKey();
  948. if(k == e.TAB){
  949. e.stopEvent();
  950. this.win.focus();
  951. this.execCmd('InsertHTML','&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;');
  952. this.deferFocus();
  953. }
  954. };
  955. }else if(Ext.isWebKit){
  956. return function(e){
  957. var k = e.getKey();
  958. if(k == e.TAB){
  959. e.stopEvent();
  960. this.execCmd('InsertText','\t');
  961. this.deferFocus();
  962. }else if(k == e.ENTER){
  963. e.stopEvent();
  964. this.execCmd('InsertHtml','&lt;br /&gt;&lt;br /&gt;');
  965. this.deferFocus();
  966. }
  967. };
  968. }
  969. }(),
  970. <span id='Ext-form-HtmlEditor-method-getToolbar'> /**
  971. </span> * Returns the editor's toolbar. &lt;b&gt;This is only available after the editor has been rendered.&lt;/b&gt;
  972. * @return {Ext.Toolbar}
  973. */
  974. getToolbar : function(){
  975. return this.tb;
  976. },
  977. <span id='Ext-form-HtmlEditor-property-buttonTips'> /**
  978. </span> * Object collection of toolbar tooltips for the buttons in the editor. The key
  979. * is the command id associated with that button and the value is a valid QuickTips object.
  980. * For example:
  981. &lt;pre&gt;&lt;code&gt;
  982. {
  983. bold : {
  984. title: 'Bold (Ctrl+B)',
  985. text: 'Make the selected text bold.',
  986. cls: 'x-html-editor-tip'
  987. },
  988. italic : {
  989. title: 'Italic (Ctrl+I)',
  990. text: 'Make the selected text italic.',
  991. cls: 'x-html-editor-tip'
  992. },
  993. ...
  994. &lt;/code&gt;&lt;/pre&gt;
  995. * @type Object
  996. */
  997. buttonTips : {
  998. bold : {
  999. title: 'Bold (Ctrl+B)',
  1000. text: 'Make the selected text bold.',
  1001. cls: 'x-html-editor-tip'
  1002. },
  1003. italic : {
  1004. title: 'Italic (Ctrl+I)',
  1005. text: 'Make the selected text italic.',
  1006. cls: 'x-html-editor-tip'
  1007. },
  1008. underline : {
  1009. title: 'Underline (Ctrl+U)',
  1010. text: 'Underline the selected text.',
  1011. cls: 'x-html-editor-tip'
  1012. },
  1013. increasefontsize : {
  1014. title: 'Grow Text',
  1015. text: 'Increase the font size.',
  1016. cls: 'x-html-editor-tip'
  1017. },
  1018. decreasefontsize : {
  1019. title: 'Shrink Text',
  1020. text: 'Decrease the font size.',
  1021. cls: 'x-html-editor-tip'
  1022. },
  1023. backcolor : {
  1024. title: 'Text Highlight Color',
  1025. text: 'Change the background color of the selected text.',
  1026. cls: 'x-html-editor-tip'
  1027. },
  1028. forecolor : {
  1029. title: 'Font Color',
  1030. text: 'Change the color of the selected text.',
  1031. cls: 'x-html-editor-tip'
  1032. },
  1033. justifyleft : {
  1034. title: 'Align Text Left',
  1035. text: 'Align text to the left.',
  1036. cls: 'x-html-editor-tip'
  1037. },
  1038. justifycenter : {
  1039. title: 'Center Text',
  1040. text: 'Center text in the editor.',
  1041. cls: 'x-html-editor-tip'
  1042. },
  1043. justifyright : {
  1044. title: 'Align Text Right',
  1045. text: 'Align text to the right.',
  1046. cls: 'x-html-editor-tip'
  1047. },
  1048. insertunorderedlist : {
  1049. title: 'Bullet List',
  1050. text: 'Start a bulleted list.',
  1051. cls: 'x-html-editor-tip'
  1052. },
  1053. insertorderedlist : {
  1054. title: 'Numbered List',
  1055. text: 'Start a numbered list.',
  1056. cls: 'x-html-editor-tip'
  1057. },
  1058. createlink : {
  1059. title: 'Hyperlink',
  1060. text: 'Make the selected text a hyperlink.',
  1061. cls: 'x-html-editor-tip'
  1062. },
  1063. sourceedit : {
  1064. title: 'Source Edit',
  1065. text: 'Switch to source editing mode.',
  1066. cls: 'x-html-editor-tip'
  1067. }
  1068. }
  1069. // hide stuff that is not compatible
  1070. <span id='Ext-form-HtmlEditor-event-blur'> /**
  1071. </span> * @event blur
  1072. * @hide
  1073. */
  1074. <span id='Ext-form-HtmlEditor-event-change'> /**
  1075. </span> * @event change
  1076. * @hide
  1077. */
  1078. <span id='Ext-form-HtmlEditor-event-focus'> /**
  1079. </span> * @event focus
  1080. * @hide
  1081. */
  1082. <span id='Ext-form-HtmlEditor-event-specialkey'> /**
  1083. </span> * @event specialkey
  1084. * @hide
  1085. */
  1086. <span id='Ext-form-HtmlEditor-cfg-fieldClass'> /**
  1087. </span> * @cfg {String} fieldClass @hide
  1088. */
  1089. <span id='Ext-form-HtmlEditor-cfg-focusClass'> /**
  1090. </span> * @cfg {String} focusClass @hide
  1091. */
  1092. <span id='Ext-form-HtmlEditor-cfg-autoCreate'> /**
  1093. </span> * @cfg {String} autoCreate @hide
  1094. */
  1095. <span id='Ext-form-HtmlEditor-cfg-inputType'> /**
  1096. </span> * @cfg {String} inputType @hide
  1097. */
  1098. <span id='Ext-form-HtmlEditor-cfg-invalidClass'> /**
  1099. </span> * @cfg {String} invalidClass @hide
  1100. */
  1101. <span id='Ext-form-HtmlEditor-cfg-invalidText'> /**
  1102. </span> * @cfg {String} invalidText @hide
  1103. */
  1104. <span id='Ext-form-HtmlEditor-cfg-msgFx'> /**
  1105. </span> * @cfg {String} msgFx @hide
  1106. */
  1107. <span id='Ext-form-HtmlEditor-cfg-validateOnBlur'> /**
  1108. </span> * @cfg {String} validateOnBlur @hide
  1109. */
  1110. <span id='Ext-form-HtmlEditor-cfg-allowDomMove'> /**
  1111. </span> * @cfg {Boolean} allowDomMove @hide
  1112. */
  1113. <span id='Ext-form-HtmlEditor-cfg-applyTo'> /**
  1114. </span> * @cfg {String} applyTo @hide
  1115. */
  1116. <span id='Ext-form-HtmlEditor-cfg-autoHeight'> /**
  1117. </span> * @cfg {String} autoHeight @hide
  1118. */
  1119. <span id='Ext-form-HtmlEditor-cfg-autoWidth'> /**
  1120. </span> * @cfg {String} autoWidth @hide
  1121. */
  1122. <span id='Ext-form-HtmlEditor-cfg-cls'> /**
  1123. </span> * @cfg {String} cls @hide
  1124. */
  1125. <span id='Ext-form-HtmlEditor-cfg-disabled'> /**
  1126. </span> * @cfg {String} disabled @hide
  1127. */
  1128. <span id='Ext-form-HtmlEditor-cfg-disabledClass'> /**
  1129. </span> * @cfg {String} disabledClass @hide
  1130. */
  1131. <span id='Ext-form-HtmlEditor-cfg-msgTarget'> /**
  1132. </span> * @cfg {String} msgTarget @hide
  1133. */
  1134. <span id='Ext-form-HtmlEditor-cfg-readOnly'> /**
  1135. </span> * @cfg {String} readOnly @hide
  1136. */
  1137. <span id='Ext-form-HtmlEditor-cfg-style'> /**
  1138. </span> * @cfg {String} style @hide
  1139. */
  1140. <span id='Ext-form-HtmlEditor-cfg-validationDelay'> /**
  1141. </span> * @cfg {String} validationDelay @hide
  1142. */
  1143. <span id='Ext-form-HtmlEditor-cfg-validationEvent'> /**
  1144. </span> * @cfg {String} validationEvent @hide
  1145. */
  1146. <span id='Ext-form-HtmlEditor-cfg-tabIndex'> /**
  1147. </span> * @cfg {String} tabIndex @hide
  1148. */
  1149. <span id='Ext-form-HtmlEditor-property-disabled'> /**
  1150. </span> * @property disabled
  1151. * @hide
  1152. */
  1153. <span id='Ext-form-HtmlEditor-method-applyToMarkup'> /**
  1154. </span> * @method applyToMarkup
  1155. * @hide
  1156. */
  1157. <span id='Ext-form-HtmlEditor-method-disable'> /**
  1158. </span> * @method disable
  1159. * @hide
  1160. */
  1161. <span id='Ext-form-HtmlEditor-method-enable'> /**
  1162. </span> * @method enable
  1163. * @hide
  1164. */
  1165. <span id='Ext-form-HtmlEditor-method-validate'> /**
  1166. </span> * @method validate
  1167. * @hide
  1168. */
  1169. <span id='Ext-form-HtmlEditor-event-valid'> /**
  1170. </span> * @event valid
  1171. * @hide
  1172. */
  1173. <span id='Ext-form-HtmlEditor-method-setDisabled'> /**
  1174. </span> * @method setDisabled
  1175. * @hide
  1176. */
  1177. <span id='Ext-form-HtmlEditor-cfg-keys'> /**
  1178. </span> * @cfg keys
  1179. * @hide
  1180. */
  1181. });
  1182. Ext.reg('htmleditor', Ext.form.HtmlEditor);
  1183. </pre>
  1184. </body>
  1185. </html>