Only reset character counters when they are present
Co-authored-by: Andreas Nedbal <git@pixelde.su>
This commit is contained in:
parent
2e7fca67fa
commit
cfba963b55
|
@ -24,10 +24,6 @@ export function questionboxAllHandler(event: Event): void {
|
|||
document.querySelector<HTMLInputElement>('textarea[name=qb-all-question]').value = '';
|
||||
const modal = Modal.getInstance(document.querySelector('#modal-ask-followers'));
|
||||
modal.hide();
|
||||
|
||||
// FIXME: also solve this using a Stimulus controller
|
||||
const characterCount = document.querySelector<HTMLElement>('#modal-ask-followers [data-character-count-max-value]').dataset.characterCountMaxValue;
|
||||
document.querySelector<HTMLElement>('#modal-ask-followers [data-character-count-target="counter"]').innerHTML = characterCount;
|
||||
}
|
||||
|
||||
showNotification(data.message, data.success);
|
||||
|
|
|
@ -30,8 +30,10 @@ export function questionboxUserHandler(event: Event): void {
|
|||
document.querySelector<HTMLInputElement>('textarea[name=qb-question]').value = '';
|
||||
|
||||
// FIXME: also solve this using a Stimulus controller
|
||||
const characterCount = document.querySelector<HTMLElement>('#question-box[data-character-count-max-value]').dataset.characterCountMaxValue;
|
||||
document.querySelector<HTMLElement>('#question-box [data-character-count-target="counter"]').innerHTML = characterCount;
|
||||
const questionBox = document.getElementById('question-box');
|
||||
if ('characterCountMaxValue' in questionBox.dataset) {
|
||||
questionBox.querySelector<HTMLElement>('[data-character-count-target="counter"]').innerHTML = questionBox.dataset.characterCountMaxValue;
|
||||
}
|
||||
|
||||
if (promote) {
|
||||
const questionbox = document.querySelector('#question-box');
|
||||
|
|
Loading…
Reference in New Issue