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.

61 lines
1.1 KiB

  1. <template>
  2. <editor
  3. v-model="project.guideline"
  4. preview-style="vertical"
  5. height="inherit"
  6. :options="editorOptions"
  7. />
  8. </template>
  9. <script>
  10. import _ from 'lodash'
  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 '@/assets/style/editor.css'
  16. export default {
  17. layout: 'project',
  18. components: {
  19. Editor
  20. },
  21. data() {
  22. return {
  23. editorOptions: {
  24. language: this.$t('toastui.localeCode')
  25. },
  26. project: {}
  27. }
  28. },
  29. watch: {
  30. 'project.guideline'() {
  31. this.updateProject()
  32. }
  33. },
  34. async created() {
  35. const projectId = this.$route.params.id
  36. this.project = await this.$services.project.findById(projectId)
  37. },
  38. methods: {
  39. updateProject: _.debounce(function() {
  40. this.$services.project.update(this.project)
  41. }, 1000)
  42. },
  43. validate({ params }) {
  44. return /^\d+$/.test(params.id)
  45. }
  46. }
  47. </script>
  48. <style>
  49. .te-md-container .CodeMirror, .tui-editor-contents {
  50. font-size: 20px;
  51. }
  52. </style>