mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-14 15:14:56 -04:00
Add abcjs (#537)
This commit is contained in:
parent
86e41929ef
commit
119c9512e7
7 changed files with 82 additions and 0 deletions
|
@ -0,0 +1,19 @@
|
|||
import React, { useEffect, useRef } from 'react'
|
||||
import { renderAbc } from 'abcjs'
|
||||
|
||||
export interface AbcFrameProps {
|
||||
code: string
|
||||
}
|
||||
export const AbcFrame: React.FC<AbcFrameProps> = ({ code }) => {
|
||||
const container = useRef<HTMLDivElement>(null)
|
||||
|
||||
useEffect(() => {
|
||||
if (container.current) {
|
||||
renderAbc(container.current, code)
|
||||
}
|
||||
}, [code])
|
||||
|
||||
return (
|
||||
<div ref={container}/>
|
||||
)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue