From 395c022178053b07a800c598f467801f9682de2a Mon Sep 17 00:00:00 2001 From: Jori Lallo Date: Wed, 24 Jan 2018 00:00:58 -0800 Subject: [PATCH 1/2] LinkToolbar changes --- app/components/Editor/components/Toolbar/Toolbar.js | 6 ++++-- .../Editor/components/Toolbar/components/LinkToolbar.js | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) 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..f4781c330 100644 --- a/app/components/Editor/components/Toolbar/components/LinkToolbar.js +++ b/app/components/Editor/components/Toolbar/components/LinkToolbar.js @@ -163,7 +163,6 @@ class LinkToolbar extends Component { placeholder="Search or paste a link…" onKeyDown={this.onKeyDown} onChange={this.onChange} - autoFocus /> {this.isEditing && ( From 891bac6d1d4ff770a3c63d12c34c8355b8220a81 Mon Sep 17 00:00:00 2001 From: Jori Lallo Date: Wed, 24 Jan 2018 23:16:13 -0800 Subject: [PATCH 2/2] Autofocus on new link --- .../Editor/components/Toolbar/components/LinkToolbar.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/components/Editor/components/Toolbar/components/LinkToolbar.js b/app/components/Editor/components/Toolbar/components/LinkToolbar.js index f4781c330..efce54e3b 100644 --- a/app/components/Editor/components/Toolbar/components/LinkToolbar.js +++ b/app/components/Editor/components/Toolbar/components/LinkToolbar.js @@ -163,6 +163,7 @@ class LinkToolbar extends Component { placeholder="Search or paste a link…" onKeyDown={this.onKeyDown} onChange={this.onChange} + autoFocus={href === ''} /> {this.isEditing && (