794 B · text History 35c3541
import QtQuick
import org.kde.plasma.components as PlasmaComponents3
import org.kde.kirigami as Kirigami

import "../Grafana.js" as G

// Text: the panel's markdown (or HTML), with dashboard variables filled in.
PlasmaComponents3.ScrollView {
    id: textPanel

    property var frame: null
    readonly property var options: frame ? (frame.panel.options || {}) : ({})

    contentWidth: availableWidth

    PlasmaComponents3.Label {
        width: textPanel.availableWidth
        wrapMode: Text.WordWrap
        textFormat: textPanel.options.mode === "html" ? Text.RichText : Text.MarkdownText
        text: textPanel.frame ? G.interpolate(textPanel.options.content || "", textPanel.frame.vars || {}, false) : ""
        onLinkActivated: function(link) { Qt.openUrlExternally(link) }
    }
}