share.js 716 B

1234567891011121314151617181920212223242526
  1. import './public-path';
  2. import loadPolyfills from '../mastodon/load_polyfills';
  3. import { start } from '../mastodon/common';
  4. start();
  5. function loaded() {
  6. const ComposeContainer = require('../mastodon/containers/compose_container').default;
  7. const React = require('react');
  8. const ReactDOM = require('react-dom');
  9. const mountNode = document.getElementById('mastodon-compose');
  10. if (mountNode !== null) {
  11. const props = JSON.parse(mountNode.getAttribute('data-props'));
  12. ReactDOM.render(<ComposeContainer {...props} />, mountNode);
  13. }
  14. }
  15. function main() {
  16. const ready = require('../mastodon/ready').default;
  17. ready(loaded);
  18. }
  19. loadPolyfills().then(main).catch(error => {
  20. console.error(error);
  21. });