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.

36 lines
665 B

  1. import Vue from 'vue';
  2. import HTTP from './http';
  3. const vm = new Vue({
  4. el: '#editor',
  5. data: {
  6. input: '# hello',
  7. project: Object,
  8. },
  9. computed: {
  10. compiledMarkdown() {
  11. return marked(this.input, {
  12. sanitize: true,
  13. });
  14. },
  15. },
  16. created() {
  17. HTTP.get().then((response) => {
  18. this.input = response.data.guideline;
  19. this.project = response.data;
  20. });
  21. },
  22. methods: {
  23. update: _.debounce(function(e) {
  24. this.input = e.target.value;
  25. this.project.guideline = this.input;
  26. HTTP.put('', this.project).then((response) => {
  27. this.project = response.data;
  28. });
  29. }, 300),
  30. },
  31. });