fix(toolbar): Don't show the toolbar when rangeInScope is null

This commit is contained in:
Ben Gotow 2016-02-05 13:11:09 -08:00
parent 8a40af6830
commit cc8a32e22f

View file

@ -14,13 +14,16 @@ class ToolbarButtonManager extends ContenteditableExtension
return null unless toolbarState.selectionSnapshot
return null if toolbarState.selectionSnapshot.isCollapsed
locationRef = DOMUtils.getRangeInScope(toolbarState.editableNode)
return null unless locationRef
buttonConfigs = @_toolbarButtonConfigs(toolbarState)
return {
component: ToolbarButtons
props:
buttonConfigs: buttonConfigs
locationRefNode: DOMUtils.getRangeInScope(toolbarState.editableNode)
locationRefNode: locationRef
width: buttonConfigs.length * 28.5
}