diff --git a/app/components/Editor/components/Toolbar/Toolbar.js b/app/components/Editor/components/Toolbar/Toolbar.js index 227e6a597..703c7b77a 100644 --- a/app/components/Editor/components/Toolbar/Toolbar.js +++ b/app/components/Editor/components/Toolbar/Toolbar.js @@ -14,8 +14,10 @@ function getLinkInSelection(value): any { const selectedLinks = value.document .getInlinesAtRange(value.selection) .filter(node => node.type === 'link'); + if (selectedLinks.size) { - return selectedLinks.first(); + const link = selectedLinks.first(); + if (value.selection.hasEdgeIn(link)) return link; } } catch (err) { // It's okay. @@ -169,7 +171,7 @@ const Menu = styled.div` transition-delay: 250ms; line-height: 0; height: 40px; - min-width: 260px; + min-width: 300px; ${({ active }) => active && diff --git a/app/components/Editor/components/Toolbar/components/LinkToolbar.js b/app/components/Editor/components/Toolbar/components/LinkToolbar.js index 9a3966688..efce54e3b 100644 --- a/app/components/Editor/components/Toolbar/components/LinkToolbar.js +++ b/app/components/Editor/components/Toolbar/components/LinkToolbar.js @@ -163,7 +163,7 @@ class LinkToolbar extends Component { placeholder="Search or paste a link…" onKeyDown={this.onKeyDown} onChange={this.onChange} - autoFocus + autoFocus={href === ''} /> {this.isEditing && (