editor-codeblock.js 530 B

12345678910111213141516171819202122
  1. /* global wikijs */
  2. export default {
  3. namespaced: true,
  4. state: {
  5. shown: false,
  6. content: ''
  7. },
  8. getters: {},
  9. mutations: {
  10. shownChange: (state, shownState) => { state.shown = shownState },
  11. contentChange: (state, newContent) => { state.content = newContent }
  12. },
  13. actions: {
  14. open({ commit }, opts) {
  15. commit('shownChange', true)
  16. commit('contentChange', opts.initialContent || '')
  17. wikijs.$emit('editorCodeblock/init')
  18. },
  19. close({ commit }) { commit('shownChange', false) }
  20. }
  21. }