docbrown/app/javascript/packs/articleForm.jsx
Mac Siri 0f3342bcec [WIP] Implement non front-matter editor (#415)
* Create alternate editor

* Install linkstate (?)

Not sure how it disappear in the first place

* Run yarn install

* Modulize ArticleForm component

* Refactor

* Isolating css WIP

* Implement simplified frontmatter-less editor

* Modulize individual form element

* Ajust props names

* Transform json params to snakecase

* Remove codes

* Update /new, almost there for release

* Fix editor resize issues

* Change defaultvalue to value in article form tag element

* Modify html buttons in article form
2018-07-27 20:12:33 -07:00

29 lines
878 B
JavaScript

import { h, render } from 'preact';
import { getUserDataAndCsrfToken } from '../chat/util';
import ArticleForm from '../article-form/articleForm';
HTMLDocument.prototype.ready = new Promise(resolve => {
if (document.readyState !== 'loading') {
return resolve();
}
document.addEventListener('DOMContentLoaded', () => resolve());
return null;
});
document.ready.then(
getUserDataAndCsrfToken().then(currentUser => {
window.currentUser = currentUser;
const root = document.getElementById('article-form');
window.csrfToken = document.querySelector(
"meta[name='csrf-token']",
).content;
render(
<ArticleForm
article={document.getElementById('article-form').dataset.article}
organization={document.getElementById('article-form').dataset.organization}
/>,
root,
root.firstElementChild
);
}),
);