diff --git a/ui/shared/status/StatusChatInput.qml b/ui/shared/status/StatusChatInput.qml index 72caad26f7..27818b5aa8 100644 --- a/ui/shared/status/StatusChatInput.qml +++ b/ui/shared/status/StatusChatInput.qml @@ -708,6 +708,10 @@ Rectangle { StatusTextFormatMenu { id: textFormatMenu + function surroundedBy(chars) { + return messageInputField.selectedText.trim().startsWith(chars) && + messageInputField.selectedText.trim().endsWith(chars) + } Action { icon.name: "format-text-bold" icon.width: 12 @@ -715,6 +719,7 @@ Rectangle { onTriggered: wrapSelection("**") //% "Bold" text: qsTrId("bold") + checked: textFormatMenu.surroundedBy("**") } Action { icon.name: "format-text-italic" @@ -723,6 +728,7 @@ Rectangle { onTriggered: wrapSelection("*") //% "Italic" text: qsTrId("italic") + checked: textFormatMenu.surroundedBy("*") && !textFormatMenu.surroundedBy("**") } Action { icon.name: "format-text-strike-through" @@ -731,6 +737,7 @@ Rectangle { onTriggered: wrapSelection("~~") //% "Strikethrough" text: qsTrId("strikethrough") + checked: textFormatMenu.surroundedBy("~~") } Action { icon.name: "format-text-code" @@ -739,6 +746,7 @@ Rectangle { onTriggered: wrapSelection("`") //% "Code" text: qsTrId("code") + checked: textFormatMenu.surroundedBy("`") } } } diff --git a/ui/shared/status/StatusTextFormatMenu.qml b/ui/shared/status/StatusTextFormatMenu.qml index 9a940b4612..a99983fa3f 100644 --- a/ui/shared/status/StatusTextFormatMenu.qml +++ b/ui/shared/status/StatusTextFormatMenu.qml @@ -65,6 +65,7 @@ Menu { icon.width: menuItem.action.icon.width icon.height: menuItem.action.icon.height onClicked: menuItem.action.trigger() + highlighted: menuItem.action.checked StatusToolTip { visible: parent.hovered text: menuItem.action.text