mirror of
https://github.com/wekan/wekan.git
synced 2026-01-06 09:38:49 +01:00
wipon card description - prevention of unintentional exit deletesunsaved description
This commit is contained in:
parent
aa067b777a
commit
b00169d24f
2 changed files with 12 additions and 4 deletions
|
|
@ -26,8 +26,6 @@ BlazeComponent.extendComponent({
|
|||
// was keydown
|
||||
// extraevent for saving input. buffer of keydown vs buffer time
|
||||
'keyup form textarea'(evt) {
|
||||
const description = this.getInput()[0].value;
|
||||
this.data().setDescription(description);
|
||||
if (evt.keyCode === 13 && (evt.metaKey || evt.ctrlKey)) {
|
||||
const submitButton = this.find('button[type=submit]');
|
||||
if (submitButton) {
|
||||
|
|
|
|||
|
|
@ -1714,10 +1714,20 @@ BlazeComponent.extendComponent({
|
|||
EscapeActions.register(
|
||||
'detailsPane',
|
||||
() => {
|
||||
currentDescription = document.getElementsByClassName("editor js-new-description-input").item(0)
|
||||
//save description editing on EscapeAction
|
||||
if (document.getElementsByClassName("editor js-new-description-input").item(0))
|
||||
if (currentDescription?.value && !(currentDescription.value === Utils.getCurrentCard().getDescription()))
|
||||
{
|
||||
Utils.getCurrentCard().setDescription(document.getElementsByClassName("editor js-new-description-input").item(0).value);
|
||||
console.log("equal?",!(currentDescription === Utils.getCurrentCard().getDescription()));
|
||||
if (confirm('Are you sure you want to save this thing into the database?')) {
|
||||
Utils.getCurrentCard().setDescription(document.getElementsByClassName("editor js-new-description-input").item(0).value);
|
||||
// Save it!
|
||||
console.log(document.getElementsByClassName("editor js-new-description-input").item(0).value);
|
||||
console.log("current description",Utils.getCurrentCard().getDescription());
|
||||
} else {
|
||||
// Do nothing!
|
||||
console.log('Thing was not saved to the database.');
|
||||
}
|
||||
}
|
||||
if (Session.get('cardDetailsIsDragging')) {
|
||||
// Reset dragging status as the mouse landed outside the cardDetails template area and this will prevent a mousedown event from firing
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue