refactor: lazy-load simplemde + minimal lodash
This commit is contained in:
@@ -4,6 +4,7 @@ import Vuex from 'vuex'
|
||||
import alert from './modules/alert'
|
||||
import anchor from './modules/anchor'
|
||||
import editor from './modules/editor'
|
||||
import editorCodeblock from './modules/editor-codeblock'
|
||||
import modalCreatePage from './modules/modal-create-page'
|
||||
import modalCreateUser from './modules/modal-create-user'
|
||||
import modalDiscardPage from './modules/modal-discard-page'
|
||||
@@ -28,6 +29,7 @@ export default new Vuex.Store({
|
||||
alert,
|
||||
anchor,
|
||||
editor,
|
||||
editorCodeblock,
|
||||
modalCreatePage,
|
||||
modalCreateUser,
|
||||
modalDiscardPage,
|
||||
|
@@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
import _ from 'lodash'
|
||||
import debounce from 'lodash/debounce'
|
||||
|
||||
export default {
|
||||
state: {
|
||||
@@ -24,7 +24,7 @@ export default {
|
||||
commit('alertChange', opts)
|
||||
dispatch('alertDismiss')
|
||||
},
|
||||
alertDismiss: _.debounce(({ commit }) => {
|
||||
alertDismiss: debounce(({ commit }) => {
|
||||
let opts = { shown: false }
|
||||
commit('alertChange', opts)
|
||||
}, 3000)
|
||||
|
16
client/js/store/modules/editor-codeblock.js
Normal file
16
client/js/store/modules/editor-codeblock.js
Normal file
@@ -0,0 +1,16 @@
|
||||
'use strict'
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
shown: false
|
||||
},
|
||||
getters: {},
|
||||
mutations: {
|
||||
shownChange: (state, shownState) => { state.shown = shownState }
|
||||
},
|
||||
actions: {
|
||||
open({ commit }) { commit('shownChange', true) },
|
||||
close({ commit }) { commit('shownChange', false) }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user