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.

66 lines
1.2 KiB

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