fix(@desktop/statusq): Fix StatusBaseInput marked dirty in case of

rich text if visual input is empty

Fixes #8599
This commit is contained in:
Ivan Belyakov 2023-02-22 15:48:40 +03:00 committed by IvanBelyakoff
parent bfdd9092e1
commit b901f32dd8
1 changed files with 6 additions and 1 deletions

View File

@ -368,10 +368,15 @@ Item {
onCursorRectangleChanged: Utils.ensureVisible(flick, cursorRectangle)
onActiveFocusChanged: if (root.pristine) root.pristine = false
onTextChanged: {
if (previousText === text) {
if (previousText === text || (previousText == "" && length == 0 && length != text.length)) {
// Not sure why, but the textChanged event was triggered even if it didn't really
// Avoid further processing on initial condition when previousText is empty
// but text is set to default rich text, as it will mark input dirty and
// trigger validation, with likely not valid state
return
}
root.dirty = true
if (root.maximumLength > 0) {
let utf8Length = Utils.encodeUtf8(text).length