From d115ef9b49dd2bc494cd13f2aa448965e8af08d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 5 Mar 2014 11:49:31 +0100 Subject: [PATCH] [FIX] web: more backports for cleditor Restauring changes removed by the update of the library bff34f4014aee31aac7412cc38598adbeb8230f0 17a23c60b80474f053997f90d05a94acb8561604 cc23ddd0cec62342d538c17140840f7dda569d0b 5c45aac7ef9df8f2f0d2aeb213813a99dfb2a8c7 --- .../static/lib/cleditor/jquery.cleditor.js | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/addons/web/static/lib/cleditor/jquery.cleditor.js b/addons/web/static/lib/cleditor/jquery.cleditor.js index 7852037de58..5a30d29a191 100644 --- a/addons/web/static/lib/cleditor/jquery.cleditor.js +++ b/addons/web/static/lib/cleditor/jquery.cleditor.js @@ -47,7 +47,7 @@ docCSSFile: // CSS file used to style the document contained within the editor "", bodyStyle: // style to assign to document body contained within the editor - "margin:4px; font:10pt Arial,Verdana; cursor:text" + "margin:4px; color:#4c4c4c; font-size:13px; font-family:\"Lucida Grande\",Helvetica,Verdana,Arial,sans-serif; cursor:text" }, // Define all usable toolbar buttons - the init string property is @@ -306,8 +306,17 @@ // Bind the window resize event when the width or height is auto or % if (/auto|%/.test("" + options.width + options.height)) - $(window).bind('resize.cleditor', function () { refresh(editor); }); - + $(window).bind('resize.cleditor', function () { + //Forcefully blurred iframe contentWindow, chrome, IE, safari doesn't trigger blur on window resize and due to which text disappears + var contentWindow = editor.$frame[0].contentWindow; + if(!$.browser.mozilla && contentWindow){ + $(contentWindow).trigger('blur'); + } + // CHM Note MonkeyPatch: if the DOM is not remove, refresh the cleditor + if(editor.$main.parent().parent().size()) { + refresh(editor); + } + }); // Create the iframe and resize the controls refresh(editor); @@ -357,7 +366,6 @@ // change - shortcut for .bind("change", handler) or .trigger("change") fn.change = function change(handler) { - console.log('change test'); var $this = $(this); return handler ? $this.bind(CHANGE, handler) : $this.trigger(CHANGE); }; @@ -586,7 +594,7 @@ //================== // Private Functions //================== - + // checksum - returns a checksum using the Adler-32 method function checksum(text) { @@ -929,7 +937,7 @@ var $toolbar = editor.$toolbar, $group = $toolbar.children("div:last"), - wid = $main.width(); + wid = /%/.test("" + options.width) ? options.width : $main.width(); // Resize the toolbar var hgt = $group.offset().top + $group.outerHeight() - $toolbar.offset().top + 1;