[FIX] web_editor: allow to reset background color
Before this commit: When copy-pasting from Discord into Notes, get a text with color and background color. But when clicking on the trash icon inside the toolbar to remove the background color, it doesn't remove the background color. After this commit: Allowed to remove background color from text using trash icon. Task-2889682 closes odoo/odoo#114146 X-original-commit: 711ddaf97a5f16b3fe0d5d30dba52e4c9eab8d21 Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
committed by
dhba-odoo
parent
c801e8181b
commit
6f83fcb971
@@ -535,9 +535,9 @@ export const editorCommands = {
|
||||
// Get the <font> nodes to color
|
||||
const selectedNodes = getSelectedNodes(editor.editable).filter(node => !closestElement(node, 'table.o_selected_table'));
|
||||
const fonts = selectedNodes.flatMap(node => {
|
||||
let font = closestElement(node, 'font');
|
||||
let font = closestElement(node, 'font') || closestElement(node, 'span');
|
||||
const children = font && descendants(font);
|
||||
if (font && font.nodeName === 'FONT') {
|
||||
if (font && (font.nodeName === 'FONT' || (font.nodeName === 'SPAN' && font.style[mode]))) {
|
||||
// Partially selected <font>: split it.
|
||||
const selectedChildren = children.filter(child => selectedNodes.includes(child));
|
||||
if (selectedChildren.length) {
|
||||
|
||||
Reference in New Issue
Block a user