[FIX] web: more backports for cleditor
authorThibault Delavallée <tde@openerp.com>
Wed, 5 Mar 2014 10:49:31 +0000 (11:49 +0100)
committerMartin Trigaux <mat@odoo.com>
Mon, 3 Nov 2014 16:47:03 +0000 (17:47 +0100)
Restauring changes removed by the update of the library
bff34f4014aee31aac7412cc38598adbeb8230f0
17a23c60b80474f053997f90d05a94acb8561604
cc23ddd0cec62342d538c17140840f7dda569d0b
5c45aac7ef9df8f2f0d2aeb213813a99dfb2a8c7

addons/web/static/lib/cleditor/jquery.cleditor.js

index 7852037..5a30d29 100644 (file)
@@ -47,7 +47,7 @@
       docCSSFile:   // CSS file used to style the document contained within the editor\r
                     "", \r
       bodyStyle:    // style to assign to document body contained within the editor\r
-                    "margin:4px; font:10pt Arial,Verdana; cursor:text"\r
+                    "margin:4px; color:#4c4c4c; font-size:13px; font-family:\"Lucida Grande\",Helvetica,Verdana,Arial,sans-serif; cursor:text"\r
     },\r
 \r
     // Define all usable toolbar buttons - the init string property is \r
 \r
     // Bind the window resize event when the width or height is auto or %\r
     if (/auto|%/.test("" + options.width + options.height))\r
-      $(window).bind('resize.cleditor', function () { refresh(editor); });\r
-\r
+      $(window).bind('resize.cleditor', function () {\r
+        //Forcefully blurred iframe contentWindow, chrome, IE, safari doesn't trigger blur on window resize and due to which text disappears\r
+        var contentWindow = editor.$frame[0].contentWindow;\r
+        if(!$.browser.mozilla && contentWindow){\r
+          $(contentWindow).trigger('blur');\r
+        }\r
+        // CHM Note MonkeyPatch: if the DOM is not remove, refresh the cleditor\r
+        if(editor.$main.parent().parent().size()) {\r
+          refresh(editor);\r
+        }\r
+      });\r
     // Create the iframe and resize the controls\r
     refresh(editor);\r
 \r
 \r
   // change - shortcut for .bind("change", handler) or .trigger("change")\r
   fn.change = function change(handler) {\r
-    console.log('change test');\r
     var $this = $(this);\r
     return handler ? $this.bind(CHANGE, handler) : $this.trigger(CHANGE);\r
   };\r
   //==================\r
   // Private Functions\r
   //==================\r
-
+\r
   // checksum - returns a checksum using the Adler-32 method\r
   function checksum(text)\r
   {\r
 \r
       var $toolbar = editor.$toolbar,\r
           $group = $toolbar.children("div:last"),\r
-          wid = $main.width();\r
+          wid = /%/.test("" + options.width) ? options.width : $main.width();\r
 \r
       // Resize the toolbar\r
       var hgt = $group.offset().top + $group.outerHeight() - $toolbar.offset().top + 1;\r