Roo/form/HtmlEditor.js
authorAlan Knowles <alan@akbkhome.com>
Fri, 23 Mar 2012 05:37:19 +0000 (13:37 +0800)
committerAlan Knowles <alan@akbkhome.com>
Fri, 23 Mar 2012 05:37:19 +0000 (13:37 +0800)
Roo/form/HtmlEditor.js

index fd9cf30..11bb273 100644 (file)
@@ -428,7 +428,7 @@ Roo.form.HtmlEditor = Roo.extend(Roo.form.Field, {
     syncValue : function(){
         if(this.initialized){
             var bd = (this.doc.body || this.doc.documentElement);
-            //this.cleanUpPaste();
+            //this.cleanUpPaste(); -- this is done else where and causes havoc..
             var html = bd.innerHTML;
             if(Roo.isSafari){
                 var bs = bd.getAttribute('style'); // Safari puts text-align styles on the body element!
@@ -663,6 +663,42 @@ Roo.form.HtmlEditor = Roo.extend(Roo.form.Field, {
         this.syncValue();
     },
 
+    // private
+    applyCommand : function(e)
+    {
+        if(!e.ctrlKey){
+            return;
+        }
+        // decide what to do with ctrl characters.
+        
+        var c = e.getCharCode(), cmd;
+        if(c > 0){
+            c = String.fromCharCode(c);
+            switch(c){
+                case 'b':
+                    cmd = 'bold';
+                break;
+                case 'i':
+                    cmd = 'italic';
+                break;
+                case 'u':
+                    cmd = 'underline';
+                break;
+            }
+            if(cmd){
+                this.win.focus();
+                this.execCmd(cmd);
+                this.deferFocus();
+                e.preventDefault();
+            }
+        }
+        
+    },
+
+
+
+
+
    
     /**
      * Inserts the passed text at the current cursor position. Note: the editor must be initialized and activated