refactor: editor codeblock -> Vue component
This commit is contained in:
@@ -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) }
|
||||
}
|
||||
}
|
||||
|
@@ -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')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user