~cytrogen/masto-fe

ref: 496fd5987ecb67ac51888fde30b7fb76cf829edf masto-fe/app/javascript/packs/share.jsx -rw-r--r-- 721 bytes
496fd598 — Zoë Bijl [bugfix] correct import of `@rails/ujs` / fix lint issues (#92) 6 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import './public-path';
import { createRoot } from 'react-dom/client';

import { start } from '../mastodon/common';
import ComposeContainer  from '../mastodon/containers/compose_container';
import { loadPolyfills } from '../mastodon/polyfills';
import ready from '../mastodon/ready';

start();

function loaded() {
  const mountNode = document.getElementById('mastodon-compose');

  if (mountNode) {
    const attr = mountNode.getAttribute('data-props');
    if(!attr) return;

    const props = JSON.parse(attr);
    const root = createRoot(mountNode);
    root.render(<ComposeContainer {...props} />);
  }
}

function main() {
  ready(loaded);
}

loadPolyfills().then(main).catch(error => {
  console.error(error);
});