Merge pull request #524 from outline/jori/link-toolbar

LinkToolbar changes
This commit is contained in:
Jori Lallo
2018-01-24 23:24:14 -08:00
committed by GitHub
2 changed files with 5 additions and 3 deletions

View File

@@ -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 &&

View File

@@ -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 && (
<ToolbarButton onMouseDown={this.openLink}>