decorateKoCommands() each command must have function

And due to that, a bug is found and solved in MessageView
This commit is contained in:
the-djmaze 2022-03-03 17:34:45 +01:00
parent a67fb22bee
commit f50f2c5ea0
5 changed files with 40 additions and 49 deletions

6
dev/External/ko.js vendored
View file

@ -99,7 +99,7 @@ Object.assign(ko.bindingHandlers, {
init: (element, fValueAccessor, fAllBindings, viewModel, bindingContext) => {
const command = fValueAccessor();
if (!command || !command.enabled || !command.canExecute) {
if (!command || !command.canExecute) {
throw new Error('Value should be a command');
}
@ -115,9 +115,7 @@ Object.assign(ko.bindingHandlers, {
const cl = element.classList,
command = fValueAccessor();
let disabled = !command.enabled();
disabled = disabled || !command.canExecute();
let disabled = !command.canExecute();
cl.toggle('disabled', disabled);
if (element.matches('INPUT,TEXTAREA,BUTTON')) {