angular-editor
angular-editor copied to clipboard
Editing a relative link inserts host name
Tested on OSX 10.15.7, Chrome 89
I've been able to reproduce this issue on my local project as well as here https://stackblitz.com/edit/angular-editor-wysiwyg.
Steps to reproduce:
- Enter some text into the editor
- Highlight the text and click the link toolbar icon
- Enter a relative path, i.e. "/foo/bar" and click "OK"
- Inspect the DOM and see that the href of the link is "/foo/bar"
- Select the text again and click the link toolbar icon
- Notice the url in the prompt now includes the full domain ("https://angular-editor-wysiwyg.stackblitz.io/foo/bar")
Expected behaviour:
- When editing a link, the exact same value will be presented to the user as was entered initially, rather than prefixing the hostname.
Suggestion on how to fix:
The offending line appears to be https://github.com/kolkov/angular-editor/blob/5de5ead3c0daca0e6cec1f27b06af34452c76da5/projects/angular-editor/src/lib/angular-editor-toolbar.component.ts#L256. A possible fix would be to call parent.getAttribute('href')
to get the actual attribute value, rather than what the browser thinks the value should be.
Thanks in advance to anyone who picks up this issue.
I have tested this on a ThinkBook 13s-IWL with Windows 10 Version 20H2 for x64-based systems running Google Chrome 89.0.4389.114 (Official Build) (64-bit). The above was also occurring and relative links were converted to full urls when editing links again. Previously this did not happen.
I see similar problem too. Relative image url is important to move the Website to different hosts. At the moment, either cut&pastes or drag&drop result the relative url being converted to full url with current host name. And lizlus had provided a possible solution, however, it will be good the lib will have this fixed.