Removed the redundant "summary" parameter from the "#onOpen" and static "start" methods of JavaScript SummaryEditor.

This commit is contained in:
依瑪貓 2023-03-18 18:00:54 +08:00
parent 38c394c0af
commit fc766724c4
2 changed files with 5 additions and 7 deletions

View File

@ -220,7 +220,7 @@ class JournalEntryEditor {
this.#amountError = document.getElementById(this.#prefix + "-amount-error"); this.#amountError = document.getElementById(this.#prefix + "-amount-error");
this.#originalEntryControl.onclick = () => OriginalEntrySelector.start(this, this.originalEntryId); this.#originalEntryControl.onclick = () => OriginalEntrySelector.start(this, this.originalEntryId);
this.#originalEntryDelete.onclick = () => this.clearOriginalEntry(); this.#originalEntryDelete.onclick = () => this.clearOriginalEntry();
this.#summaryControl.onclick = () => SummaryEditor.start(this, this.summary); this.#summaryControl.onclick = () => SummaryEditor.start(this);
this.#accountControl.onclick = () => AccountSelector.start(this, this.entryType); this.#accountControl.onclick = () => AccountSelector.start(this, this.entryType);
this.#amount.onchange = () => this.#validateAmount(); this.#amount.onchange = () => this.#validateAmount();
this.#element.onsubmit = () => { this.#element.onsubmit = () => {

View File

@ -228,12 +228,11 @@ class SummaryEditor {
* The callback when the summary editor is shown. * The callback when the summary editor is shown.
* *
* @param entryEditor {JournalEntryEditor} the journal entry editor * @param entryEditor {JournalEntryEditor} the journal entry editor
* @param summary {string|null} the summary
*/ */
#onOpen(entryEditor, summary) { #onOpen(entryEditor) {
this.#entryEditor = entryEditor; this.#entryEditor = entryEditor;
this.#reset(); this.#reset();
this.summary.value = summary === null? "": summary; this.summary.value = entryEditor.summary === null? "": entryEditor.summary;
this.#onSummaryChange(); this.#onSummaryChange();
} }
@ -271,10 +270,9 @@ class SummaryEditor {
* The callback when the summary editor is shown. * The callback when the summary editor is shown.
* *
* @param entryEditor {JournalEntryEditor} the journal entry editor * @param entryEditor {JournalEntryEditor} the journal entry editor
* @param summary {string|null} the summary
*/ */
static start(entryEditor, summary) { static start(entryEditor) {
this.#editors[entryEditor.entryType].#onOpen(entryEditor, summary); this.#editors[entryEditor.entryType].#onOpen(entryEditor);
} }
} }