Fix: серая панель ВНИЗУ (anchors.bottom), без названия файла; clip:true на TextEdit (текст не вылезает за пределы); anchors.bottomMargin:32 для отступа от панели

This commit is contained in:
Flora (opencode)
2026-08-18 00:17:12 +03:00
parent 15813d358e
commit c8a9bc4690
+65 -73
View File
@@ -17,57 +17,41 @@ Item {
textDisplay.insert(textDisplay.cursorPosition, t) textDisplay.insert(textDisplay.cursorPosition, t)
} }
// Шапка файла — плавающий оверлей function refresh() {
Rectangle { const idx = pane.docIndex
anchors.top: parent.top if (idx >= 0) {
anchors.left: parent.left const c = documentManager.contentAt(idx)
anchors.right: parent.right textDisplay.text = c
height: 30 } else {
z: 10 textDisplay.text = ""
color: "#f0f0f0"
border.color: "#ddd"
RowLayout {
anchors.fill: parent
anchors.leftMargin: 8
anchors.rightMargin: 4
spacing: 6
Label {
Layout.fillWidth: true
elide: Text.ElideMiddle
color: "#444"
text: documentManager.titleAt(pane.docIndex)
}
ToolButton {
text: "✎"
checkable: true
checked: pane.editMode
onClicked: pane.editMode = true
}
ToolButton {
text: "👁"
checkable: true
checked: !pane.editMode
onClicked: pane.editMode = false
}
ToolButton {
text: "\u2715"
visible: pane.closable
onClicked: pane.closePane()
}
} }
} }
// Текст файла — TextEdit напрямую function filePathDir(p) {
const i = p.lastIndexOf("/")
return i >= 0 ? p.substring(0, i) : p
}
onDocIndexChanged: refresh()
onEditModeChanged: refresh()
Connections {
target: documentManager
function onActiveIndexChanged() {
if (documentManager.activeIndex === pane.docIndex)
refresh()
}
}
Component.onCompleted: refresh()
// --- Текстовый редактор (сверху до низу, без шапки) ---
TextEdit { TextEdit {
id: textDisplay id: textDisplay
anchors.top: headerBar.bottom anchors.fill: parent
anchors.left: parent.left anchors.bottomMargin: 32
anchors.right: parent.right
anchors.bottom: parent.bottom
visible: pane.editMode visible: pane.editMode
clip: true
text: documentManager.activeIndex >= 0 text: documentManager.activeIndex >= 0
? documentManager.contentAt(documentManager.activeIndex) ? documentManager.contentAt(documentManager.activeIndex)
: "" : ""
@@ -79,15 +63,14 @@ Item {
onTextEdited: documentManager.updateContent(pane.docIndex, text) onTextEdited: documentManager.updateContent(pane.docIndex, text)
} }
// Режим просмотра (read-only) // --- Режим просмотра ---
TextEdit { TextEdit {
id: viewDisplay id: viewDisplay
anchors.top: headerBar.bottom anchors.fill: parent
anchors.left: parent.left anchors.bottomMargin: 32
anchors.right: parent.right
anchors.bottom: parent.bottom
visible: !pane.editMode visible: !pane.editMode
readOnly: true readOnly: true
clip: true
text: pane.editMode ? "" : mdParser.render( text: pane.editMode ? "" : mdParser.render(
documentManager.contentAt(pane.docIndex), documentManager.contentAt(pane.docIndex),
fileStore.vault, fileStore.vault,
@@ -117,32 +100,41 @@ Item {
} }
} }
// Загрузка контента при смене файла // --- Серая панель ВНИЗУ: кнопки ✎👁 × ---
function refresh() { Rectangle {
const idx = pane.docIndex id: toolbar
if (idx >= 0) { anchors.bottom: parent.bottom
const c = documentManager.contentAt(idx) anchors.left: parent.left
textDisplay.text = c anchors.right: parent.right
} else { height: 32
textDisplay.text = "" z: 10
} color: "#e0e0e0"
} border.color: "#ccc"
function filePathDir(p) { RowLayout {
const i = p.lastIndexOf("/") anchors.fill: parent
return i >= 0 ? p.substring(0, i) : p anchors.rightMargin: 4
} spacing: 4
onDocIndexChanged: refresh() Item { Layout.fillWidth: true }
onEditModeChanged: { refresh() }
Connections { ToolButton {
target: documentManager text: "✎"
function onActiveIndexChanged() { checkable: true
if (documentManager.activeIndex === pane.docIndex) checked: pane.editMode
refresh() onClicked: pane.editMode = true
}
ToolButton {
text: "👁"
checkable: true
checked: !pane.editMode
onClicked: pane.editMode = false
}
ToolButton {
text: "\u2715"
visible: pane.closable
onClicked: pane.closePane()
}
} }
} }
Component.onCompleted: refresh()
} }