[FIX] cleditor: When the DOM is modify, the event resize try to call refresh and refresh has not DOM available. Correction : If the DOM as no prent, don't call refresh.

bzr revid: chm@openerp.com-20121029142557-q4wdjiqw5fortp36
This commit is contained in:
Christophe Matthieu 2012-10-29 15:25:57 +01:00
parent 631122ce7e
commit f3e397a98f
1 changed files with 9 additions and 6 deletions

View File

@ -275,7 +275,6 @@
button.popupContent, button.popupHover); button.popupContent, button.popupHover);
} }
}); });
// Add the main div to the DOM and append the textarea // Add the main div to the DOM and append the textarea
@ -295,7 +294,12 @@
// Bind the window resize event when the width or height is auto or % // Bind the window resize event when the width or height is auto or %
if (/auto|%/.test("" + options.width + options.height)) if (/auto|%/.test("" + options.width + options.height))
$(window).resize(function() {refresh(editor);}); $(window).resize(function() {
// if the DOM is not remove, refresh the cleditor
if(editor.$main.parent().parent().size()) {
refresh(editor);
}
});
// Create the iframe and resize the controls // Create the iframe and resize the controls
refresh(editor); refresh(editor);
@ -562,10 +566,9 @@
//================== //==================
// Private Functions // Private Functions
//================== //==================
// checksum - returns a checksum using the Adler-32 method // checksum - returns a checksum using the Adler-32 method
function checksum(text) function checksum(text) {
{
var a = 1, b = 0; var a = 1, b = 0;
for (var index = 0; index < text.length; ++index) { for (var index = 0; index < text.length; ++index) {
a = (a + text.charCodeAt(index)) % 65521; a = (a + text.charCodeAt(index)) % 65521;
@ -799,7 +802,7 @@
options = editor.options; options = editor.options;
// Remove the old iframe // Remove the old iframe
if (editor.$frame) if (editor.$frame)
editor.$frame.remove(); editor.$frame.remove();
// Create a new iframe // Create a new iframe