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

Auto link: fix bug when entering link at end of paragraph #678

Merged
merged 19 commits into from
Jun 12, 2015

Conversation

patrick-webs
Copy link
Contributor

Fix the following issue with auto-link:

  • Typing in an auto link at the end of the paragraph and then hitting enter over and over would never result in getting to the next paragraph (requiring use of the cursor keys or the mouse), because the selection would be saved and restored each time due to the SPAN[data-auto-link] getting removed from the new paragraph, and the current Medium selection import/export utilities cannot index a cursor into an empty paragraph that contains no text.

@@ -125,7 +125,7 @@ module.exports = function (grunt) {
consolidate: true
},
keepRunner: true,
template: require('grunt-template-jasmine-istanbul'),
//template: require('grunt-template-jasmine-istanbul'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, sorry. Didn't think I committed that - had disabled the template to make debugging the unit test page easier, re-enabled now.

@j0k3r
Copy link
Contributor

j0k3r commented Jun 10, 2015

Could you remove dist files from your PR ? Thanks

If the user adds some spaces after what used to be an autolink, it
shouldn't cause the auto-link span to be removed. Move the spaces
outside of the span instead.
…elements

After code review it was suggested to import/export the selection with
reference to all possible parent block elements (h1, h2, pre,
blockquote) rather than just the paragraph tag. This may make the
functionality more useful for other applications.
} else {
// Some editing has happened to the span, so just remove it entirely. The user can put it back
// around just the href content if they need to prevent it from linking
while (spans[i].childNodes.length > 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use Util.unwrap() for this I believe

nmielnik added a commit that referenced this pull request Jun 12, 2015
Auto link: fix bug when entering link at end of paragraph
@nmielnik nmielnik merged commit 9936fca into yabwe:master Jun 12, 2015
nysk pushed a commit to nysk/medium-editor that referenced this pull request Aug 10, 2015
Auto link: fix bug when entering link at end of paragraph
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

Successfully merging this pull request may close these issues.

None yet

3 participants