Roo/htmleditor/TidyWriter.js
[roojs1] / Roo / HtmlEditorCore.js
index 78f3e14..64b7d21 100644 (file)
@@ -127,7 +127,7 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component,  {
      * @cfg {String} language default en - language of text (usefull for rtl languages)
      * 
      */
-    language: false,
+    language: 'en',
     
     /**
      * @cfg {boolean} allowComments - default false - allow comments in HTML source
@@ -438,6 +438,7 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component,  {
             }
             
             Roo.htmleditor.Block.initAll(this.doc.body);
+            this.updateLanguage();
             
             var lc = this.doc.body.lastChild;
             if (lc && lc.nodeType == 1 && lc.getAttribute("contenteditable") == "false") {
@@ -509,7 +510,7 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component,  {
         dbody.bgProperties = 'fixed'; // ie
         //Roo.DomHelper.applyStyles(dbody, ss);
         Roo.EventManager.on(this.doc, {
-            //'mousedown': this.onEditorEvent,
+             
             'mouseup': this.onEditorEvent,
             'dblclick': this.onEditorEvent,
             'click': this.onEditorEvent,
@@ -540,7 +541,8 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component,  {
         this.owner.fireEvent('initialize', this);
         this.pushValue();
     },
-    
+    // this is to prevent a href clicks resulting in a redirect?
+   
     onPasteEvent : function(e,v)
     {
         // I think we better assume paste is going to be a dirty load of rubish from word..
@@ -699,6 +701,7 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component,  {
 
     onEditorEvent : function(e)
     {
+         
         
         if (e && (e.ctrlKey || e.metaKey) && e.keyCode === 90) {
             return; // we do not handle this.. (undo manager does..)
@@ -1433,7 +1436,10 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component,  {
     
     updateLanguage : function()
     {
-        Roo.get(_this.ifream.content.body).attr("lang", this.lang);
+        if (!this.iframe || !this.iframe.contentDocument) {
+            return;
+        }
+        Roo.get(this.iframe.contentDocument.body).attr("lang", this.language);
     },