You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.1 KiB

  1. <template>
  2. <editor
  3. v-if="current"
  4. v-model="editorText"
  5. preview-style="vertical"
  6. height="inherit"
  7. />
  8. </template>
  9. <script>
  10. import 'tui-editor/dist/tui-editor.css'
  11. import 'tui-editor/dist/tui-editor-contents.css'
  12. import 'codemirror/lib/codemirror.css'
  13. import { Editor } from '@toast-ui/vue-editor'
  14. import { mapState, mapActions } from 'vuex'
  15. export default {
  16. layout: 'project',
  17. components: {
  18. Editor
  19. },
  20. validate({ params }) {
  21. return /^\d+$/.test(params.id)
  22. },
  23. computed: {
  24. ...mapState('projects', ['current']),
  25. editorText: {
  26. get() {
  27. return this.current.guideline
  28. },
  29. set(value) {
  30. const data = {
  31. projectId: this.$route.params.id,
  32. guideline: value
  33. }
  34. this.updateCurrentProject(data)
  35. }
  36. }
  37. },
  38. async created() {
  39. await this.setCurrentProject(this.$route.params.id)
  40. },
  41. methods: {
  42. ...mapActions('projects', ['setCurrentProject', 'updateCurrentProject'])
  43. }
  44. }
  45. </script>
  46. <style>
  47. .te-md-container .CodeMirror, .tui-editor-contents {
  48. font-size: 20px;
  49. }
  50. </style>