Fix copying multi-line selected rich text
For rich text (rendered HTML) fields and areas, the selectedText property for some reason contains "\u2028" or "\u2029" characters that look like newlines in Qt programs but are just invisible anywhere else. Translate them to normal "\n".
This commit is contained in:
@@ -225,7 +225,7 @@ HTextArea {
|
||||
if (ev.text && autoCompletionOpen) acceptAutoCompletion()
|
||||
|
||||
if (ev.matches(StandardKey.Copy) &&
|
||||
! area.selectedText &&
|
||||
! area.selectedPlainText &&
|
||||
eventList &&
|
||||
(eventList.selectedCount || eventList.currentIndex !== -1))
|
||||
{
|
||||
@@ -237,7 +237,7 @@ HTextArea {
|
||||
// FIXME: buggy
|
||||
// if (ev.modifiers === Qt.NoModifier &&
|
||||
// ev.key === Qt.Key_Backspace &&
|
||||
// ! area.selectedText)
|
||||
// ! area.selectedPlainText)
|
||||
// {
|
||||
// ev.accepted = true
|
||||
// area.remove(
|
||||
|
@@ -82,7 +82,7 @@ HRowLayout {
|
||||
window.settings.maxMessageCharactersPerLine
|
||||
)
|
||||
|
||||
readonly property alias selectedText: contentLabel.selectedText
|
||||
readonly property alias selectedText: contentLabel.selectedPlainText
|
||||
|
||||
|
||||
spacing: theme.chat.message.horizontalSpacing
|
||||
@@ -182,9 +182,9 @@ HRowLayout {
|
||||
Layout.maximumWidth: eventContent.maxMessageWidth
|
||||
Layout.fillWidth: true
|
||||
|
||||
onSelectedTextChanged: if (selectedText) {
|
||||
onSelectedTextChanged: if (selectedPlainText) {
|
||||
eventList.delegateWithSelectedText = model.id
|
||||
eventList.selectedText = selectedText
|
||||
eventList.selectedText = selectedPlainText
|
||||
} else if (eventList.delegateWithSelectedText === model.id) {
|
||||
eventList.delegateWithSelectedText = ""
|
||||
eventList.selectedText = ""
|
||||
@@ -274,7 +274,7 @@ HRowLayout {
|
||||
radius: theme.chat.message.radius
|
||||
z: -100
|
||||
color: eventDelegate.checked &&
|
||||
! contentLabel.selectedText &&
|
||||
! contentLabel.selectedPlainText &&
|
||||
! mousePointHandler.active &&
|
||||
! mouseShiftPointHandler.active ?
|
||||
theme.chat.message.checkedBackground :
|
||||
|
Reference in New Issue
Block a user