2020-11-02 21:58:13 +02:00
|
|
|
const descriptionFormIsOpen = new ReactiveVar(false);
|
|
|
|
|
|
|
|
|
|
BlazeComponent.extendComponent({
|
|
|
|
|
onDestroyed() {
|
|
|
|
|
descriptionFormIsOpen.set(false);
|
2021-04-16 21:47:39 +03:00
|
|
|
$('.note-popover').hide();
|
2020-11-02 21:58:13 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
descriptionFormIsOpen() {
|
|
|
|
|
return descriptionFormIsOpen.get();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getInput() {
|
|
|
|
|
return this.$('.js-new-description-input');
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
events() {
|
|
|
|
|
return [
|
|
|
|
|
{
|
|
|
|
|
'submit .js-card-description'(event) {
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
const description = this.currentComponent().getValue();
|
|
|
|
|
this.data().setDescription(description);
|
|
|
|
|
},
|
|
|
|
|
// Pressing Ctrl+Enter should submit the form
|
|
|
|
|
'keydown form textarea'(evt) {
|
|
|
|
|
if (evt.keyCode === 13 && (evt.metaKey || evt.ctrlKey)) {
|
2021-10-18 15:52:37 +02:00
|
|
|
const submitButton = this.find('button[type=submit]');
|
|
|
|
|
if (submitButton) {
|
|
|
|
|
submitButton.click();
|
|
|
|
|
}
|
2020-11-02 21:58:13 +02:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
},
|
|
|
|
|
}).register('descriptionForm');
|