fix: styles and missing imports (#18396)

This commit is contained in:
crazywoola
2025-04-19 14:46:10 +08:00
committed by GitHub
parent 1e32175cdc
commit 93c1ee225e
2 changed files with 11 additions and 10 deletions

View File

@@ -9,7 +9,10 @@ const MarkdownMusic = ({ children }: { children: React.ReactNode }) => {
useEffect(() => {
if (containerRef.current && controlsRef.current) {
if (typeof children === 'string') {
const visualObjs = abcjs.renderAbc(containerRef.current, children)
const visualObjs = abcjs.renderAbc(containerRef.current, children, {
add_classes: true, // Add classes to SVG elements for cursor tracking
responsive: 'resize', // Make notation responsive
})
const synthControl = new abcjs.synth.SynthController()
synthControl.load(controlsRef.current, {}, { displayPlay: true })
const synth = new abcjs.synth.CreateSynth()
@@ -23,11 +26,9 @@ const MarkdownMusic = ({ children }: { children: React.ReactNode }) => {
}, [children])
return (
<div style={{ minHeight: '350px', minWidth: '100%', overflow: 'auto' }}>
<div style={{ minWidth: '100%', overflow: 'auto' }}>
<div ref={containerRef} />
<div
ref={controlsRef}
/>
<div ref={controlsRef} />
</div>
)
}