Фикс: код как ввёл + превью скролл + хранилище последнее выбранное
- CodeBlock: RowLayout для header (copy строго справа), MarkdownView в Column внутри ScrollView (availableWidth) — превью теперь скроллится, показывает все строки, код как ввёл (pre-wrap, tab 4) - Vault: selectVault при выборе в переключателе + windowOpened -> setCurrentVault — запуск с последним выбранным, проверено на /Users/alex/Nextcloud/test и test-vault
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
import Flora
|
import Flora
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@@ -32,8 +33,8 @@ Rectangle {
|
|||||||
anchors.margins: 10
|
anchors.margins: 10
|
||||||
spacing: 6
|
spacing: 6
|
||||||
|
|
||||||
// Header with language and copy button
|
// Header with language and copy button — строго справа
|
||||||
Row {
|
RowLayout {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 24
|
height: 24
|
||||||
spacing: 8
|
spacing: 8
|
||||||
@@ -44,24 +45,26 @@ Rectangle {
|
|||||||
font.pixelSize: 10
|
font.pixelSize: 10
|
||||||
font.bold: true
|
font.bold: true
|
||||||
font.letterSpacing: 0.4
|
font.letterSpacing: 0.4
|
||||||
verticalAlignment: Text.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
height: parent.height
|
|
||||||
visible: root.language !== "text" && root.language !== ""
|
visible: root.language !== "text" && root.language !== ""
|
||||||
}
|
}
|
||||||
Item { width: parent.width - languageLabel.width - copyButton.width - 16; height: 1 }
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 1
|
||||||
|
}
|
||||||
Label {
|
Label {
|
||||||
id: languageLabel
|
id: languageLabel
|
||||||
text: root.language
|
text: root.language
|
||||||
visible: false
|
visible: false
|
||||||
width: 0
|
|
||||||
height: 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy button - Telegram style, hover/active feedback
|
// Copy button - Telegram style, hover/active feedback
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: copyButton
|
id: copyButton
|
||||||
width: copyLabel.implicitWidth + 16
|
Layout.preferredWidth: copyLabel.implicitWidth + 16
|
||||||
height: 22
|
Layout.preferredHeight: 22
|
||||||
|
implicitWidth: copyLabel.implicitWidth + 16
|
||||||
|
implicitHeight: 22
|
||||||
radius: 11
|
radius: 11
|
||||||
color: copyHover.hovered ? (copyTap.pressed ? Qt.rgba(1,1,1,0.30) : Qt.rgba(1,1,1,0.22)) : Qt.rgba(1,1,1,0.12)
|
color: copyHover.hovered ? (copyTap.pressed ? Qt.rgba(1,1,1,0.30) : Qt.rgba(1,1,1,0.22)) : Qt.rgba(1,1,1,0.12)
|
||||||
border.color: copyHover.hovered ? Qt.rgba(1,1,1,0.28) : Qt.rgba(1,1,1,0.18)
|
border.color: copyHover.hovered ? Qt.rgba(1,1,1,0.28) : Qt.rgba(1,1,1,0.18)
|
||||||
|
|||||||
@@ -633,10 +633,12 @@ Item {
|
|||||||
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
||||||
background: Rectangle { color: Theme.editorBg }
|
background: Rectangle { color: Theme.editorBg }
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: viewScroll.availableWidth
|
||||||
MarkdownView {
|
MarkdownView {
|
||||||
id: viewArea
|
id: viewArea
|
||||||
visible: viewMode === "preview"
|
visible: viewMode === "preview"
|
||||||
width: viewScroll.width
|
width: parent.width
|
||||||
vaultRoot: fileStore.vault
|
vaultRoot: fileStore.vault
|
||||||
fileDir: activeFileDir()
|
fileDir: activeFileDir()
|
||||||
onLinkActivated: (href) => handleLink(href)
|
onLinkActivated: (href) => handleLink(href)
|
||||||
@@ -645,13 +647,14 @@ Item {
|
|||||||
MarkdownView {
|
MarkdownView {
|
||||||
id: livePreview
|
id: livePreview
|
||||||
visible: viewMode === "live"
|
visible: viewMode === "live"
|
||||||
width: viewScroll.width
|
width: parent.width
|
||||||
vaultRoot: fileStore.vault
|
vaultRoot: fileStore.vault
|
||||||
fileDir: activeFileDir()
|
fileDir: activeFileDir()
|
||||||
onLinkActivated: (href) => handleLink(href)
|
onLinkActivated: (href) => handleLink(href)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function handleLink(href) {
|
function handleLink(href) {
|
||||||
if (href.startsWith("flora://copycode/")) {
|
if (href.startsWith("flora://copycode/")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user