Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Create Hyperlink Without Text Selected #127

Open
spreadred opened this issue Aug 18, 2017 · 2 comments
Open

Cannot Create Hyperlink Without Text Selected #127

spreadred opened this issue Aug 18, 2017 · 2 comments

Comments

@spreadred
Copy link

It seems as though only Chrome is capable of adding a hyperlink directly from the hyperlink button, without having previously typed the text for the link and then selected it prior to clicking the hyperlink button.

Steps to reproduce:

  1. Without typing or selecting anything in the editor, click the hyperlink button
  2. Type the destination address
  3. Click "Add"
  4. Nothing is added to the editor in IE 11, Edge and Firefox - Chrome adds the hyperlink with the text the same as the destination address.

I'm not sure what the desired behavior is, but I think Chrome's behavior is likely the desired behavior by the end user.

@spreadred
Copy link
Author

From the mozilla docs on executecommand:

createLink
Creates an anchor link from the selection, only if there is a selection. This requires the HREF URI string to be passed in as a value argument. The URI must contain at least a single character, which may be a white space. (Internet Explorer will create a link with a null URI value.)

It appears as though the solution to this is going to be creating a fake one character selection at the cursor position if nothing is selected.

@hungqcao
Copy link
Contributor

@kaptainkommie I fixed this issue with my latest commit #126
Basically we will create a fake text element and move selection to that element when there is no current selection. Thanks for taking a look at it.

steveathon added a commit that referenced this issue Aug 19, 2017
* Fix hyperlink button for Edge/IE

Note that Issue #127 tracking the issue for not being able to input a link without selecting text (insert vs replace).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants