3 * Copyright(c) 2006-2009 Ext JS, LLC
5 * http://www.extjs.com/license
8 * @class Ext.form.HtmlEditor
\r
9 * @extends Ext.form.Field
\r
10 * Provides a lightweight HTML Editor component. Some toolbar features are not supported by Safari and will be
\r
11 * automatically hidden when needed. These are noted in the config options where appropriate.
\r
12 * <br><br>The editor's toolbar buttons have tooltips defined in the {@link #buttonTips} property, but they are not
\r
13 * enabled by default unless the global {@link Ext.QuickTips} singleton is {@link Ext.QuickTips#init initialized}.
\r
14 * <br><br><b>Note: The focus/blur and validation marking functionality inherited from Ext.form.Field is NOT
\r
15 * supported by this editor.</b>
\r
16 * <br><br>An Editor is a sensitive component that can't be used in all spots standard fields can be used. Putting an Editor within
\r
17 * any element that has display set to 'none' can cause problems in Safari and Firefox due to their default iframe reloading bugs.
\r
18 * <br><br>Example usage:
\r
20 // Simple example rendered with default options:
\r
21 Ext.QuickTips.init(); // enable tooltips
\r
22 new Ext.form.HtmlEditor({
\r
23 renderTo: Ext.getBody(),
\r
28 // Passed via xtype into a container and with custom options:
\r
29 Ext.QuickTips.init(); // enable tooltips
\r
31 title: 'HTML Editor',
\r
32 renderTo: Ext.getBody(),
\r
38 xtype: 'htmleditor',
\r
39 enableColors: false,
\r
40 enableAlignments: false
\r
45 * Create a new HtmlEditor
\r
46 * @param {Object} config
\r
50 Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, {
\r
52 * @cfg {Boolean} enableFormat Enable the bold, italic and underline buttons (defaults to true)
\r
54 enableFormat : true,
\r
56 * @cfg {Boolean} enableFontSize Enable the increase/decrease font size buttons (defaults to true)
\r
58 enableFontSize : true,
\r
60 * @cfg {Boolean} enableColors Enable the fore/highlight color buttons (defaults to true)
\r
62 enableColors : true,
\r
64 * @cfg {Boolean} enableAlignments Enable the left, center, right alignment buttons (defaults to true)
\r
66 enableAlignments : true,
\r
68 * @cfg {Boolean} enableLists Enable the bullet and numbered list buttons. Not available in Safari. (defaults to true)
\r
72 * @cfg {Boolean} enableSourceEdit Enable the switch to source edit button. Not available in Safari. (defaults to true)
\r
74 enableSourceEdit : true,
\r
76 * @cfg {Boolean} enableLinks Enable the create link button. Not available in Safari. (defaults to true)
\r
80 * @cfg {Boolean} enableFont Enable font selection. Not available in Safari. (defaults to true)
\r
84 * @cfg {String} createLinkText The default text for the create link prompt
\r
86 createLinkText : 'Please enter the URL for the link:',
\r
88 * @cfg {String} defaultLinkValue The default value for the create link prompt (defaults to http:/ /)
\r
90 defaultLinkValue : 'http:/'+'/',
\r
92 * @cfg {Array} fontFamilies An array of available font families
\r
101 defaultFont: 'tahoma',
\r
103 * @cfg {String} defaultValue A default value to be put into the editor to resolve focus issues (defaults to ​ (Zero-width space), (Non-breaking space) in Opera and IE6).
\r
105 defaultValue: (Ext.isOpera || Ext.isIE6) ? ' ' : '​',
\r
107 // private properties
\r
108 actionMode: 'wrap',
\r
109 validationEvent : false,
\r
111 initialized : false,
\r
113 sourceEditMode : false,
\r
114 onFocus : Ext.emptyFn,
\r
116 hideMode:'offsets',
\r
117 defaultAutoCreate : {
\r
119 style:"width:500px;height:300px;",
\r
120 autocomplete: "off"
\r
124 initComponent : function(){
\r
127 * @event initialize
\r
128 * Fires when the editor is fully initialized (including the iframe)
\r
129 * @param {HtmlEditor} this
\r
134 * Fires when the editor is first receives the focus. Any insertion must wait
\r
135 * until after this event.
\r
136 * @param {HtmlEditor} this
\r
140 * @event beforesync
\r
141 * Fires before the textarea is updated with content from the editor iframe. Return false
\r
142 * to cancel the sync.
\r
143 * @param {HtmlEditor} this
\r
144 * @param {String} html
\r
148 * @event beforepush
\r
149 * Fires before the iframe editor is updated with content from the textarea. Return false
\r
150 * to cancel the push.
\r
151 * @param {HtmlEditor} this
\r
152 * @param {String} html
\r
157 * Fires when the textarea is updated with content from the editor iframe.
\r
158 * @param {HtmlEditor} this
\r
159 * @param {String} html
\r
164 * Fires when the iframe editor is updated with content from the textarea.
\r
165 * @param {HtmlEditor} this
\r
166 * @param {String} html
\r
170 * @event editmodechange
\r
171 * Fires when the editor switches edit modes
\r
172 * @param {HtmlEditor} this
\r
173 * @param {Boolean} sourceEdit True if source edit, false if standard editing.
\r
180 createFontOptions : function(){
\r
181 var buf = [], fs = this.fontFamilies, ff, lc;
\r
182 for(var i = 0, len = fs.length; i< len; i++){
\r
184 lc = ff.toLowerCase();
\r
186 '<option value="',lc,'" style="font-family:',ff,';"',
\r
187 (this.defaultFont == lc ? ' selected="true">' : '>'),
\r
192 return buf.join('');
\r
196 * Protected method that will not generally be called directly. It
\r
197 * is called when the editor creates its toolbar. Override this method if you need to
\r
198 * add custom toolbar buttons.
\r
199 * @param {HtmlEditor} editor
\r
201 createToolbar : function(editor){
\r
203 var tipsEnabled = Ext.QuickTips && Ext.QuickTips.isEnabled();
\r
205 function btn(id, toggle, handler){
\r
208 cls : 'x-btn-icon',
\r
209 iconCls: 'x-edit-'+id,
\r
210 enableToggle:toggle !== false,
\r
212 handler:handler||editor.relayBtnCmd,
\r
213 clickEvent:'mousedown',
\r
214 tooltip: tipsEnabled ? editor.buttonTips[id] || undefined : undefined,
\r
215 overflowText: editor.buttonTips[id].title || undefined,
\r
220 // build the toolbar
\r
221 var tb = new Ext.Toolbar({
\r
222 renderTo:this.wrap.dom.firstChild
\r
225 // stop form submits
\r
226 this.mon(tb.el, 'click', function(e){
\r
227 e.preventDefault();
\r
230 if(this.enableFont && !Ext.isSafari2){
\r
231 this.fontSelect = tb.el.createChild({
\r
233 cls:'x-font-select',
\r
234 html: this.createFontOptions()
\r
236 this.mon(this.fontSelect, 'change', function(){
\r
237 var font = this.fontSelect.dom.value;
\r
238 this.relayCmd('fontname', font);
\r
243 this.fontSelect.dom,
\r
248 if(this.enableFormat){
\r
256 if(this.enableFontSize){
\r
259 btn('increasefontsize', false, this.adjustFont),
\r
260 btn('decreasefontsize', false, this.adjustFont)
\r
264 if(this.enableColors){
\r
267 itemId:'forecolor',
\r
269 iconCls: 'x-edit-forecolor',
\r
270 clickEvent:'mousedown',
\r
271 tooltip: tipsEnabled ? editor.buttonTips.forecolor || undefined : undefined,
\r
273 menu : new Ext.menu.ColorMenu({
\r
274 allowReselect: true,
\r
275 focus: Ext.emptyFn,
\r
280 select: function(cp, color){
\r
281 this.execCmd('forecolor', Ext.isWebKit || Ext.isIE ? '#'+color : color);
\r
285 clickEvent:'mousedown'
\r
288 itemId:'backcolor',
\r
290 iconCls: 'x-edit-backcolor',
\r
291 clickEvent:'mousedown',
\r
292 tooltip: tipsEnabled ? editor.buttonTips.backcolor || undefined : undefined,
\r
294 menu : new Ext.menu.ColorMenu({
\r
295 focus: Ext.emptyFn,
\r
298 allowReselect: true,
\r
301 select: function(cp, color){
\r
303 this.execCmd('useCSS', false);
\r
304 this.execCmd('hilitecolor', color);
\r
305 this.execCmd('useCSS', true);
\r
308 this.execCmd(Ext.isOpera ? 'hilitecolor' : 'backcolor', Ext.isWebKit || Ext.isIE ? '#'+color : color);
\r
313 clickEvent:'mousedown'
\r
319 if(this.enableAlignments){
\r
322 btn('justifyleft'),
\r
323 btn('justifycenter'),
\r
324 btn('justifyright')
\r
328 if(!Ext.isSafari2){
\r
329 if(this.enableLinks){
\r
332 btn('createlink', false, this.createLink)
\r
336 if(this.enableLists){
\r
339 btn('insertorderedlist'),
\r
340 btn('insertunorderedlist')
\r
343 if(this.enableSourceEdit){
\r
346 btn('sourceedit', true, function(btn){
\r
347 this.toggleSourceEdit(!this.sourceEditMode);
\r
357 * Protected method that will not generally be called directly. It
\r
358 * is called when the editor initializes the iframe with HTML contents. Override this method if you
\r
359 * want to change the initialization markup of the iframe (e.g. to add stylesheets).
\r
361 getDocMarkup : function(){
\r
362 return '<html><head><style type="text/css">body{border:0;margin:0;padding:3px;height:98%;cursor:text;}</style></head><body></body></html>';
\r
366 getEditorBody : function(){
\r
367 return this.doc.body || this.doc.documentElement;
\r
371 getDoc : function(){
\r
372 return Ext.isIE ? this.getWin().document : (this.iframe.contentDocument || this.getWin().document);
\r
376 getWin : function(){
\r
377 return Ext.isIE ? this.iframe.contentWindow : window.frames[this.iframe.name];
\r
381 onRender : function(ct, position){
\r
382 Ext.form.HtmlEditor.superclass.onRender.call(this, ct, position);
\r
383 this.el.dom.style.border = '0 none';
\r
384 this.el.dom.setAttribute('tabIndex', -1);
\r
385 this.el.addClass('x-hidden');
\r
386 if(Ext.isIE){ // fix IE 1px bogus margin
\r
387 this.el.applyStyles('margin-top:-1px;margin-bottom:-1px;')
\r
389 this.wrap = this.el.wrap({
\r
390 cls:'x-html-editor-wrap', cn:{cls:'x-html-editor-tb'}
\r
393 this.createToolbar(this);
\r
395 this.disableItems(true);
\r
397 // this.tb.doLayout();
\r
399 this.createIFrame();
\r
402 var sz = this.el.getSize();
\r
403 this.setSize(sz.width, this.height || sz.height);
\r
405 this.resizeEl = this.positionEl = this.wrap;
\r
408 createIFrame: function(){
\r
409 var iframe = document.createElement('iframe');
\r
410 iframe.name = Ext.id();
\r
411 iframe.frameBorder = '0';
\r
412 iframe.src = Ext.SSL_SECURE_URL;
\r
413 this.wrap.dom.appendChild(iframe);
\r
415 this.iframe = iframe;
\r
417 this.monitorTask = Ext.TaskMgr.start({
\r
418 run: this.checkDesignMode,
\r
424 initFrame : function(){
\r
425 Ext.TaskMgr.stop(this.monitorTask);
\r
426 this.doc = this.getDoc();
\r
427 this.win = this.getWin();
\r
430 this.doc.write(this.getDocMarkup());
\r
433 var task = { // must defer to wait for browser to be ready
\r
435 if(this.doc.body || this.doc.readyState == 'complete'){
\r
436 Ext.TaskMgr.stop(task);
\r
437 this.doc.designMode="on";
\r
438 this.initEditor.defer(10, this);
\r
445 Ext.TaskMgr.start(task);
\r
449 checkDesignMode : function(){
\r
450 if(this.wrap && this.wrap.dom.offsetWidth){
\r
451 var doc = this.getDoc();
\r
455 if(!doc.editorInitialized || String(doc.designMode).toLowerCase() != 'on'){
\r
461 disableItems: function(disabled){
\r
462 if(this.fontSelect){
\r
463 this.fontSelect.dom.disabled = disabled;
\r
465 this.tb.items.each(function(item){
\r
466 if(item.getItemId() != 'sourceedit'){
\r
467 item.setDisabled(disabled);
\r
473 onResize : function(w, h){
\r
474 Ext.form.HtmlEditor.superclass.onResize.apply(this, arguments);
\r
475 if(this.el && this.iframe){
\r
476 if(Ext.isNumber(w)){
\r
477 var aw = w - this.wrap.getFrameWidth('lr');
\r
478 this.el.setWidth(aw);
\r
479 this.tb.setWidth(aw);
\r
480 this.iframe.style.width = Math.max(aw, 0) + 'px';
\r
482 if(Ext.isNumber(h)){
\r
483 var ah = h - this.wrap.getFrameWidth('tb') - this.tb.el.getHeight();
\r
484 this.el.setHeight(ah);
\r
485 this.iframe.style.height = Math.max(ah, 0) + 'px';
\r
487 this.getEditorBody().style.height = Math.max((ah - (this.iframePad*2)), 0) + 'px';
\r
494 * Toggles the editor between standard and source edit mode.
\r
495 * @param {Boolean} sourceEdit (optional) True for source edit, false for standard
\r
497 toggleSourceEdit : function(sourceEditMode){
\r
498 if(sourceEditMode === undefined){
\r
499 sourceEditMode = !this.sourceEditMode;
\r
501 this.sourceEditMode = sourceEditMode === true;
\r
502 var btn = this.tb.items.get('sourceedit');
\r
503 if(btn.pressed !== this.sourceEditMode){
\r
504 btn.toggle(this.sourceEditMode);
\r
505 if(!btn.xtbHidden){
\r
509 if(this.sourceEditMode){
\r
510 this.disableItems(true);
\r
512 this.iframe.className = 'x-hidden';
\r
513 this.el.removeClass('x-hidden');
\r
514 this.el.dom.removeAttribute('tabIndex');
\r
517 if(this.initialized){
\r
518 this.disableItems(false);
\r
521 this.iframe.className = '';
\r
522 this.el.addClass('x-hidden');
\r
523 this.el.dom.setAttribute('tabIndex', -1);
\r
526 var lastSize = this.lastSize;
\r
528 delete this.lastSize;
\r
529 this.setSize(lastSize);
\r
531 this.fireEvent('editmodechange', this, this.sourceEditMode);
\r
534 // private used internally
\r
535 createLink : function(){
\r
536 var url = prompt(this.createLinkText, this.defaultLinkValue);
\r
537 if(url && url != 'http:/'+'/'){
\r
538 this.relayCmd('createlink', url);
\r
543 initEvents : function(){
\r
544 this.originalValue = this.getValue();
\r
548 * Overridden and disabled. The editor element does not support standard valid/invalid marking. @hide
\r
551 markInvalid : Ext.emptyFn,
\r
554 * Overridden and disabled. The editor element does not support standard valid/invalid marking. @hide
\r
557 clearInvalid : Ext.emptyFn,
\r
559 // docs inherit from Field
\r
560 setValue : function(v){
\r
561 Ext.form.HtmlEditor.superclass.setValue.call(this, v);
\r
567 * Protected method that will not generally be called directly. If you need/want
\r
568 * custom HTML cleanup, this is the method you should override.
\r
569 * @param {String} html The HTML to be cleaned
\r
570 * @return {String} The cleaned HTML
\r
572 cleanHtml: function(html) {
\r
573 html = String(html);
\r
574 if(Ext.isWebKit){ // strip safari nonsense
\r
575 html = html.replace(/\sclass="(?:Apple-style-span|khtml-block-placeholder)"/gi, '');
\r
579 * Neat little hack. Strips out all the non-digit characters from the default
\r
580 * value and compares it to the character code of the first character in the string
\r
581 * because it can cause encoding issues when posted to the server.
\r
583 if(html.charCodeAt(0) == this.defaultValue.replace(/\D/g, '')){
\r
584 html = html.substring(1);
\r
590 * Protected method that will not generally be called directly. Syncs the contents
\r
591 * of the editor iframe with the textarea.
\r
593 syncValue : function(){
\r
594 if(this.initialized){
\r
595 var bd = this.getEditorBody();
\r
596 var html = bd.innerHTML;
\r
598 var bs = bd.getAttribute('style'); // Safari puts text-align styles on the body element!
\r
599 var m = bs.match(/text-align:(.*?);/i);
\r
601 html = '<div style="'+m[0]+'">' + html + '</div>';
\r
604 html = this.cleanHtml(html);
\r
605 if(this.fireEvent('beforesync', this, html) !== false){
\r
606 this.el.dom.value = html;
\r
607 this.fireEvent('sync', this, html);
\r
612 //docs inherit from Field
\r
613 getValue : function() {
\r
614 this[this.sourceEditMode ? 'pushValue' : 'syncValue']();
\r
615 return Ext.form.HtmlEditor.superclass.getValue.call(this);
\r
619 * Protected method that will not generally be called directly. Pushes the value of the textarea
\r
620 * into the iframe editor.
\r
622 pushValue : function(){
\r
623 if(this.initialized){
\r
624 var v = this.el.dom.value;
\r
625 if(!this.activated && v.length < 1){
\r
626 v = this.defaultValue;
\r
628 if(this.fireEvent('beforepush', this, v) !== false){
\r
629 this.getEditorBody().innerHTML = v;
\r
631 // Gecko hack, see: https://bugzilla.mozilla.org/show_bug.cgi?id=232791#c8
\r
633 mode = d.designMode.toLowerCase();
\r
635 d.designMode = mode.toggle('on', 'off');
\r
636 d.designMode = mode;
\r
638 this.fireEvent('push', this, v);
\r
644 deferFocus : function(){
\r
645 this.focus.defer(10, this);
\r
648 // docs inherit from Field
\r
649 focus : function(){
\r
650 if(this.win && !this.sourceEditMode){
\r
658 initEditor : function(){
\r
659 //Destroying the component during/before initEditor can cause issues.
\r
661 var dbody = this.getEditorBody();
\r
662 var ss = this.el.getStyles('font-size', 'font-family', 'background-image', 'background-repeat');
\r
663 ss['background-attachment'] = 'fixed'; // w3c
\r
664 dbody.bgProperties = 'fixed'; // ie
\r
666 Ext.DomHelper.applyStyles(dbody, ss);
\r
670 Ext.EventManager.removeAll(this.doc);
\r
674 this.doc = this.getDoc();
\r
676 Ext.EventManager.on(this.doc, {
\r
677 'mousedown': this.onEditorEvent,
\r
678 'dblclick': this.onEditorEvent,
\r
679 'click': this.onEditorEvent,
\r
680 'keyup': this.onEditorEvent,
\r
686 Ext.EventManager.on(this.doc, 'keypress', this.applyCommand, this);
\r
688 if(Ext.isIE || Ext.isWebKit || Ext.isOpera){
\r
689 Ext.EventManager.on(this.doc, 'keydown', this.fixKeys, this);
\r
691 this.initialized = true;
\r
692 this.fireEvent('initialize', this);
\r
693 this.doc.editorInitialized = true;
\r
699 onDestroy : function(){
\r
700 if(this.monitorTask){
\r
701 Ext.TaskMgr.stop(this.monitorTask);
\r
704 Ext.destroy(this.tb);
\r
706 this.wrap.dom.innerHTML = '';
\r
707 this.wrap.remove();
\r
711 this.el.removeAllListeners();
\r
717 Ext.EventManager.removeAll(this.doc);
\r
718 for (var prop in this.doc){
\r
719 delete this.doc[prop];
\r
723 this.purgeListeners();
\r
727 onFirstFocus : function(){
\r
728 this.activated = true;
\r
729 this.disableItems(false);
\r
730 if(Ext.isGecko){ // prevent silly gecko errors
\r
732 var s = this.win.getSelection();
\r
733 if(!s.focusNode || s.focusNode.nodeType != 3){
\r
734 var r = s.getRangeAt(0);
\r
735 r.selectNodeContents(this.getEditorBody());
\r
740 this.execCmd('useCSS', true);
\r
741 this.execCmd('styleWithCSS', false);
\r
744 this.fireEvent('activate', this);
\r
748 adjustFont: function(btn){
\r
749 var adjust = btn.getItemId() == 'increasefontsize' ? 1 : -1;
\r
751 var v = parseInt(this.doc.queryCommandValue('FontSize') || 2, 10);
\r
752 if((Ext.isSafari && !Ext.isSafari2) || Ext.isChrome || Ext.isAir){
\r
754 // 1 = 10px, 2 = 13px, 3 = 16px, 4 = 18px, 5 = 24px, 6 = 32px
\r
768 v = v.constrain(1, 6);
\r
770 if(Ext.isSafari){ // safari
\r
773 v = Math.max(1, v+adjust) + (Ext.isSafari ? 'px' : 0);
\r
775 this.execCmd('FontSize', v);
\r
779 onEditorEvent : function(e){
\r
780 this.updateToolbar();
\r
785 * Protected method that will not generally be called directly. It triggers
\r
786 * a toolbar update by reading the markup state of the current selection in the editor.
\r
788 updateToolbar: function(){
\r
790 if(!this.activated){
\r
791 this.onFirstFocus();
\r
795 var btns = this.tb.items.map, doc = this.doc;
\r
797 if(this.enableFont && !Ext.isSafari2){
\r
798 var name = (this.doc.queryCommandValue('FontName')||this.defaultFont).toLowerCase();
\r
799 if(name != this.fontSelect.dom.value){
\r
800 this.fontSelect.dom.value = name;
\r
803 if(this.enableFormat){
\r
804 btns.bold.toggle(doc.queryCommandState('bold'));
\r
805 btns.italic.toggle(doc.queryCommandState('italic'));
\r
806 btns.underline.toggle(doc.queryCommandState('underline'));
\r
808 if(this.enableAlignments){
\r
809 btns.justifyleft.toggle(doc.queryCommandState('justifyleft'));
\r
810 btns.justifycenter.toggle(doc.queryCommandState('justifycenter'));
\r
811 btns.justifyright.toggle(doc.queryCommandState('justifyright'));
\r
813 if(!Ext.isSafari2 && this.enableLists){
\r
814 btns.insertorderedlist.toggle(doc.queryCommandState('insertorderedlist'));
\r
815 btns.insertunorderedlist.toggle(doc.queryCommandState('insertunorderedlist'));
\r
818 Ext.menu.MenuMgr.hideAll();
\r
824 relayBtnCmd : function(btn){
\r
825 this.relayCmd(btn.getItemId());
\r
829 * Executes a Midas editor command on the editor document and performs necessary focus and
\r
830 * toolbar updates. <b>This should only be called after the editor is initialized.</b>
\r
831 * @param {String} cmd The Midas command
\r
832 * @param {String/Boolean} value (optional) The value to pass to the command (defaults to null)
\r
834 relayCmd : function(cmd, value){
\r
837 this.execCmd(cmd, value);
\r
838 this.updateToolbar();
\r
839 }).defer(10, this);
\r
843 * Executes a Midas editor command directly on the editor document.
\r
844 * For visual commands, you should use {@link #relayCmd} instead.
\r
845 * <b>This should only be called after the editor is initialized.</b>
\r
846 * @param {String} cmd The Midas command
\r
847 * @param {String/Boolean} value (optional) The value to pass to the command (defaults to null)
\r
849 execCmd : function(cmd, value){
\r
850 this.doc.execCommand(cmd, false, value === undefined ? null : value);
\r
855 applyCommand : function(e){
\r
857 var c = e.getCharCode(), cmd;
\r
859 c = String.fromCharCode(c);
\r
875 e.preventDefault();
\r
882 * Inserts the passed text at the current cursor position. Note: the editor must be initialized and activated
\r
884 * @param {String} text
\r
886 insertAtCursor : function(text){
\r
887 if(!this.activated){
\r
892 var r = this.doc.selection.createRange();
\r
901 this.execCmd('InsertHTML', text);
\r
907 fixKeys : function(){ // load time branching for fastest keydown performance
\r
909 return function(e){
\r
910 var k = e.getKey(), r;
\r
913 r = this.doc.selection.createRange();
\r
916 r.pasteHTML(' ');
\r
919 }else if(k == e.ENTER){
\r
920 r = this.doc.selection.createRange();
\r
922 var target = r.parentElement();
\r
923 if(!target || target.tagName.toLowerCase() != 'li'){
\r
925 r.pasteHTML('<br />');
\r
932 }else if(Ext.isOpera){
\r
933 return function(e){
\r
934 var k = e.getKey();
\r
938 this.execCmd('InsertHTML',' ');
\r
942 }else if(Ext.isWebKit){
\r
943 return function(e){
\r
944 var k = e.getKey();
\r
947 this.execCmd('InsertText','\t');
\r
949 }else if(k == e.ENTER){
\r
951 this.execCmd('InsertHtml','<br /><br />');
\r
959 * Returns the editor's toolbar. <b>This is only available after the editor has been rendered.</b>
\r
960 * @return {Ext.Toolbar}
\r
962 getToolbar : function(){
\r
967 * Object collection of toolbar tooltips for the buttons in the editor. The key
\r
968 * is the command id associated with that button and the value is a valid QuickTips object.
\r
973 title: 'Bold (Ctrl+B)',
\r
974 text: 'Make the selected text bold.',
\r
975 cls: 'x-html-editor-tip'
\r
978 title: 'Italic (Ctrl+I)',
\r
979 text: 'Make the selected text italic.',
\r
980 cls: 'x-html-editor-tip'
\r
988 title: 'Bold (Ctrl+B)',
\r
989 text: 'Make the selected text bold.',
\r
990 cls: 'x-html-editor-tip'
\r
993 title: 'Italic (Ctrl+I)',
\r
994 text: 'Make the selected text italic.',
\r
995 cls: 'x-html-editor-tip'
\r
998 title: 'Underline (Ctrl+U)',
\r
999 text: 'Underline the selected text.',
\r
1000 cls: 'x-html-editor-tip'
\r
1002 increasefontsize : {
\r
1003 title: 'Grow Text',
\r
1004 text: 'Increase the font size.',
\r
1005 cls: 'x-html-editor-tip'
\r
1007 decreasefontsize : {
\r
1008 title: 'Shrink Text',
\r
1009 text: 'Decrease the font size.',
\r
1010 cls: 'x-html-editor-tip'
\r
1013 title: 'Text Highlight Color',
\r
1014 text: 'Change the background color of the selected text.',
\r
1015 cls: 'x-html-editor-tip'
\r
1018 title: 'Font Color',
\r
1019 text: 'Change the color of the selected text.',
\r
1020 cls: 'x-html-editor-tip'
\r
1023 title: 'Align Text Left',
\r
1024 text: 'Align text to the left.',
\r
1025 cls: 'x-html-editor-tip'
\r
1028 title: 'Center Text',
\r
1029 text: 'Center text in the editor.',
\r
1030 cls: 'x-html-editor-tip'
\r
1033 title: 'Align Text Right',
\r
1034 text: 'Align text to the right.',
\r
1035 cls: 'x-html-editor-tip'
\r
1037 insertunorderedlist : {
\r
1038 title: 'Bullet List',
\r
1039 text: 'Start a bulleted list.',
\r
1040 cls: 'x-html-editor-tip'
\r
1042 insertorderedlist : {
\r
1043 title: 'Numbered List',
\r
1044 text: 'Start a numbered list.',
\r
1045 cls: 'x-html-editor-tip'
\r
1048 title: 'Hyperlink',
\r
1049 text: 'Make the selected text a hyperlink.',
\r
1050 cls: 'x-html-editor-tip'
\r
1053 title: 'Source Edit',
\r
1054 text: 'Switch to source editing mode.',
\r
1055 cls: 'x-html-editor-tip'
\r
1059 // hide stuff that is not compatible
\r
1073 * @event specialkey
\r
1077 * @cfg {String} fieldClass @hide
\r
1080 * @cfg {String} focusClass @hide
\r
1083 * @cfg {String} autoCreate @hide
\r
1086 * @cfg {String} inputType @hide
\r
1089 * @cfg {String} invalidClass @hide
\r
1092 * @cfg {String} invalidText @hide
\r
1095 * @cfg {String} msgFx @hide
\r
1098 * @cfg {String} validateOnBlur @hide
\r
1101 * @cfg {Boolean} allowDomMove @hide
\r
1104 * @cfg {String} applyTo @hide
\r
1107 * @cfg {String} autoHeight @hide
\r
1110 * @cfg {String} autoWidth @hide
\r
1113 * @cfg {String} cls @hide
\r
1116 * @cfg {String} disabled @hide
\r
1119 * @cfg {String} disabledClass @hide
\r
1122 * @cfg {String} msgTarget @hide
\r
1125 * @cfg {String} readOnly @hide
\r
1128 * @cfg {String} style @hide
\r
1131 * @cfg {String} validationDelay @hide
\r
1134 * @cfg {String} validationEvent @hide
\r
1137 * @cfg {String} tabIndex @hide
\r
1140 * @property disabled
\r
1144 * @method applyToMarkup
\r
1156 * @method validate
\r
1164 * @method setDisabled
\r
1172 Ext.reg('htmleditor', Ext.form.HtmlEditor);