Editor: Set values as prop instead of attr - fixes #6075

pull/9511/head
Benedikt Werner 2021-07-31 13:13:01 +02:00
parent 75ec57f5f3
commit 25bc8beaed
No known key found for this signature in database
GPG Key ID: 1DBFF0F8E9E121EB
2 changed files with 6 additions and 2 deletions

View File

@ -77,7 +77,7 @@ export default class EditorCtrl {
if (fen == INITIAL_FEN) window.history.replaceState(state, '', '/editor');
else window.history.replaceState(state, '', this.makeUrl('/editor/', fen));
}
this.options.onChange && this.options.onChange(fen);
this.options.onChange?.(fen);
this.redraw();
}

View File

@ -13,6 +13,8 @@ function castleCheckBox(ctrl: EditorCtrl, id: CastlingToggle, label: string, rev
const input = h('input', {
attrs: {
type: 'checkbox',
},
props: {
checked: ctrl.castlingToggles[id],
},
on: {
@ -163,6 +165,9 @@ function controls(ctrl: EditorCtrl, state: EditorState): VNode {
ctrl.setTurn((e.target as HTMLSelectElement).value as Color);
},
},
props: {
value: ctrl.turn,
},
},
['whitePlays', 'blackPlays'].map(function (key) {
return h(
@ -170,7 +175,6 @@ function controls(ctrl: EditorCtrl, state: EditorState): VNode {
{
attrs: {
value: key[0] == 'w' ? 'white' : 'black',
selected: ctrl.turn[0] === key[0],
},
},
ctrl.trans(key)