[FIX] web_editor,website_sale: monetary field UX fix
The forced selection of the entire text value was preventing the user from changing the selection after the initial click inside the monetary field. task-2679088 X-original-commit: d33d55aad46c9223192d15c01b7516340be77cce Part-of: odoo/odoo#80071
This commit is contained in:
@@ -161,16 +161,22 @@ const Wysiwyg = Widget.extend({
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
if ($field.data('oe-type') === "monetary") {
|
||||
$field.attr('contenteditable', false);
|
||||
$field.find('.oe_currency_value').attr('contenteditable', true);
|
||||
}
|
||||
if ($field.data('oe-type') === "image") {
|
||||
$field.attr('contenteditable', false);
|
||||
$field.find('img').attr('contenteditable', true);
|
||||
}
|
||||
if ($field.is('[data-oe-many2one-id]')) {
|
||||
$field.attr('contenteditable', false);
|
||||
if ($field.attr('contenteditable') !== 'false') {
|
||||
if ($field.data('oe-type') === "monetary") {
|
||||
$field.attr('contenteditable', false);
|
||||
const $currencyValue = $field.find('.oe_currency_value');
|
||||
$currencyValue.attr('contenteditable', true);
|
||||
$currencyValue.one('mouseup touchend', (e) => {
|
||||
$currencyValue.selectContent();
|
||||
});
|
||||
}
|
||||
if ($field.data('oe-type') === "image") {
|
||||
$field.attr('contenteditable', false);
|
||||
$field.find('img').attr('contenteditable', true);
|
||||
}
|
||||
if ($field.is('[data-oe-many2one-id]')) {
|
||||
$field.attr('contenteditable', false);
|
||||
}
|
||||
}
|
||||
self.odooEditor.observerActive();
|
||||
}
|
||||
|
||||
@@ -250,25 +250,6 @@ Wysiwyg.include({
|
||||
},
|
||||
});
|
||||
|
||||
publicWidget.registry.websiteSaleCurrency = publicWidget.Widget.extend({
|
||||
selector: '.oe_website_sale',
|
||||
disabledInEditableMode: false,
|
||||
edit_events: {
|
||||
'click .oe_currency_value:o_editable': '_onCurrencyValueClick',
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Handlers
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_onCurrencyValueClick: function (ev) {
|
||||
$(ev.currentTarget).selectContent();
|
||||
},
|
||||
});
|
||||
|
||||
function reload() {
|
||||
if (window.location.href.match(/\?enable_editor/)) {
|
||||
window.location.reload();
|
||||
|
||||
Reference in New Issue
Block a user