From a505bc9eef1369479f64e9e04dc9ceb676fcf42c Mon Sep 17 00:00:00 2001
From: Franck LAURENT <franck.laurent@savoirfairelinux.com>
Date: Thu, 9 Mar 2023 10:39:44 -0500
Subject: [PATCH] modalTextEdit: show placeholder and hide under line text when
 selected

GitLab: #986

Change-Id: I232aa5ce9eed883aaef43ea96c2a798103ec7984
---
 src/app/commoncomponents/MaterialTextField.qml | 7 +++----
 src/app/commoncomponents/ModalTextEdit.qml     | 2 +-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/app/commoncomponents/MaterialTextField.qml b/src/app/commoncomponents/MaterialTextField.qml
index b63f5d294..4b4096c96 100644
--- a/src/app/commoncomponents/MaterialTextField.qml
+++ b/src/app/commoncomponents/MaterialTextField.qml
@@ -50,7 +50,6 @@ TextField {
     placeholderTextColor: !isActive
                           ? JamiTheme.transparentColor
                           : JamiTheme.placeholderTextColor
-    property string initialPlaceholderText
 
     property alias infoTipText: infoTip.text
 
@@ -106,7 +105,7 @@ TextField {
         font.pointSize: root.font.pointSize
         anchors.baseline: root.baseline
         anchors.horizontalCenter: root.horizontalCenter
-        text: root.initialPlaceholderText
+        text: root.placeholderText
         color: root.baseColor
         visible: !root.isActive && !readOnly && root.text.toString() === ""
     }
@@ -147,11 +146,11 @@ TextField {
         font.pointSize: root.font.pointSize - 3
         anchors.top: baselineLine.bottom
         anchors.topMargin: 2
-        text: root.initialPlaceholderText
+        text: root.placeholderText
         color: root.baseColor
 
         // Show the alternate placeholder while the user types.
-        visible: root.isActive && !readOnly
+        visible: root.isActive && !readOnly && root.text.toString() !== ""
     }
 
     TextFieldIcon {
diff --git a/src/app/commoncomponents/ModalTextEdit.qml b/src/app/commoncomponents/ModalTextEdit.qml
index 33bbb24a3..76548e4fc 100644
--- a/src/app/commoncomponents/ModalTextEdit.qml
+++ b/src/app/commoncomponents/ModalTextEdit.qml
@@ -92,7 +92,7 @@ Loader {
             font.pointSize: root.fontPointSize
             font.bold: root.fontBold
             echoMode: root.echoMode
-            initialPlaceholderText: root.placeholderText
+            placeholderText: root.placeholderText
             onAccepted: root.accepted()
             onTextChanged: dynamicText = text
             text: staticText
-- 
GitLab