Closed brynnlow closed 1 year ago
warning @mohsen77sk in normal situation MaxLength = -1
it can generate bug with const inputMaxLength = this._activeInputElement?.maxLength ?? 0; you have to test is this._activeInputElement?.maxLength > -1
my function
private isMaxLengthReached(output: string): boolean { return this._activeInputElement.maxLength != null && this._activeInputElement.maxLength != -1 && this._activeInputElement.maxLength <= output.length }
if (!this.isStandardButton(button)) { // Handel functional button if (button === fnButton.BACKSPACE) { if (output.length > 0) output = this._removeAt(output, ...commonParams); } else if (button === fnButton.SPACE) { if(!this.isMaxLengthReached(output)) { output = this._addStringAt(output, ' ', ...commonParams); } } else if (button === fnButton.TAB) { if (!this.isMaxLengthReached(output) && this.isTextArea()) { output = this._addStringAt(output, '\t', ...commonParams); } } else if (button === fnButton.ENTER) { if (!this.isMaxLengthReached(output) && this.isTextArea()) { output = this._addStringAt(output, '\n', ...commonParams); } } else { this.layoutName = button.substring(1, button.length - 1); return; } } else { // Handel standard button if (!this.isMaxLengthReached(output)) { output = this._addStringAt(output, button, ...commonParams); } }
it is me again 😆
the virtual keyboard should respect the maxLength property like normal keyboard