summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/notes/mixins/autosave.js
blob: 837a4029346b2bbdb0037d8cef63e02ac5548082 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import $ from 'jquery';
import Autosave from '../../autosave';
import { capitalizeFirstCharacter } from '../../lib/utils/text_utility';

export default {
  methods: {
    initAutoSave(noteableType) {
      this.autosave = new Autosave($(this.$refs.noteForm.$refs.textarea), ['Note', capitalizeFirstCharacter(noteableType), this.note.id]);
    },
    resetAutoSave() {
      this.autosave.reset();
    },
    setAutoSave() {
      this.autosave.save();
    },
  },
};