From d8796d429cf0a1b1df896944445ad2c6f91a8859 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 13 Aug 2012 13:46:38 +0200 Subject: [PATCH 1/5] Now uses the html field type for cl editor bzr revid: nicolas.vanhoren@openerp.com-20120813114638-pla647nupeha1tim --- addons/web/static/src/js/view_form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index baf8c151b83..1ee5d8477f6 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -4802,7 +4802,7 @@ instance.web.form.widgets = new instance.web.Registry({ 'email' : 'instance.web.form.FieldEmail', 'url' : 'instance.web.form.FieldUrl', 'text' : 'instance.web.form.FieldText', - 'text_html' : 'instance.web.form.FieldTextHtml', + 'html' : 'instance.web.form.FieldTextHtml', 'date' : 'instance.web.form.FieldDate', 'datetime' : 'instance.web.form.FieldDatetime', 'selection' : 'instance.web.form.FieldSelection', From 78f92ec0314c9076d9daf48eb8812615b42d8d08 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 13 Aug 2012 16:51:11 +0200 Subject: [PATCH 2/5] Some tuning in text html bzr revid: nicolas.vanhoren@openerp.com-20120813145111-s8uw1x4fc26xe6xl --- addons/web/static/src/js/view_form.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 1ee5d8477f6..a7f35ad04de 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2404,11 +2404,9 @@ instance.web.form.FieldTextHtml = instance.web.form.FieldText.extend({ width: width, // width not including margins, borders or padding height: height, // height not including margins, borders or padding controls: // controls to add to the toolbar - "bold italic underline strikethrough | size " + + "bold italic underline strikethrough " + "| removeformat | bullets numbering | outdent " + - "indent | link unlink", - sizes: // sizes in the font size popup - "1,2,3,4,5,6,7", + "indent | link unlink | source", bodyStyle: // style to assign to document body contained within the editor "margin:4px; font:12px monospace; cursor:text; color:#1F1F1F" }); From 8c7b192ab7c89688a8c8f81c1a6d2be480610557 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 13 Aug 2012 17:22:27 +0200 Subject: [PATCH 3/5] Removed useless dependency between fieldtexthtml and fieldtext bzr revid: nicolas.vanhoren@openerp.com-20120813152227-29l173q31tcwc9tq --- addons/web/static/src/js/view_form.js | 14 ++++---------- addons/web/static/src/xml/base.xml | 5 +++++ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index a7f35ad04de..bd6d2c6f128 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2394,8 +2394,8 @@ instance.web.form.FieldText = instance.web.form.AbstractField.extend(instance.we * To find more information about CLEditor configutation: go to * http://premiumsoftware.net/cleditor/docs/GettingStarted.html */ -instance.web.form.FieldTextHtml = instance.web.form.FieldText.extend({ - +instance.web.form.FieldTextHtml = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, { + template: 'FieldTextHtml', initialize_content: function() { this.$textarea = this.$element.find('textarea'); var width = ((this.node.attrs || {}).editor_width || 468); @@ -2411,22 +2411,16 @@ instance.web.form.FieldTextHtml = instance.web.form.FieldText.extend({ "margin:4px; font:12px monospace; cursor:text; color:#1F1F1F" }); this.$cleditor = this.$textarea.cleditor()[0]; - // call super now, because cleditor resets the disable attr - this._super.apply(this, arguments); - // propagate disabled property to cleditor - this.$cleditor.disable(this.$textarea.prop('disabled')); }, - set_value: function(value_) { this._super.apply(this, arguments); this._dirty_flag = true; + this.render_value(); }, - render_value: function() { - this._super.apply(this, arguments); + this.$textarea.val(this.get('value')); this.$cleditor.updateFrame(); }, - get_value: function() { this.$cleditor.updateTextArea(); return this.$textarea.val(); diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 0eddd914f01..061f74c246f 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -975,6 +975,11 @@ /> + +
+