diff --git a/addons/web/static/lib/cleditor/jquery.cleditor.css b/addons/web/static/lib/cleditor/jquery.cleditor.css
index 6ac490bcfc4..19669406947 100644
--- a/addons/web/static/lib/cleditor/jquery.cleditor.css
+++ b/addons/web/static/lib/cleditor/jquery.cleditor.css
@@ -6,7 +6,7 @@
.cleditorButton {float:left; width:24px; height:24px; margin:1px 0 1px 0; background: url('images/buttons.gif')}
.cleditorDisabled {opacity:0.3; filter:alpha(opacity=30)}
.cleditorDivider {float:left; width:1px; height:23px; margin:1px 0 1px 0; background:#CCC}
-.cleditorPopup {border:solid 1px #999; background-color:white; position:absolute; font:10pt Arial,Verdana; cursor:default; z-index:10000}
+.cleditorPopup {border:solid 1px #999; background-color:white; color:#333333; position:absolute; font:10pt Arial,Verdana; cursor:default; z-index:10000}
.cleditorList div {padding:2px 4px 2px 4px}
.cleditorList p,
.cleditorList h1,
diff --git a/addons/web/static/lib/cleditor/jquery.cleditor.js b/addons/web/static/lib/cleditor/jquery.cleditor.js
index 3de9089443d..7852037de58 100644
--- a/addons/web/static/lib/cleditor/jquery.cleditor.js
+++ b/addons/web/static/lib/cleditor/jquery.cleditor.js
@@ -1,18 +1,13 @@
-/**
- @preserve CLEditor WYSIWYG HTML Editor v1.3.0
- http://premiumsoftware.net/cleditor
+/*!
+ CLEditor WYSIWYG HTML Editor v1.4.4
+ http://premiumsoftware.net/CLEditor
requires jQuery v1.4.2 or later
Copyright 2010, Chris Landowski, Premium Software, LLC
Dual licensed under the MIT or GPL Version 2 licenses.
*/
-// ==ClosureCompiler==
-// @compilation_level SIMPLE_OPTIMIZATIONS
-// @output_file_name jquery.cleditor.min.js
-// ==/ClosureCompiler==
-
-(function($) {
+(function ($) {
//==============
// jQuery Plugin
@@ -22,7 +17,7 @@
// Define the defaults used for all new cleditor instances
defaultOptions: {
- width: 500, // width not including margins, borders or padding
+ width: 'auto', // width not including margins, borders or padding
height: 250, // height not including margins, borders or padding
controls: // controls to add to the toolbar
"bold italic underline strikethrough subscript superscript | font size " +
@@ -46,18 +41,18 @@
[["Paragraph", "
"], ["Header 1", "
"], ["Header 2", "
"],
["Header 3", "
"], ["Header 4","
"], ["Header 5","
"],
["Header 6","
"]],
- useCSS: false, // use CSS to style HTML when possible (not supported in ie)
+ useCSS: true, // use CSS to style HTML when possible (not supported in ie)
docType: // Document type contained within the editor
'',
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; color:#4c4c4c; font-size:13px; font-family:\"Lucida Grande\",Helvetica,Verdana,Arial,sans-serif; cursor:text"
+ "margin:4px; font:10pt Arial,Verdana; cursor:text"
},
// Define all usable toolbar buttons - the init string property is
// expanded during initialization back into the buttons object and
- // seperate object properties are created for each button.
+ // separate object properties are created for each button.
// e.g. buttons.size.title = "Font Size"
buttons: {
// name,title,command,popupName (""=use name)
@@ -109,7 +104,7 @@
// Loop through all matching textareas and create the editors
this.each(function(idx, elem) {
- if (elem.tagName == "TEXTAREA") {
+ if (elem.tagName.toUpperCase() === "TEXTAREA") {
var data = $.data(elem, CLEDITOR);
if (!data) data = new cleditor(elem, options);
$result = $result.add(data);
@@ -129,6 +124,7 @@
// Misc constants
BACKGROUND_COLOR = "backgroundColor",
+ BLURRED = "blurred",
BUTTON = "button",
BUTTON_NAME = "buttonName",
CHANGE = "change",
@@ -136,6 +132,7 @@
CLICK = "click",
DISABLED = "disabled",
DIV_TAG = "
",
+ FOCUSED = "focused",
TRANSPARENT = "transparent",
UNSELECTABLE = "unselectable",
@@ -152,12 +149,15 @@
PROMPT_CLASS = "cleditorPrompt", // prompt popup divs inside body
MSG_CLASS = "cleditorMsg", // message popup div inside body
- // Test for ie
- ie = $.browser.msie,
- ie6 = /msie\s6/i.test(navigator.userAgent),
+ // Browser detection
+ ua = navigator.userAgent.toLowerCase(),
+ ie = /msie/.test(ua),
+ ie6 = /msie\s6/.test(ua),
+ iege11 = /(trident)(?:.*rv:([\w.]+))?/.test(ua),
+ webkit = /webkit/.test(ua),
// Test for iPhone/iTouch/iPad
- iOS = /iphone|ipad|ipod/i.test(navigator.userAgent),
+ iOS = /iphone|ipad|ipod/i.test(ua),
// Popups are created once as needed and shared by all editor instances
popups = {},
@@ -223,19 +223,26 @@
var $group = $(DIV_TAG)
.addClass(GROUP_CLASS)
.appendTo($toolbar);
+
+ // Initialize the group width
+ var groupWidth = 0;
// Add the buttons to the toolbar
$.each(options.controls.split(" "), function(idx, buttonName) {
if (buttonName === "") return true;
// Divider
- if (buttonName == "|") {
+ if (buttonName === "|") {
// Add a new divider to the group
var $div = $(DIV_TAG)
.addClass(DIVIDER_CLASS)
.appendTo($group);
+ // Update the group width
+ $group.width(groupWidth + 1);
+ groupWidth = 0;
+
// Create a new group
$group = $(DIV_TAG)
.addClass(GROUP_CLASS)
@@ -258,6 +265,10 @@
.appendTo($group)
.hover(hoverEnter, hoverLeave);
+ // Update the group width
+ groupWidth += 24;
+ $group.width(groupWidth + 1);
+
// Prepare the button image
var map = {};
if (button.css) map = button.css;
@@ -295,17 +306,7 @@
// Bind the window resize event when the width or height is auto or %
if (/auto|%/.test("" + options.width + options.height))
- $(window).resize(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);
- }
- });
+ $(window).bind('resize.cleditor', function () { refresh(editor); });
// Create the iframe and resize the controls
refresh(editor);
@@ -347,13 +348,26 @@
return editor;
};
});
+
+ // blurred - shortcut for .bind("blurred", handler) or .trigger("blurred")
+ fn.blurred = function(handler) {
+ var $this = $(this);
+ return handler ? $this.bind(BLURRED, handler) : $this.trigger(BLURRED);
+ };
// change - shortcut for .bind("change", handler) or .trigger("change")
- fn.change = function(handler) {
+ fn.change = function change(handler) {
+ console.log('change test');
var $this = $(this);
return handler ? $this.bind(CHANGE, handler) : $this.trigger(CHANGE);
};
+ // focused - shortcut for .bind("focused", handler) or .trigger("focused")
+ fn.focused = function(handler) {
+ var $this = $(this);
+ return handler ? $this.bind(FOCUSED, handler) : $this.trigger(FOCUSED);
+ };
+
//===============
// Event Handlers
//===============
@@ -369,7 +383,7 @@
popup = popups[popupName];
// Check if disabled
- if (editor.disabled || $(buttonDiv).attr(DISABLED) == DISABLED)
+ if (editor.disabled || $(buttonDiv).attr(DISABLED) === DISABLED)
return;
// Fire the buttonClick event
@@ -387,7 +401,7 @@
return false;
// Toggle source
- if (buttonName == "source") {
+ if (buttonName === "source") {
// Show the iframe
if (sourceMode(editor)) {
@@ -418,10 +432,10 @@
var $popup = $(popup);
// URL
- if (popupName == "url") {
+ if (popupName === "url") {
// Check for selection before showing the link url popup
- if (buttonName == "link" && selectedText(editor) === "") {
+ if (buttonName === "link" && selectedText(editor) === "") {
showMessage(editor, "A selection is required when inserting a link.", buttonDiv);
return false;
}
@@ -447,7 +461,7 @@
}
// Paste as Text
- else if (popupName == "pastetext") {
+ else if (popupName === "pastetext") {
// Wire up the submit button click event handler
$popup.children(":button")
@@ -475,13 +489,13 @@
return false; // stop propagination to document click
}
- // propaginate to documnt click
+ // propaginate to document click
return;
}
// Print
- else if (buttonName == "print")
+ else if (buttonName === "print")
editor.$frame[0].contentWindow.print();
// All other buttons
@@ -526,19 +540,19 @@
useCSS = editor.options.useCSS;
// Get the command value
- if (buttonName == "font")
+ if (buttonName === "font")
// Opera returns the fontfamily wrapped in quotes
value = target.style.fontFamily.replace(/"/g, "");
- else if (buttonName == "size") {
- if (target.tagName == "DIV")
+ else if (buttonName === "size") {
+ if (target.tagName.toUpperCase() === "DIV")
target = target.children[0];
value = target.innerHTML;
}
- else if (buttonName == "style")
+ else if (buttonName === "style")
value = "<" + target.tagName + ">";
- else if (buttonName == "color")
+ else if (buttonName === "color")
value = hex(target.style.backgroundColor);
- else if (buttonName == "highlight") {
+ else if (buttonName === "highlight") {
value = hex(target.style.backgroundColor);
if (ie) command = 'backcolor';
else useCSS = true;
@@ -572,7 +586,7 @@
//==================
// Private Functions
//==================
-
+
// checksum - returns a checksum using the Adler-32 method
function checksum(text)
{
@@ -610,7 +624,7 @@
$popup.html(popupContent);
// Color
- else if (popupName == "color") {
+ else if (popupName === "color") {
var colors = options.colors.split(" ");
if (colors.length < 10)
$popup.width("auto");
@@ -622,7 +636,7 @@
}
// Font
- else if (popupName == "font")
+ else if (popupName === "font")
$.each(options.fonts.split(","), function(idx, font) {
$(DIV_TAG).appendTo($popup)
.css("fontFamily", font)
@@ -630,28 +644,28 @@
});
// Size
- else if (popupName == "size")
+ else if (popupName === "size")
$.each(options.sizes.split(","), function(idx, size) {
$(DIV_TAG).appendTo($popup)
- .html("" + size + "");
+ .html('' + size + '');
});
// Style
- else if (popupName == "style")
+ else if (popupName === "style")
$.each(options.styles, function(idx, style) {
$(DIV_TAG).appendTo($popup)
.html(style[1] + style[0] + style[1].replace("<", ""));
});
// URL
- else if (popupName == "url") {
- $popup.html('Enter URL: