Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't crash when building docs #2379

7 changes: 5 additions & 2 deletions src/drafts/MarkdownEditor/_FormattingTools.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, {forwardRef, useImperativeHandle, useRef} from 'react'
import '@github/markdown-toolbar-element'
import React, {forwardRef, useImperativeHandle, useRef, useEffect} from 'react'

export type FormattingTools = {
header: () => void
Expand Down Expand Up @@ -49,6 +48,10 @@ export const FormattingTools = forwardRef<FormattingTools, {forInputId: string}>
reference: () => referenceRef.current?.click()
}))

useEffect(() => {
require('@github/markdown-toolbar-element')
}, [])

return (
<markdown-toolbar for={forInputId} style={{display: 'none'}}>
<md-header ref={headerRef} />
Expand Down