[FIX] web_editor: block commandbar in non html field
Prevent the PowerBox command bar to open in (non html) Odoo field embedded inside the editable zone. task-3040872 closes odoo/odoo#105372 X-original-commit: cab3a9b9b89a6b1c0d430e5374feb2f963e466fc Signed-off-by: David Monjoie (dmo) <dmo@odoo.com> Signed-off-by: Geelen Sébastien (sge) <sge@odoo.com>
This commit is contained in:
@@ -176,8 +176,19 @@ const Wysiwyg = Widget.extend({
|
||||
getPowerboxElement: () => {
|
||||
const selection = (this.options.document || document).getSelection();
|
||||
if (selection.isCollapsed && selection.rangeCount) {
|
||||
const node = closestElement(selection.anchorNode, 'P, DIV');
|
||||
return !(node && node.hasAttribute && node.hasAttribute('data-oe-model')) && node;
|
||||
const baseNode = closestElement(selection.anchorNode, 'P, DIV');
|
||||
const fieldContainer = closestElement(selection.anchorNode, '[data-oe-field]');
|
||||
if (!baseNode ||
|
||||
(
|
||||
fieldContainer &&
|
||||
!(
|
||||
fieldContainer.getAttribute('data-oe-field') === 'arch' ||
|
||||
fieldContainer.getAttribute('data-oe-type') === 'html'
|
||||
)
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
return baseNode;
|
||||
}
|
||||
},
|
||||
isHintBlacklisted: node => {
|
||||
|
||||
Reference in New Issue
Block a user