[FIX] web_editor: edition of monetary value

Issue: if the currency is before the value and we try to add a number at the begin of the value, the number is not saved (because the browser insert the number before the span).
Add a onEnableEditableArea in the rte to change the contenteditable value and the default behavior.
This commit is contained in:
Christophe Matthieu
2015-11-04 16:10:44 +01:00
parent 554bfa7d10
commit 7228b29cb2
2 changed files with 12 additions and 1 deletions
+5
View File
@@ -546,9 +546,14 @@ var RTE = Widget.extend({
if (dom.isImg($target[0])) {
$target.trigger('mousedown'); // for activate selection on picture
}
rte.onEnableEditableArea($editable);
}
},
onEnableEditableArea: function ($editable) {
},
onMouseup: function (event) {
var $target = $(event.target);
var $editable = $target.closest('.o_editable');
+7 -1
View File
@@ -597,7 +597,13 @@ rte.Class.include({
init: function (EditorBar) {
this._super.apply(this, arguments);
computeFonts();
}
},
onEnableEditableArea: function ($editable) {
if ($editable.data('oe-type') === "monetary") {
$editable.attr('contenteditable', false);
$editable.find('.oe_currency_value').attr('contenteditable', true);
}
},
});
/* list of font icons to load by editor. The icons are displayed in the media editor and