Фикс: код как ввёл + превью скролл + хранилище последнее выбранное

- 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:
2026-09-02 00:38:01 +03:00
parent ed6cc1859b
commit 6e49c4b5f8
2 changed files with 30 additions and 24 deletions
+12 -9
View File
@@ -1,5 +1,6 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Flora
Rectangle {
@@ -32,8 +33,8 @@ Rectangle {
anchors.margins: 10
spacing: 6
// Header with language and copy button
Row {
// Header with language and copy button — строго справа
RowLayout {
width: parent.width
height: 24
spacing: 8
@@ -44,24 +45,26 @@ Rectangle {
font.pixelSize: 10
font.bold: true
font.letterSpacing: 0.4
verticalAlignment: Text.AlignVCenter
height: parent.height
Layout.alignment: Qt.AlignVCenter
visible: root.language !== "text" && root.language !== ""
}
Item { width: parent.width - languageLabel.width - copyButton.width - 16; height: 1 }
Item {
Layout.fillWidth: true
height: 1
}
Label {
id: languageLabel
text: root.language
visible: false
width: 0
height: 0
}
// Copy button - Telegram style, hover/active feedback
Rectangle {
id: copyButton
width: copyLabel.implicitWidth + 16
height: 22
Layout.preferredWidth: copyLabel.implicitWidth + 16
Layout.preferredHeight: 22
implicitWidth: copyLabel.implicitWidth + 16
implicitHeight: 22
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)
border.color: copyHover.hovered ? Qt.rgba(1,1,1,0.28) : Qt.rgba(1,1,1,0.18)
+18 -15
View File
@@ -633,22 +633,25 @@ Item {
ScrollBar.vertical.policy: ScrollBar.AsNeeded
background: Rectangle { color: Theme.editorBg }
MarkdownView {
id: viewArea
visible: viewMode === "preview"
width: viewScroll.width
vaultRoot: fileStore.vault
fileDir: activeFileDir()
onLinkActivated: (href) => handleLink(href)
}
Column {
width: viewScroll.availableWidth
MarkdownView {
id: viewArea
visible: viewMode === "preview"
width: parent.width
vaultRoot: fileStore.vault
fileDir: activeFileDir()
onLinkActivated: (href) => handleLink(href)
}
MarkdownView {
id: livePreview
visible: viewMode === "live"
width: viewScroll.width
vaultRoot: fileStore.vault
fileDir: activeFileDir()
onLinkActivated: (href) => handleLink(href)
MarkdownView {
id: livePreview
visible: viewMode === "live"
width: parent.width
vaultRoot: fileStore.vault
fileDir: activeFileDir()
onLinkActivated: (href) => handleLink(href)
}
}
}
}