mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
parent
9ab1dc253e
commit
2d678bdcf6
4 changed files with 17 additions and 4 deletions
|
@ -117,7 +117,7 @@ ScrollView {
|
|||
image: ":/icons/icons/ui/vertical-ellipsis.png"
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.text: qsTr("Options")
|
||||
onClicked: messageContextMenu.show(row.model.id, row.model.type, row.model.isEncrypted, row.model.isEditable, "", optionsButton)
|
||||
onClicked: messageContextMenu.show(row.model.id, row.model.type, row.model.isEncrypted, row.model.isEditable, "", row.model.body, optionsButton)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,12 +28,12 @@ Item {
|
|||
|
||||
TapHandler {
|
||||
acceptedButtons: Qt.RightButton
|
||||
onSingleTapped: messageContextMenu.show(model.id, model.type, model.isEncrypted, model.isEditable, contentItem.child.hoveredLink)
|
||||
onSingleTapped: messageContextMenu.show(model.id, model.type, model.isEncrypted, model.isEditable, contentItem.child.hoveredLink, contentItem.child.copyText)
|
||||
gesturePolicy: TapHandler.ReleaseWithinBounds
|
||||
}
|
||||
|
||||
TapHandler {
|
||||
onLongPressed: messageContextMenu.show(model.id, model.type, model.isEncrypted, model.isEditable, contentItem.child.hoveredLink)
|
||||
onLongPressed: messageContextMenu.show(model.id, model.type, model.isEncrypted, model.isEditable, contentItem.child.hoveredLink, contentItem.child.copyText)
|
||||
onDoubleTapped: chat.model.reply = model.id
|
||||
gesturePolicy: TapHandler.ReleaseWithinBounds
|
||||
}
|
||||
|
|
|
@ -93,15 +93,20 @@ Page {
|
|||
|
||||
property string eventId
|
||||
property string link
|
||||
property string text
|
||||
property int eventType
|
||||
property bool isEncrypted
|
||||
property bool isEditable
|
||||
|
||||
function show(eventId_, eventType_, isEncrypted_, isEditable_, link_, showAt_) {
|
||||
function show(eventId_, eventType_, isEncrypted_, isEditable_, link_, text_, showAt_) {
|
||||
eventId = eventId_;
|
||||
eventType = eventType_;
|
||||
isEncrypted = isEncrypted_;
|
||||
isEditable = isEditable_;
|
||||
if (text_)
|
||||
text = text_;
|
||||
else
|
||||
text = "";
|
||||
if (link_)
|
||||
link = link_;
|
||||
else
|
||||
|
@ -112,6 +117,13 @@ Page {
|
|||
open();
|
||||
}
|
||||
|
||||
Platform.MenuItem {
|
||||
visible: messageContextMenu.text
|
||||
enabled: visible
|
||||
text: qsTr("Copy")
|
||||
onTriggered: Clipboard.text = messageContextMenu.text
|
||||
}
|
||||
|
||||
Platform.MenuItem {
|
||||
visible: messageContextMenu.link
|
||||
enabled: visible
|
||||
|
|
|
@ -7,6 +7,7 @@ import im.nheko 1.0
|
|||
|
||||
MatrixText {
|
||||
property string formatted: model.data.formattedBody
|
||||
property string copyText: selectedText ? getText(selectionStart, selectionEnd) : model.data.body
|
||||
|
||||
text: "<style type=\"text/css\">a { color:" + colors.link + ";}\ncode { background-color: " + colors.alternateBase + ";}</style>" + formatted.replace("<pre>", "<pre style='white-space: pre-wrap; background-color: " + colors.alternateBase + "'>")
|
||||
width: parent ? parent.width : undefined
|
||||
|
|
Loading…
Reference in a new issue