tiptap/demos/setup/react.ts
Dominik 8c6751f0c6
add precommit hook for linting and automatic eslint fixes + update eslint packages (#2862)
* chore: add precommit hook for eslint fixes, fix linting issues
* chore: add eslint import sort plugin
2022-06-08 14:10:25 +02:00

26 lines
626 B
TypeScript

import 'iframe-resizer/js/iframeResizer.contentWindow'
import './style.scss'
import React from 'react'
import { createRoot } from 'react-dom/client'
import { debug, splitName } from './helper'
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()
})
}