2018-03-09 15:18:59 -05:00
|
|
|
import $ from 'jquery';
|
2017-10-12 12:31:29 -04:00
|
|
|
import Autosave from '../../autosave';
|
2018-02-27 19:10:43 -05:00
|
|
|
import { capitalizeFirstCharacter } from '../../lib/utils/text_utility';
|
2019-05-01 11:54:18 -04:00
|
|
|
import { s__ } from '~/locale';
|
2017-08-04 05:53:58 -04:00
|
|
|
|
|
|
|
export default {
|
|
|
|
methods: {
|
2018-07-31 15:24:16 -04:00
|
|
|
initAutoSave(noteable, extraKeys = []) {
|
|
|
|
let keys = [
|
2019-05-01 11:54:18 -04:00
|
|
|
s__('Autosave|Note'),
|
2018-07-31 15:24:16 -04:00
|
|
|
capitalizeFirstCharacter(noteable.noteable_type || noteable.noteableType),
|
2018-06-21 08:22:40 -04:00
|
|
|
noteable.id,
|
2018-07-31 15:24:16 -04:00
|
|
|
];
|
|
|
|
|
|
|
|
if (extraKeys) {
|
|
|
|
keys = keys.concat(extraKeys);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.autosave = new Autosave($(this.$refs.noteForm.$refs.textarea), keys);
|
2017-08-04 05:53:58 -04:00
|
|
|
},
|
|
|
|
resetAutoSave() {
|
|
|
|
this.autosave.reset();
|
|
|
|
},
|
|
|
|
setAutoSave() {
|
|
|
|
this.autosave.save();
|
|
|
|
},
|
2018-07-31 15:24:16 -04:00
|
|
|
disposeAutoSave() {
|
|
|
|
this.autosave.dispose();
|
|
|
|
},
|
2017-08-04 05:53:58 -04:00
|
|
|
},
|
|
|
|
};
|