[FIX] web_editor: no quick edit on html link click
When clicking on link in html fields, we do not wish to start quick edition. With this change this is excluded. closes #68023 closes odoo/odoo#68212 X-original-commit: ecbdddbf0cff0964b44e7f0571d372ccbd051a72 Related: odoo/enterprise#17235 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com> Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
@@ -35,6 +35,9 @@ var FieldHtml = basic_fields.DebouncedField.extend(TranslatableFieldMixin, {
|
||||
className: 'oe_form_field oe_form_field_html',
|
||||
supportedFieldTypes: ['html'],
|
||||
isQuickEditable: true,
|
||||
quickEditExclusion: [
|
||||
'[href]',
|
||||
],
|
||||
|
||||
custom_events: {
|
||||
wysiwyg_focus: '_onWysiwygFocus',
|
||||
|
||||
@@ -2,6 +2,7 @@ odoo.define('web_editor.field_html_tests', function (require) {
|
||||
"use strict";
|
||||
|
||||
var ajax = require('web.ajax');
|
||||
var FormController = require('web.FormController');
|
||||
var FormView = require('web.FormView');
|
||||
var testUtils = require('web.test_utils');
|
||||
var weTestUtils = require('web_editor.test_utils');
|
||||
@@ -120,9 +121,13 @@ QUnit.module('web_editor', {}, function () {
|
||||
throw 'Wrong template';
|
||||
},
|
||||
});
|
||||
testUtils.mock.patch(FormController, {
|
||||
'multiClickTime': 0,
|
||||
});
|
||||
},
|
||||
afterEach: function () {
|
||||
testUtils.mock.unpatch(ajax);
|
||||
testUtils.mock.unpatch(FormController);
|
||||
},
|
||||
}, function () {
|
||||
|
||||
@@ -644,6 +649,34 @@ QUnit.module('web_editor', {}, function () {
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('Quick Edition: click on link inside html field', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
this.data['note.note'].records[0]['body'] = '<p><a href="#">hello</a> world</p>';
|
||||
|
||||
const form = await testUtils.createView({
|
||||
View: FormView,
|
||||
model: 'note.note',
|
||||
data: this.data,
|
||||
arch: '<form>' +
|
||||
'<field name="body" widget="html" style="height: 100px"/>' +
|
||||
'</form>',
|
||||
res_id: 1,
|
||||
});
|
||||
|
||||
assert.containsOnce(form, '.o_form_view.o_form_readonly');
|
||||
|
||||
await testUtils.dom.click(form.$('.oe_form_field[name="body"] a'));
|
||||
await testUtils.nextTick();
|
||||
assert.containsOnce(form, '.o_form_view.o_form_readonly');
|
||||
|
||||
await testUtils.dom.click(form.$('.oe_form_field[name="body"] p'));
|
||||
await testUtils.nextTick();
|
||||
assert.containsOnce(form, '.o_form_view.o_form_editable');
|
||||
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.module('cssReadonly');
|
||||
|
||||
QUnit.test('rendering with iframe for readonly mode', async function (assert) {
|
||||
|
||||
Reference in New Issue
Block a user