* 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
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
import { h, render } from 'preact';
|
|
import Onboarding from '../src/Onboarding';
|
|
import { getUserDataAndCsrfToken } from '../chat/util';
|
|
import getUnopenedChannels from '../src/utils/getUnopenedChannels';
|
|
|
|
HTMLDocument.prototype.ready = new Promise(resolve => {
|
|
if (document.readyState !== 'loading') {
|
|
return resolve();
|
|
}
|
|
document.addEventListener('DOMContentLoaded', () => resolve());
|
|
return null;
|
|
});
|
|
|
|
function shouldShowOnboarding() {
|
|
return (
|
|
document.head.getElementsByTagName('meta')[2].content === 'true' &&
|
|
document.body.getAttribute('data-user') &&
|
|
document.body.getAttribute('data-user') !== 'undefined' &&
|
|
JSON.parse(document.body.getAttribute('data-user')).saw_onboarding === false
|
|
);
|
|
}
|
|
|
|
function renderPage() {
|
|
if (shouldShowOnboarding()) {
|
|
setTimeout(() => {
|
|
render(<Onboarding />, document.getElementById('top-bar'));
|
|
}, 580);
|
|
}
|
|
}
|
|
|
|
document.ready.then(
|
|
getUserDataAndCsrfToken().then(currentUser => {
|
|
window.currentUser = currentUser;
|
|
window.csrfToken = document.querySelector(
|
|
"meta[name='csrf-token']",
|
|
).content;
|
|
renderPage();
|
|
getUnopenedChannels();
|
|
}),
|
|
);
|