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

Pressing enter with blank link input crashes editor #8195

Closed
kevinansfield opened this issue Mar 20, 2017 · 3 comments · Fixed by TryGhost/Admin#599
Closed

Pressing enter with blank link input crashes editor #8195

kevinansfield opened this issue Mar 20, 2017 · 3 comments · Fixed by TryGhost/Admin#599
Assignees
Labels
affects:editor Work relating to the Koenig Editor

Comments

@kevinansfield
Copy link
Contributor

kevinansfield commented Mar 20, 2017

Issue Summary

I made some text a link and then wanted to remove it, I assumed I could do this by repeating the process and entering blank text for the link but that crashed the editor.

Steps to Reproduce

  1. Highlight some text in the editor and use the popup menu to add a link
  2. Select the same text and open the link input again
  3. Press return to set a blank link value
  4. Note the error in the console
  5. Editor becomes unresponsive, every keypress results in another error

blank-link-error

(note that the popups are partially hidden due to the proximity to the browser window edge rather than the screencap cutoff)

Technical details:

@kevinansfield kevinansfield added the affects:editor Work relating to the Koenig Editor label Mar 20, 2017
@disordinary
Copy link
Contributor

If you look at the background with the "Preview" button appearing, it seems to be creating a card the second time rather than a link.

@kevinansfield
Copy link
Contributor Author

kevinansfield commented Mar 21, 2017

If you look at the background with the "Preview" button appearing, it seems to be creating a card the second time rather than a link.

I had a blank markdown card underneath the paragraph, it seems to break in a way that the "preview" hover text becomes part of the main content

@disordinary
Copy link
Contributor

disordinary commented Mar 21, 2017

The issue isn't that applying the link twice causes chaos, it's that the focus isn't applied to the link input box but the editor has lost the windows selection after the first time that it is toggled.

Issues with the Range are by far the most common that we have with mobiledoc, I'm going to have to go through the mobiledoc code base at some stage and make sure that when editing operations happen it checks to make sure the range is valid, or at least catches these range errors properly. 😡

disordinary added a commit to disordinary/Ghost-Admin that referenced this issue Mar 21, 2017
When the toolbar is toggled into link mode the link input field should always focus, however this only happens on the first time which leads to issues with mobiledoc having focus but not the range.

This fix means that the toolbar always focuses.

Closes: TryGhost/Ghost#8195
kevinansfield pushed a commit to TryGhost/Admin that referenced this issue Mar 21, 2017
closes TryGhost/Ghost#8195

When the toolbar is toggled into link mode the link input field should always focus, however this only happens on the first time which leads to issues with mobiledoc having focus but not the range.

This fix means that the toolbar always focuses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects:editor Work relating to the Koenig Editor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants