tiptap/demos/setup/react.tsx

20 lines
539 B
TypeScript
Raw Normal View History

2021-08-25 17:52:20 +08:00
import React from 'react'
import ReactDOM from 'react-dom'
import 'iframe-resizer/js/iframeResizer.contentWindow'
import { debug, splitName } from './helper'
import './style.scss'
export default function init(name: string, source: any) {
// @ts-ignore
window.source = source
document.title = name
const [demoCategory, demoName] = splitName(name)
import(`../src/${demoCategory}/${demoName}/React/index.jsx`)
.then(module => {
ReactDOM.render(<module.default />, document.getElementById('app'))
debug()
})
}