import './styles/body.styl'; import './styles/inline.styl'; import './styles/toolbar.styl'; import './styles/alert.styl'; // import './styles/table.styl'; // import './styles/table-toolbar.styl'; import editor from './editor'; import checkFileCreation from './checkFileCreation'; const styles = document.querySelectorAll('style'); const isCode = () => { const gotCode = /\?([^=]+)=/g; const c = gotCode.exec(window.location.search); return (c || [])[1] === 'code'; }; const initEditor = () => { [].forEach.call(styles, style => { style.classList.add('_initial'); }); if (!isCode()) { window.location.href = `https://github.com/login/oauth/authorize/?client_id=4f50709332666c810b12`; } else { checkFileCreation() .then(data => editor(data)) .then(() => console.log('initialized')); } }; export default initEditor;