Fix: TextArea заполняет ВЕСЬ EditorPane (anchors.fill: parent), шапка файла — плавающий оверлей (z:10) сверху; убран debug-label; убраны orphan-элементы

This commit is contained in:
Flora (opencode)
2026-08-17 19:13:10 +03:00
parent 4bbbf64999
commit a1c78cf5e3
+34 -41
View File
@@ -149,14 +149,45 @@ Item {
replaceRange(s, e, out.join("\n")) replaceRange(s, e, out.join("\n"))
} }
// ---------- Шапка (сверху) ---------- // ---------- TextArea (заполняет ВСЁ пространство) ----------
TextArea {
id: editor
anchors.fill: parent
visible: pane.editMode
color: "black"
onTextEdited: documentManager.updateContent(pane.docIndex, text)
selectByMouse: true
font.family: "Menlo, Consolas, 'DejaVu Sans Mono', monospace"
font.pixelSize: 14
wrapMode: TextEdit.NoWrap
padding: 10
placeholderText: qsTr("Документ не выбран")
}
TextArea {
id: viewer
anchors.fill: parent
visible: !pane.editMode
textFormat: TextEdit.RichText
text: ""
readOnly: true
selectByMouse: true
wrapMode: TextEdit.Wrap
padding: 12
onLinkActivated: (href) => pane.handleViewLink(href)
placeholderText: qsTr("Документ не выбран")
}
// ---------- Шапка файла (плавающий оверлей сверху) ----------
Rectangle { Rectangle {
id: headerBar id: headerBar
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
height: 30 height: 30
color: "whitesmoke" z: 10
color: "#f0f0f0"
border.color: "#ddd"
RowLayout { RowLayout {
anchors.fill: parent anchors.fill: parent
@@ -209,45 +240,7 @@ Item {
} }
} }
// ---------- Область контента (под шапкой, заполняет остаток) ---------- // ---------- Функции ----------
Rectangle {
id: contentArea
anchors.top: headerBar.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
color: "white"
TextArea {
id: editor
anchors.fill: parent
visible: pane.editMode
color: "black"
onTextEdited: documentManager.updateContent(pane.docIndex, text)
selectByMouse: true
font.family: "Menlo, Consolas, 'DejaVu Sans Mono', monospace"
font.pixelSize: 14
wrapMode: TextEdit.NoWrap
padding: 10
placeholderText: qsTr("Документ не выбран")
}
TextArea {
id: viewer
anchors.fill: parent
visible: !pane.editMode
textFormat: TextEdit.RichText
text: ""
readOnly: true
selectByMouse: true
wrapMode: TextEdit.Wrap
padding: 12
onLinkActivated: (href) => pane.handleViewLink(href)
placeholderText: qsTr("Документ не выбран")
}
}
// ---------- Просмотр (режим просмотра) ----------
function loadContent() { function loadContent() {
if (pane.docIndex >= 0) { if (pane.docIndex >= 0) {
const c = documentManager.contentAt(pane.docIndex) const c = documentManager.contentAt(pane.docIndex)