summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/notes/mixins/autosave.js
blob: 3dff715905f7c4a666eaa8be918c628f66270054 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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();
    },
  },
};