[FIX] web_editor: prevent link zws around blocks
Link zws should not be applied on links that contain blocks so as to avoid unfortunate side effects of zws on the dimensions of the link. task-3596919 X-original-commit: 656fc7ca4d19311c679f6f3d3df6a4ea7e57c15c Part-of: odoo/odoo#142803
This commit is contained in:
@@ -2023,13 +2023,9 @@ export class OdooEditor extends EventTarget {
|
||||
for (const link of links) {
|
||||
if (
|
||||
link &&
|
||||
!isBlock(link) &&
|
||||
link.textContent !== '' &&
|
||||
!(
|
||||
// Ignore links wrapped around a single image.
|
||||
link.children.length === 1 &&
|
||||
link.firstElementChild.nodeName === 'IMG'
|
||||
)
|
||||
link.textContent.trim() !== '' &&
|
||||
// Only add the ZWS for simple (possibly styled) text links.
|
||||
![link, ...link.querySelectorAll('*')].some(isBlock)
|
||||
) {
|
||||
this._insertLinkZws('start', link);
|
||||
// Only add the ZWS at the end if the link is in selection.
|
||||
|
||||
Reference in New Issue
Block a user