mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-07 19:59:14 -04:00
fix(Notifications): restore long message content from overflowing
- Addtional security escape patch - Tweak Notification Center width
This commit is contained in:
@@ -1721,11 +1721,15 @@ Item {
|
|||||||
return "";
|
return "";
|
||||||
var idx = text.toLowerCase().indexOf(lowerQuery);
|
var idx = text.toLowerCase().indexOf(lowerQuery);
|
||||||
if (idx === -1)
|
if (idx === -1)
|
||||||
return text;
|
return _escapeRichText(text);
|
||||||
var before = text.substring(0, idx);
|
var before = text.substring(0, idx);
|
||||||
var match = text.substring(idx, idx + queryLen);
|
var match = text.substring(idx, idx + queryLen);
|
||||||
var after = text.substring(idx + queryLen);
|
var after = text.substring(idx + queryLen);
|
||||||
return '<span style="color:' + baseColor + '">' + before + '</span><span style="color:' + highlightColor + '; font-weight:600">' + match + '</span><span style="color:' + baseColor + '">' + after + '</span>';
|
return '<span style="color:' + baseColor + '">' + _escapeRichText(before) + '</span><span style="color:' + highlightColor + '; font-weight:600">' + _escapeRichText(match) + '</span><span style="color:' + baseColor + '">' + _escapeRichText(after) + '</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function _escapeRichText(text) {
|
||||||
|
return String(text).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCurrentSectionViewMode() {
|
function getCurrentSectionViewMode() {
|
||||||
|
|||||||
@@ -99,8 +99,9 @@ Rectangle {
|
|||||||
id: contentItem
|
id: contentItem
|
||||||
|
|
||||||
readonly property real expandedTextHeight: descriptionText.contentHeight
|
readonly property real expandedTextHeight: descriptionText.contentHeight
|
||||||
readonly property real twoLineHeight: descriptionText.font.pixelSize * 1.2 * 2
|
readonly property real collapsedLineCount: compactMode ? 1 : 2
|
||||||
readonly property real extraHeight: (descriptionExpanded && expandedTextHeight > twoLineHeight + 2) ? (expandedTextHeight - twoLineHeight) : 0
|
readonly property real collapsedLineHeight: descriptionText.font.pixelSize * 1.2 * collapsedLineCount
|
||||||
|
readonly property real extraHeight: (descriptionExpanded && expandedTextHeight > collapsedLineHeight + 2) ? (expandedTextHeight - collapsedLineHeight) : 0
|
||||||
|
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
@@ -229,7 +230,7 @@ Rectangle {
|
|||||||
property bool hasMoreText: truncated
|
property bool hasMoreText: truncated
|
||||||
|
|
||||||
text: historyItem.htmlBody || historyItem.body || ""
|
text: historyItem.htmlBody || historyItem.body || ""
|
||||||
textFormat: Text.RichText
|
textFormat: Text.StyledText
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|||||||
@@ -395,7 +395,7 @@ Rectangle {
|
|||||||
property bool hasMoreText: truncated
|
property bool hasMoreText: truncated
|
||||||
|
|
||||||
text: fullText
|
text: fullText
|
||||||
textFormat: Text.RichText
|
textFormat: Text.StyledText
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@@ -561,9 +561,9 @@ Rectangle {
|
|||||||
height: {
|
height: {
|
||||||
if (!messageExpanded)
|
if (!messageExpanded)
|
||||||
return expandedBaseHeight;
|
return expandedBaseHeight;
|
||||||
const twoLineHeight = bodyText.font.pixelSize * 1.2 * 2;
|
const collapsedBodyHeight = bodyText.collapsedLineHeight;
|
||||||
if (bodyText.implicitHeight > twoLineHeight + 2)
|
if (bodyText.implicitHeight > collapsedBodyHeight + 2)
|
||||||
return expandedBaseHeight + bodyText.implicitHeight - twoLineHeight;
|
return expandedBaseHeight + bodyText.implicitHeight - collapsedBodyHeight;
|
||||||
return expandedBaseHeight;
|
return expandedBaseHeight;
|
||||||
}
|
}
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
@@ -703,15 +703,17 @@ Rectangle {
|
|||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
id: bodyText
|
id: bodyText
|
||||||
|
readonly property real collapsedLineCount: compactMode ? 1 : 2
|
||||||
|
readonly property real collapsedLineHeight: font.pixelSize * 1.2 * collapsedLineCount
|
||||||
property bool hasMoreText: truncated
|
property bool hasMoreText: truncated
|
||||||
|
|
||||||
text: modelData?.htmlBody || ""
|
text: modelData?.htmlBody || ""
|
||||||
textFormat: Text.RichText
|
textFormat: Text.StyledText
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
width: parent.width
|
width: parent.width
|
||||||
elide: messageExpanded ? Text.ElideNone : Text.ElideRight
|
elide: messageExpanded ? Text.ElideNone : Text.ElideRight
|
||||||
maximumLineCount: messageExpanded ? -1 : 2
|
maximumLineCount: messageExpanded ? -1 : collapsedLineCount
|
||||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
visible: text.length > 0
|
visible: text.length > 0
|
||||||
linkColor: Theme.primary
|
linkColor: Theme.primary
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ DankPopout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
popupWidth: 400
|
popupWidth: 400 + Theme.spacingL
|
||||||
popupHeight: stablePopupHeight
|
popupHeight: stablePopupHeight
|
||||||
positioning: ""
|
positioning: ""
|
||||||
suspendShadowWhileResizing: false
|
suspendShadowWhileResizing: false
|
||||||
|
|||||||
@@ -755,7 +755,7 @@ PanelWindow {
|
|||||||
visible: false
|
visible: false
|
||||||
width: Math.max(0, backgroundContainer.width - Theme.spacingL - (Theme.spacingL + Theme.notificationHoverRevealMargin) - popupIconSize - Theme.spacingM)
|
width: Math.max(0, backgroundContainer.width - Theme.spacingL - (Theme.spacingL + Theme.notificationHoverRevealMargin) - popupIconSize - Theme.spacingM)
|
||||||
text: notificationData ? (notificationData.htmlBody || "") : ""
|
text: notificationData ? (notificationData.htmlBody || "") : ""
|
||||||
textFormat: Text.RichText
|
textFormat: Text.StyledText
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
elide: Text.ElideNone
|
elide: Text.ElideNone
|
||||||
horizontalAlignment: Text.AlignLeft
|
horizontalAlignment: Text.AlignLeft
|
||||||
@@ -913,7 +913,7 @@ PanelWindow {
|
|||||||
property bool hasMoreText: truncated
|
property bool hasMoreText: truncated
|
||||||
|
|
||||||
text: notificationData ? (notificationData.htmlBody || "") : ""
|
text: notificationData ? (notificationData.htmlBody || "") : ""
|
||||||
textFormat: Text.RichText
|
textFormat: Text.StyledText
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|||||||
Reference in New Issue
Block a user