| 206 | let textValue = input.value; |
| 207 | textValue = textValue.replace(/ /g, this.spaceReplace); |
| 208 | input.value = textValue; |
| 209 | if (this.charLimit !== -1) { |
| 210 | const left = this.charLimit - textValue.length; |
| 211 | if (left / this.charLimit < 0.2) { |
| 212 | if (!hintText) { |
| 213 | hintText = document.createElement("span"); |
| 214 | hintText.classList.add("hintTextInput"); |
| 215 | } |
| 216 | div.append(hintText); |
| 217 | hintText.textContent = I18n.charLeft(left + ""); |
| 218 | } else if (hintText) { |
| 219 | hintText.remove(); |
| 220 | } |
| 221 | } |
| 222 | }; |
| 223 | this.input = new WeakRef(input); |
| 224 | if (this.charLimit !== -1) input.maxLength = this.charLimit; |