2018-05-09 12:01:36 +05:30
|
|
|
import $ from 'jquery';
|
2018-03-17 18:26:18 +05:30
|
|
|
import Autosave from '../../autosave';
|
2018-03-27 19:54:05 +05:30
|
|
|
import { capitalizeFirstCharacter } from '../../lib/utils/text_utility';
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
export default {
|
|
|
|
methods: {
|
2018-11-18 11:00:15 +05:30
|
|
|
initAutoSave(noteable, extraKeys = []) {
|
|
|
|
let keys = [
|
2018-05-09 12:01:36 +05:30
|
|
|
'Note',
|
2018-11-18 11:00:15 +05:30
|
|
|
capitalizeFirstCharacter(noteable.noteable_type || noteable.noteableType),
|
2018-11-08 19:23:39 +05:30
|
|
|
noteable.id,
|
2018-11-18 11:00:15 +05:30
|
|
|
];
|
|
|
|
|
|
|
|
if (extraKeys) {
|
|
|
|
keys = keys.concat(extraKeys);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.autosave = new Autosave($(this.$refs.noteForm.$refs.textarea), keys);
|
2018-03-17 18:26:18 +05:30
|
|
|
},
|
|
|
|
resetAutoSave() {
|
|
|
|
this.autosave.reset();
|
|
|
|
},
|
|
|
|
setAutoSave() {
|
|
|
|
this.autosave.save();
|
|
|
|
},
|
2018-11-18 11:00:15 +05:30
|
|
|
disposeAutoSave() {
|
|
|
|
this.autosave.dispose();
|
|
|
|
},
|
2018-03-17 18:26:18 +05:30
|
|
|
},
|
|
|
|
};
|