~cytrogen/masto-fe

ref: 5c79cd6cf732c348b3cf63e9e6c79d189e42d08d masto-fe/app/javascript/packs/share.jsx -rw-r--r-- 735 bytes
5c79cd6c — Cytrogen [chore] Add .gstack/ to gitignore 4 days 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
31
32
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);
});