Files
tiptap/demos/setup/react.ts
Dany Castillo 55d458f893 fix type issues
2022-04-14 00:18:29 +02:00

24 lines
624 B
TypeScript

import React from 'react'
import { createRoot } from 'react-dom/client'
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 => {
const root = document.getElementById('app')
if (root) {
createRoot(root).render(React.createElement(module.default))
}
debug()
})
}