Ticket #512 (closed defect: fixed)
Editing a link doesn't work, if link contains format tags
| Reported by: | xinha.20.artus83@… | Owned by: | gogo |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Xinha Core | Version: | |
| Severity: | minor | Keywords: | |
| Cc: |
Description
In the current version a link can't be edited, if there are formats , like bold, defined within the link text. In this case you are told, that you have to select a text, before you can create a link. This happens, because the function _createLink doesn't search in deeper nodes for a link and so doesn't find it, if for example a <b> node is below the <a> node.
The context-menu plugin on the other hand searches to deeper nodes . So it happens, that you are shown the option to alter an link in the context menu, but then get an error, that you have to select text before creating a link.
Chaning this code in _createLink:
if (/^img$/i.test(link.tagName))
link = link.parentNode;
if (!/^a$/i.test(link.tagName))
link = null;
to:
while (link && !/^a$/i.test(link.tagName))
link = link.parentNode;
should solve the problem.
