Skip to content

Commit

Permalink
fix: call updateMeiData when MEI cell is empty
Browse files Browse the repository at this point in the history
Resolves: #117
  • Loading branch information
yinanazhou committed Jul 12, 2024
1 parent e902b70 commit dac1259
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/Editor/MeiTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,18 @@ export class MeiTools {

case 'afterChange':
changes?.forEach(([row, prop, oldValue, newValue]) => {
if (prop === 'mei' && oldValue !== newValue && newValue) {
// validate the new edited mei data and update the validation status
this.updateMeiData(row, newValue, undefined, undefined);
const validationPromise = this.validationTools
.meiValidator(newValue)
.then(([isValid, errorMsg]) => {
this.updateMeiData(row, undefined, isValid, errorMsg);
});
validationPromises.push(validationPromise);
if (prop === 'mei' && oldValue !== newValue) {
if (newValue) {
// validate the new edited mei data and update the validation status
const validationPromise = this.validationTools
.meiValidator(newValue)
.then(([isValid, errorMsg]) => {
this.updateMeiData(row, newValue, isValid, errorMsg);
});
validationPromises.push(validationPromise);
} else {
this.updateMeiData(row, newValue, undefined, undefined);
}
}
});
}
Expand Down

0 comments on commit dac1259

Please sign in to comment.