-
- Downloads
[FIX] web_editor: link don't duplicate child text
If we applied a link eg. on: ``` <span>hello <b>world</b></span> ``` The system actually gets the "label": hello worldworld because there is 3 nodes: text node: hello element node: `<b>world</b>` text node: world Also since "hello worldworld" is different than "hello world", instead of just keeping existing nodes and adding the link, the system would replace the selected range by: `<span><a>hello worldworld</a></span>' instead of: `<span><a>hello </a><b><a>world</a></b></span>` This commit ignores element nodes when creating a new link, since when getting the label of the link from the selection, only the text nodes insides the element nodes have any interest. There was a second issue because if we had: ``` <i><a href="hello">world</a></i>! ``` and tried to put a link over "world!", the code would decide: "world" is inside a link so we will just update that link. Thus we would get: ``` <i><a href="hello">world!</a></i>! ``` instead of: ``` <i><a href="hello">world</a></i><a href="hello">!</a> ``` opw-1848351 closes #25187
Loading
Please register or sign in to comment