From 6303bc927938db34d7368f692b96e05ac01cb9fe Mon Sep 17 00:00:00 2001 From: Jori Lallo Date: Sun, 5 Jun 2016 14:38:14 -0700 Subject: [PATCH] Clean up and smaller bundle.js --- package.json | 5 ----- src/components/Document/Document.js | 1 - src/index.js | 9 ++------- src/scenes/DocumentEdit/DocumentEdit.js | 1 - src/scenes/DocumentEdit/DocumentEditState.js | 10 ---------- src/scenes/DocumentEdit/components/Editor.js | 3 ++- src/scenes/DocumentEdit/components/Preview.js | 2 +- 7 files changed, 5 insertions(+), 26 deletions(-) diff --git a/package.json b/package.json index f1becb850..b82486bf0 100644 --- a/package.json +++ b/package.json @@ -96,11 +96,6 @@ "react-router": "^2.0.0", "react-router-redux": "^4.0.4", "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", "sass-loader": "^3.2.0", "sequelize": "^3.21.0", diff --git a/src/components/Document/Document.js b/src/components/Document/Document.js index d71c51ec7..ab26504d6 100644 --- a/src/components/Document/Document.js +++ b/src/components/Document/Document.js @@ -1,7 +1,6 @@ import React from 'react'; import { observer } from 'mobx-react'; import moment from 'moment'; -import marked from 'marked'; import { Link } from 'react-router'; import PublishingInfo from 'components/PublishingInfo'; diff --git a/src/index.js b/src/index.js index af9a7d22c..fc1210c03 100644 --- a/src/index.js +++ b/src/index.js @@ -4,12 +4,7 @@ import { Provider } from 'react-redux'; import Router from 'react-router/lib/Router'; import Route from 'react-router/lib/Route'; 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 DevTools from 'mobx-react-devtools'; import userStore from 'stores/UserStore'; @@ -22,13 +17,14 @@ import 'assets/styles/codemirror.css'; import Application from 'scenes/Application'; import Home from 'scenes/Home'; -import Editor from 'scenes/Editor'; import Dashboard from 'scenes/Dashboard'; import Atlas from 'scenes/Atlas'; import DocumentScene from 'scenes/DocumentScene'; import DocumentEdit from 'scenes/DocumentEdit'; import SlackAuth from 'scenes/SlackAuth'; +import DevTools from 'mobx-react-devtools'; + function requireAuth(nextState, replace) { if (!userStore.authenticated) { replace({ @@ -46,7 +42,6 @@ render(( - diff --git a/src/scenes/DocumentEdit/DocumentEdit.js b/src/scenes/DocumentEdit/DocumentEdit.js index ff5193647..3b9ca8cce 100644 --- a/src/scenes/DocumentEdit/DocumentEdit.js +++ b/src/scenes/DocumentEdit/DocumentEdit.js @@ -25,7 +25,6 @@ class DocumentEdit extends Component { EditorLoader() .then(({ Editor }) => { - console.log("loaded", Editor); this.setState({ Editor }); }); } diff --git a/src/scenes/DocumentEdit/DocumentEditState.js b/src/scenes/DocumentEdit/DocumentEditState.js index 89cef7a44..53a380df8 100644 --- a/src/scenes/DocumentEdit/DocumentEditState.js +++ b/src/scenes/DocumentEdit/DocumentEditState.js @@ -1,7 +1,6 @@ import { observable, action, computed, autorun } from 'mobx'; import { client } from 'utils/ApiClient'; import localforage from 'localforage'; -import { convertToMarkdown } from 'utils/markdown'; import { browserHistory } from 'react-router' const DOCUMENT_EDIT_SETTINGS = 'DOCUMENT_EDIT_SETTINGS'; @@ -24,15 +23,6 @@ const documentEditState = new class DocumentEditState { @observable isFetching; @observable isSaving; - /* Computed */ - - @computed get htmlPreview() { - // Only compute if preview is active - if (this.preview) { - return convertToMarkdown(this.text); - } - } - /* Actions */ @action fetchDocument = async () => { diff --git a/src/scenes/DocumentEdit/components/Editor.js b/src/scenes/DocumentEdit/components/Editor.js index af90f0b0b..bc28282b5 100644 --- a/src/scenes/DocumentEdit/components/Editor.js +++ b/src/scenes/DocumentEdit/components/Editor.js @@ -1,5 +1,6 @@ import React from 'react'; import { observer } from 'mobx-react'; +import { convertToMarkdown } from 'utils/markdown'; import MarkdownEditor from 'components/MarkdownEditor'; import Preview from './Preview'; @@ -27,7 +28,7 @@ const Editor = observer((props) => { - + ) : null } diff --git a/src/scenes/DocumentEdit/components/Preview.js b/src/scenes/DocumentEdit/components/Preview.js index 46615fa84..6a0cb627d 100644 --- a/src/scenes/DocumentEdit/components/Preview.js +++ b/src/scenes/DocumentEdit/components/Preview.js @@ -9,7 +9,7 @@ const cx = classNames.bind(styles); const Preview = (props) => { return (
- +
); };