diff --git a/qml/panels/EditorPane.qml b/qml/panels/EditorPane.qml index a12dc65..61c6297 100644 --- a/qml/panels/EditorPane.qml +++ b/qml/panels/EditorPane.qml @@ -149,14 +149,45 @@ Item { 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 { id: headerBar anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right height: 30 - color: "whitesmoke" + z: 10 + color: "#f0f0f0" + border.color: "#ddd" RowLayout { 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() { if (pane.docIndex >= 0) { const c = documentManager.contentAt(pane.docIndex)