editor-codeblock.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template lang="pug">
  2. transition(:duration="400")
  3. .modal(v-show='isShown', v-cloak)
  4. transition(name='modal-background')
  5. .modal-background(v-show='isShown')
  6. .modal-container
  7. transition(name='modal-content')
  8. .modal-content.is-expanded(v-show='isShown')
  9. header.is-green
  10. span Insert Code Block
  11. section.is-gapless
  12. .columns.is-stretched
  13. .column.is-one-quarter.modal-sidebar.is-green(style={'max-width':'350px'})
  14. .model-sidebar-header Language
  15. .model-sidebar-content
  16. p.control.is-fullwidth
  17. select(v-model='modeSelected')
  18. option(v-for='mode in modes', v-bind:value='mode.name') {{ mode.caption }}
  19. .column.ace-container
  20. #codeblock-editor
  21. footer
  22. a.button.is-grey.is-outlined(v-on:click='cancel') Discard
  23. a.button.is-green(v-on:click='insertCode') Insert Code Block
  24. </template>
  25. <script>
  26. export default {
  27. name: 'editor-codeblock',
  28. data () {
  29. return {}
  30. },
  31. computed: {
  32. isShown () {
  33. return this.$store.state.editorCodeblock.shown
  34. }
  35. },
  36. methods: {
  37. cancel () {
  38. this.$store.dispatch('editorCodeBlock/close')
  39. },
  40. insertCode () {
  41. this.$store.dispatch('alert', {
  42. style: 'pink',
  43. icon: 'inbox',
  44. msg: 'Your code block has been inserted.'
  45. })
  46. this.cancel()
  47. }
  48. }
  49. }
  50. </script>