-<html>\r
-<head>\r
- <title>The source code</title>\r
- <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
- <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
-</head>\r
-<body onload="prettyPrint();">\r
- <pre class="prettyprint lang-js"><div id="cls-Ext.form.HtmlEditor"></div>/**\r
+<html>
+<head>
+ <title>The source code</title>
+ <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
+ <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
+</head>
+<body onload="prettyPrint();">
+ <pre class="prettyprint lang-js">/*!
+ * Ext JS Library 3.0.3
+ * Copyright(c) 2006-2009 Ext JS, LLC
+ * licensing@extjs.com
+ * http://www.extjs.com/license
+ */
+<div id="cls-Ext.form.HtmlEditor"></div>/**\r
* @class Ext.form.HtmlEditor\r
* @extends Ext.form.Field\r
* Provides a lightweight HTML Editor component. Some toolbar features are not supported by Safari and will be \r
<div id="cfg-Ext.form.HtmlEditor-defaultValue"></div>/**\r
* @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
*/\r
- defaultValue: (Ext.isOpera || Ext.isIE6) ? ' ' : '​',\r
+ defaultValue: (Ext.isOpera || Ext.isIE6) ? ' ' : '​',\r
\r
// private properties\r
actionMode: 'wrap',\r
var sz = this.el.getSize();\r
this.setSize(sz.width, this.height || sz.height);\r
}\r
+ this.resizeEl = this.positionEl = this.wrap;\r
},\r
\r
createIFrame: function(){\r
var iframe = document.createElement('iframe');\r
iframe.name = Ext.id();\r
iframe.frameBorder = '0';\r
- iframe.src = Ext.isIE ? Ext.SSL_SECURE_URL : "javascript:;";\r
+ iframe.src = Ext.SSL_SECURE_URL;\r
this.wrap.dom.appendChild(iframe);\r
\r
this.iframe = iframe;\r
this.fontSelect.dom.disabled = disabled;\r
}\r
this.tb.items.each(function(item){\r
- if(item.itemId != 'sourceedit'){\r
+ if(item.getItemId() != 'sourceedit'){\r
item.setDisabled(disabled);\r
}\r
});\r
onResize : function(w, h){\r
Ext.form.HtmlEditor.superclass.onResize.apply(this, arguments);\r
if(this.el && this.iframe){\r
- if(typeof w == 'number'){\r
+ if(Ext.isNumber(w)){\r
var aw = w - this.wrap.getFrameWidth('lr');\r
- this.el.setWidth(this.adjustWidth('textarea', aw));\r
+ this.el.setWidth(aw);\r
this.tb.setWidth(aw);\r
this.iframe.style.width = Math.max(aw, 0) + 'px';\r
}\r
- if(typeof h == 'number'){\r
+ if(Ext.isNumber(h)){\r
var ah = h - this.wrap.getFrameWidth('tb') - this.tb.el.getHeight();\r
- this.el.setHeight(this.adjustWidth('textarea', ah));\r
+ this.el.setHeight(ah);\r
this.iframe.style.height = Math.max(ah, 0) + 'px';\r
if(this.doc){\r
this.getEditorBody().style.height = Math.max((ah - (this.iframePad*2)), 0) + 'px';\r
}\r
},\r
\r
- // private (for BoxComponent)\r
- adjustSize : Ext.BoxComponent.prototype.adjustSize,\r
-\r
- // private (for BoxComponent)\r
- getResizeEl : function(){\r
- return this.wrap;\r
- },\r
-\r
- // private (for BoxComponent)\r
- getPositionEl : function(){\r
- return this.wrap;\r
- },\r
-\r
// private\r
initEvents : function(){\r
this.originalValue = this.getValue();\r
* @param {String} html The HTML to be cleaned\r
* @return {String} The cleaned HTML\r
*/\r
- cleanHtml : function(html){\r
+ cleanHtml: function(html) {\r
html = String(html);\r
- if(html.length > 5){\r
- if(Ext.isWebKit){ // strip safari nonsense\r
- html = html.replace(/\sclass="(?:Apple-style-span|khtml-block-placeholder)"/gi, '');\r
- }\r
+ if(Ext.isWebKit){ // strip safari nonsense\r
+ html = html.replace(/\sclass="(?:Apple-style-span|khtml-block-placeholder)"/gi, '');\r
}\r
- if(html == this.defaultValue){\r
- html = '';\r
+ \r
+ /*\r
+ * Neat little hack. Strips out all the non-digit characters from the default\r
+ * value and compares it to the character code of the first character in the string\r
+ * because it can cause encoding issues when posted to the server.\r
+ */\r
+ if(html.charCodeAt(0) == this.defaultValue.replace(/\D/g, '')){\r
+ html = html.substring(1);\r
}\r
return html;\r
},\r
\r
// private\r
adjustFont: function(btn){\r
- var adjust = btn.itemId == 'increasefontsize' ? 1 : -1;\r
+ var adjust = btn.getItemId() == 'increasefontsize' ? 1 : -1;\r
\r
var v = parseInt(this.doc.queryCommandValue('FontSize') || 2, 10);\r
if((Ext.isSafari && !Ext.isSafari2) || Ext.isChrome || Ext.isAir){\r
\r
// private\r
relayBtnCmd : function(btn){\r
- this.relayCmd(btn.itemId);\r
+ this.relayCmd(btn.getItemId());\r
},\r
\r
<div id="method-Ext.form.HtmlEditor-relayCmd"></div>/**\r
this.syncValue();\r
this.deferFocus();\r
}\r
- }else if(Ext.isGecko || Ext.isOpera){\r
+ }else{\r
this.win.focus();\r
this.execCmd('InsertHTML', text);\r
this.deferFocus();\r
- }else if(Ext.isWebKit){\r
- this.execCmd('InsertText', text);\r
- this.deferFocus();\r
}\r
},\r
\r
e.stopEvent();\r
this.execCmd('InsertText','\t');\r
this.deferFocus();\r
+ }else if(k == e.ENTER){\r
+ e.stopEvent();\r
+ this.execCmd('InsertHtml','<br /><br />');\r
+ this.deferFocus();\r
}\r
};\r
}\r
* @hide\r
*/\r
});\r
-Ext.reg('htmleditor', Ext.form.HtmlEditor);</pre> \r
-</body>\r
+Ext.reg('htmleditor', Ext.form.HtmlEditor);</pre>
+</body>
</html>
\ No newline at end of file