Skip to content

Commit

Permalink
Use caret position when adding link
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Apr 11, 2019
1 parent d005939 commit dfb85fd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/format-library/src/link/inline.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,9 @@ class InlineLinkUI extends Component {

return (
<PositionedAtSelection
selector="a"
// When adding a new link, set the container at the caret,
// otherwise set it at the link element.
selector={ addingLink ? null : 'a' }
// Since the key cannot be the format object, we have to keep it
// in the state and bump it when the object reference changes.
key={ this.state.key }
Expand Down

0 comments on commit dfb85fd

Please sign in to comment.