refactor: editor codeblock -> Vue component

This commit is contained in:
NGPixel
2017-05-28 14:34:50 -04:00
parent ebe288a5b2
commit f577a8134e
14 changed files with 295 additions and 303 deletions

View File

@@ -3,14 +3,20 @@
export default {
namespaced: true,
state: {
shown: false
shown: false,
content: ''
},
getters: {},
mutations: {
shownChange: (state, shownState) => { state.shown = shownState }
shownChange: (state, shownState) => { state.shown = shownState },
contentChange: (state, newContent) => { state.content = newContent }
},
actions: {
open({ commit }) { commit('shownChange', true) },
open({ commit }, opts) {
commit('shownChange', true)
commit('contentChange', opts.initialContent || '')
wikijs.$emit('editorCodeblock/init')
},
close({ commit }) { commit('shownChange', false) }
}
}

View File

@@ -2,8 +2,21 @@
export default {
namespaced: true,
state: {},
state: {
busy: false,
insertContent: ''
},
getters: {},
mutations: {},
actions: {}
mutations: {
busyChange: (state, busyState) => { state.shown = busyState },
insertContentChange: (state, newContent) => { state.insertContent = newContent }
},
actions: {
busyStart({ commit }) { commit('busyChange', true) },
busyStop({ commit }) { commit('busyChange', false) },
insert({ commit }, content) {
commit('insertContentChange', content)
wikijs.$emit('editor/insert')
}
}
}