mirror of https://github.com/mastodon/mastodon
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
813 B
TypeScript
37 lines
813 B
TypeScript
4 years ago
|
import './public-path';
|
||
2 years ago
|
import { createRoot } from 'react-dom/client';
|
||
7 years ago
|
|
||
2 years ago
|
import { start } from '../mastodon/common';
|
||
9 months ago
|
import ComposeContainer from '../mastodon/containers/compose_container';
|
||
2 years ago
|
import { loadPolyfills } from '../mastodon/polyfills';
|
||
|
import ready from '../mastodon/ready';
|
||
|
|
||
7 years ago
|
start();
|
||
8 years ago
|
|
||
|
function loaded() {
|
||
|
const mountNode = document.getElementById('mastodon-compose');
|
||
|
|
||
2 years ago
|
if (mountNode) {
|
||
|
const attr = mountNode.getAttribute('data-props');
|
||
12 months ago
|
|
||
|
if (!attr) return;
|
||
2 years ago
|
|
||
9 months ago
|
const props = JSON.parse(attr) as object;
|
||
2 years ago
|
const root = createRoot(mountNode);
|
||
12 months ago
|
|
||
2 years ago
|
root.render(<ComposeContainer {...props} />);
|
||
8 years ago
|
}
|
||
|
}
|
||
|
|
||
|
function main() {
|
||
9 months ago
|
ready(loaded).catch((error: unknown) => {
|
||
|
console.error(error);
|
||
|
});
|
||
8 years ago
|
}
|
||
|
|
||
9 months ago
|
loadPolyfills()
|
||
|
.then(main)
|
||
|
.catch((error: unknown) => {
|
||
|
console.error(error);
|
||
|
});
|