Clean up and smaller bundle.js
This commit is contained in:
@@ -96,11 +96,6 @@
|
|||||||
"react-router": "^2.0.0",
|
"react-router": "^2.0.0",
|
||||||
"react-router-redux": "^4.0.4",
|
"react-router-redux": "^4.0.4",
|
||||||
"rebass": "^0.2.6",
|
"rebass": "^0.2.6",
|
||||||
"redux": "^3.3.1",
|
|
||||||
"redux-actions": "^0.9.1",
|
|
||||||
"redux-logger": "^2.6.1",
|
|
||||||
"redux-persist": "3.0.3",
|
|
||||||
"redux-thunk": "^2.0.1",
|
|
||||||
"safestart": "^0.8.0",
|
"safestart": "^0.8.0",
|
||||||
"sass-loader": "^3.2.0",
|
"sass-loader": "^3.2.0",
|
||||||
"sequelize": "^3.21.0",
|
"sequelize": "^3.21.0",
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import marked from 'marked';
|
|
||||||
|
|
||||||
import { Link } from 'react-router';
|
import { Link } from 'react-router';
|
||||||
import PublishingInfo from 'components/PublishingInfo';
|
import PublishingInfo from 'components/PublishingInfo';
|
||||||
|
|||||||
@@ -4,12 +4,7 @@ import { Provider } from 'react-redux';
|
|||||||
import Router from 'react-router/lib/Router';
|
import Router from 'react-router/lib/Router';
|
||||||
import Route from 'react-router/lib/Route';
|
import Route from 'react-router/lib/Route';
|
||||||
import IndexRoute from 'react-router/lib/IndexRoute';
|
import IndexRoute from 'react-router/lib/IndexRoute';
|
||||||
import { createStore, applyMiddleware } from 'redux';
|
|
||||||
import { routerMiddleware } from 'react-router-redux';
|
|
||||||
import thunkMiddleware from 'redux-thunk';
|
|
||||||
import createLogger from 'redux-logger';
|
|
||||||
import History from 'utils/History';
|
import History from 'utils/History';
|
||||||
import DevTools from 'mobx-react-devtools';
|
|
||||||
|
|
||||||
import userStore from 'stores/UserStore';
|
import userStore from 'stores/UserStore';
|
||||||
|
|
||||||
@@ -22,13 +17,14 @@ import 'assets/styles/codemirror.css';
|
|||||||
import Application from 'scenes/Application';
|
import Application from 'scenes/Application';
|
||||||
|
|
||||||
import Home from 'scenes/Home';
|
import Home from 'scenes/Home';
|
||||||
import Editor from 'scenes/Editor';
|
|
||||||
import Dashboard from 'scenes/Dashboard';
|
import Dashboard from 'scenes/Dashboard';
|
||||||
import Atlas from 'scenes/Atlas';
|
import Atlas from 'scenes/Atlas';
|
||||||
import DocumentScene from 'scenes/DocumentScene';
|
import DocumentScene from 'scenes/DocumentScene';
|
||||||
import DocumentEdit from 'scenes/DocumentEdit';
|
import DocumentEdit from 'scenes/DocumentEdit';
|
||||||
import SlackAuth from 'scenes/SlackAuth';
|
import SlackAuth from 'scenes/SlackAuth';
|
||||||
|
|
||||||
|
import DevTools from 'mobx-react-devtools';
|
||||||
|
|
||||||
function requireAuth(nextState, replace) {
|
function requireAuth(nextState, replace) {
|
||||||
if (!userStore.authenticated) {
|
if (!userStore.authenticated) {
|
||||||
replace({
|
replace({
|
||||||
@@ -46,7 +42,6 @@ render((
|
|||||||
|
|
||||||
<Route path="/dashboard" component={ Dashboard } onEnter={ requireAuth } />
|
<Route path="/dashboard" component={ Dashboard } onEnter={ requireAuth } />
|
||||||
<Route path="/atlas/:id" component={ Atlas } onEnter={ requireAuth } />
|
<Route path="/atlas/:id" component={ Atlas } onEnter={ requireAuth } />
|
||||||
<Route path="/atlas/:id/new" component={ Editor } onEnter={ requireAuth } />
|
|
||||||
<Route path="/documents/:id" component={ DocumentScene } onEnter={ requireAuth } />
|
<Route path="/documents/:id" component={ DocumentScene } onEnter={ requireAuth } />
|
||||||
<Route path="/documents/:id/edit" component={ DocumentEdit } onEnter={ requireAuth } />
|
<Route path="/documents/:id/edit" component={ DocumentEdit } onEnter={ requireAuth } />
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ class DocumentEdit extends Component {
|
|||||||
|
|
||||||
EditorLoader()
|
EditorLoader()
|
||||||
.then(({ Editor }) => {
|
.then(({ Editor }) => {
|
||||||
console.log("loaded", Editor);
|
|
||||||
this.setState({ Editor });
|
this.setState({ Editor });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { observable, action, computed, autorun } from 'mobx';
|
import { observable, action, computed, autorun } from 'mobx';
|
||||||
import { client } from 'utils/ApiClient';
|
import { client } from 'utils/ApiClient';
|
||||||
import localforage from 'localforage';
|
import localforage from 'localforage';
|
||||||
import { convertToMarkdown } from 'utils/markdown';
|
|
||||||
import { browserHistory } from 'react-router'
|
import { browserHistory } from 'react-router'
|
||||||
|
|
||||||
const DOCUMENT_EDIT_SETTINGS = 'DOCUMENT_EDIT_SETTINGS';
|
const DOCUMENT_EDIT_SETTINGS = 'DOCUMENT_EDIT_SETTINGS';
|
||||||
@@ -24,15 +23,6 @@ const documentEditState = new class DocumentEditState {
|
|||||||
@observable isFetching;
|
@observable isFetching;
|
||||||
@observable isSaving;
|
@observable isSaving;
|
||||||
|
|
||||||
/* Computed */
|
|
||||||
|
|
||||||
@computed get htmlPreview() {
|
|
||||||
// Only compute if preview is active
|
|
||||||
if (this.preview) {
|
|
||||||
return convertToMarkdown(this.text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Actions */
|
/* Actions */
|
||||||
|
|
||||||
@action fetchDocument = async () => {
|
@action fetchDocument = async () => {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
|
import { convertToMarkdown } from 'utils/markdown';
|
||||||
|
|
||||||
import MarkdownEditor from 'components/MarkdownEditor';
|
import MarkdownEditor from 'components/MarkdownEditor';
|
||||||
import Preview from './Preview';
|
import Preview from './Preview';
|
||||||
@@ -27,7 +28,7 @@ const Editor = observer((props) => {
|
|||||||
<EditorPane
|
<EditorPane
|
||||||
scrollTop={ props.scrollTop }
|
scrollTop={ props.scrollTop }
|
||||||
>
|
>
|
||||||
<Preview html={ store.htmlPreview } />
|
<Preview html={ store.text } />
|
||||||
</EditorPane>
|
</EditorPane>
|
||||||
) : null }
|
) : null }
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const cx = classNames.bind(styles);
|
|||||||
const Preview = (props) => {
|
const Preview = (props) => {
|
||||||
return (
|
return (
|
||||||
<div className={ styles.preview }>
|
<div className={ styles.preview }>
|
||||||
<DocumentHtml html={ props.html } />
|
<DocumentHtml html={ props.html } />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user