clipboard preview with syntax support
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 10s
Python / lint-format (pull_request) Successful in 16s
Python / test (pull_request) Successful in 28s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m6s

This commit is contained in:
2026-06-13 20:11:58 +02:00
parent 7756e46355
commit 6034c4816d
5 changed files with 137 additions and 7 deletions
+16 -6
View File
@@ -16,7 +16,7 @@ Item {
required property PersistentProperties visibilities
implicitHeight: search.implicitHeight + entries.anchors.topMargin + ((view.spacing + itemHeight) * Config.clipboard.maxEntriesShown) - view.spacing
implicitWidth: Config.clipboard.sizes.width + 500
implicitWidth: Config.clipboard.sizes.width + preview.width + preview.anchors.leftMargin
Component.onCompleted: {
if (ClipHistory.entries.length === 0)
@@ -69,23 +69,33 @@ Item {
anchors.bottom: parent.bottom
anchors.left: entries.right
anchors.leftMargin: Appearance.spacing.normal
anchors.right: parent.right
anchors.top: parent.top
color: DynamicColors.tPalette.m3surfaceContainer
implicitWidth: ClipHistory.previewIsImage ? Math.max(Math.min(imagePreview.sourceSize.width + imagePreview.anchors.margins * 2, Config.clipboard.sizes.previewWidth), Config.clipboard.sizes.minPreviewWidth) : Math.max(Math.min(textPreview.paintedWidth + textPreview.anchors.margins * 2, Config.clipboard.sizes.previewWidth), Config.clipboard.sizes.minPreviewWidth)
radius: 25
Behavior on implicitWidth {
Anim {
}
}
CustomText {
id: textPreview
anchors.left: parent.left
anchors.margins: Appearance.padding.large
anchors.top: parent.top
text: ClipHistory.previewText
textFormat: Text.PlainText
font.family: ClipHistory.previewIsCode ? Appearance.font.family.mono : Appearance.font.family.sans
text: ClipHistory.previewMarkup
textFormat: ClipHistory.previewIsCode ? Text.RichText : Text.PlainText
visible: !ClipHistory.previewIsImage
width: preview.width - Appearance.padding.large * 2
width: Config.clipboard.sizes.previewWidth - anchors.margins * 2
wrapMode: Text.Wrap
}
Image {
id: imagePreview
anchors.fill: parent
anchors.margins: Appearance.padding.large
asynchronous: true
@@ -95,7 +105,7 @@ Item {
retainWhileLoading: true
smooth: true
source: ClipHistory.previewImageSource
visible: ClipHistory.previewIsImage
visible: ClipHistory.previewIsImage && ClipHistory.previewImageSource !== ""
}
}
+1 -1
View File
@@ -25,7 +25,7 @@ Item {
CustomClippingWrapperRect {
anchors.fill: parent
child: flickable.contentItem
child: flickable
radius: Appearance.rounding.normal - Appearance.padding.extraSmall
}