Commit 9fb619fd authored by Casey Ydenberg's avatar Casey Ydenberg
Browse files

Render toolbar as disabled buttons when view is not yet available

parent 2bb91652
......@@ -104,10 +104,6 @@ export interface ToolbarConfig<S extends Schema> {
export const ManuscriptToolbar: React.FunctionComponent<{
view?: ManuscriptEditorView
}> = ({ view }) => {
if (!view) {
return null
}
return (
<ToolbarContainer>
{view && (
......@@ -122,10 +118,13 @@ export const ManuscriptToolbar: React.FunctionComponent<{
<ToolbarItem key={itemKey}>
<ToolbarButton
title={item.title}
data-active={item.active && item.active(view.state)}
disabled={item.enable && !item.enable(view.state)}
data-active={view && item.active && item.active(view.state)}
disabled={!view || (item.enable && !item.enable(view.state))}
onMouseDown={(event) => {
event.preventDefault()
if (!view) {
return
}
item.run(view.state, view.dispatch)
view.focus()
}}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment