Merge pull request #544 from outline/issue-startblock

Fix JS error where selection has no startBlock
This commit is contained in:
Tom Moor
2018-01-30 22:18:04 -08:00
committed by GitHub

View File

@ -138,7 +138,8 @@ class LinkToolbar extends Component {
if (href) {
change.setInline({ type: 'link', data: { href } });
} else if (link) {
const selContainsLink = !!change.value.startBlock.getChild(link.key);
const startBlock = change.value.startBlock;
const selContainsLink = !!(startBlock && startBlock.getChild(link.key));
if (selContainsLink) change.unwrapInlineByKey(link.key);
}
change.deselect();