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

fix for changing links in tooltip #113 #129

Merged
merged 4 commits into from
May 31, 2014
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/modules/link-tooltip.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ class LinkTooltip extends Tooltip

saveLink: ->
url = this._normalizeURL(@textbox.value)
@quill.formatText(@range, 'link', url, 'user') if @range?
if @range? and @range.isCollapsed()
Copy link
Member

Choose a reason for hiding this comment

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

Sry I meant the if range should be its own followed by another if else block so:

if @range?
  if @range.isCollapsed()
    # Anchor
  else
    # formatText 

This is because formatText needs range to be defined as well.

anchor = this._findAnchor(@range)
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a check for range.isCollapsed() and if so do the modification of the anchor href. The else branch should have the formatText line.

anchor.href = url if anchor?
else
@quill.formatText(@range, 'link', url, 'user') if @range?
this.setMode(url, false)

setMode: (url, edit = false) ->
Expand Down