From 4bbbf64999ecabd32e96b85554dedbb3819a2757 Mon Sep 17 00:00:00 2001 From: "Flora (opencode)" Date: Mon, 17 Aug 2026 18:53:08 +0300 Subject: [PATCH] =?UTF-8?q?Fix:=20EditorPane=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=BF=D0=B8=D1=81=D0=B0=D0=BD=20=D0=BD=D0=B0=20anchors=20(head?= =?UTF-8?q?erBar=20=D1=81=D0=B2=D0=B5=D1=80=D1=85=D1=83,=20contentArea=20?= =?UTF-8?q?=D1=81=D0=BD=D0=B8=D0=B7=D1=83);=20=D1=83=D0=B1=D1=80=D0=B0?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BB=D0=B8=D1=88=D0=BD=D1=8F=D1=8F=20}=20?= =?UTF-8?q?=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=20contentArea;=20ColumnLayout=20?= =?UTF-8?q?=D0=B1=D0=BE=D0=BB=D1=8C=D1=88=D0=B5=20=D0=BD=D0=B5=20=D0=B8?= =?UTF-8?q?=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D1=83=D0=B5=D1=82=D1=81?= =?UTF-8?q?=D1=8F=20=D0=B2=20EditorPane/EditorPanel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qml/panels/EditorPane.qml | 167 +++++++++++++++++--------------------- 1 file changed, 75 insertions(+), 92 deletions(-) diff --git a/qml/panels/EditorPane.qml b/qml/panels/EditorPane.qml index f48283e..a12dc65 100644 --- a/qml/panels/EditorPane.qml +++ b/qml/panels/EditorPane.qml @@ -149,104 +149,88 @@ Item { replaceRange(s, e, out.join("\n")) } - ColumnLayout { - anchors.fill: parent - spacing: 0 + // ---------- Шапка (сверху) ---------- + Rectangle { + id: headerBar + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + height: 30 + color: "whitesmoke" - Rectangle { - Layout.fillWidth: true - implicitHeight: 30 - color: "whitesmoke" + RowLayout { + anchors.fill: parent + anchors.leftMargin: 8 + anchors.rightMargin: 4 + spacing: 6 - RowLayout { - anchors.fill: parent - anchors.leftMargin: 8 - anchors.rightMargin: 4 - spacing: 6 + Label { + id: headerTitle + Layout.fillWidth: true + elide: Text.ElideMiddle + color: "#444" + text: "" + } - Label { - id: headerTitle - Layout.fillWidth: true - elide: Text.ElideMiddle - color: "#444" - text: "" - } - - // Переключатель режимов - ToolButton { - text: "✎" - checkable: true - checked: pane.editMode - ToolTip.visible: hovered - ToolTip.text: qsTr("Режим редактирования (Ctrl+E)") - onClicked: { pane.editMode = true; editBtn.checked = true; viewBtn.checked = false } - } - ToolButton { - id: viewBtn - text: "👁" - checkable: true - checked: !pane.editMode - ToolTip.visible: hovered - ToolTip.text: qsTr("Режим просмотра (Ctrl+E)") - onClicked: { pane.editMode = false; editBtn.checked = false; viewBtn.checked = true } - } - - ToolButton { - id: editBtn - visible: false - checkable: true - checked: true - onClicked: { pane.editMode = true; viewBtn.checked = false } - } - - ToolButton { - text: "\u25B8\u25CB\u25C0" // «открыть рядом» (две панели) - visible: pane.canOpenBeside && !documentManager.sideBySide - ToolTip.visible: hovered - ToolTip.text: qsTr("Открыть рядом (две панели)") - onClicked: pane.openBeside() - } - - ToolButton { - text: "\u2715" - visible: pane.closable - ToolTip.visible: hovered - ToolTip.text: qsTr("Закрыть вторую панель") - onClicked: pane.closePane() - } + ToolButton { + text: "✎" + checkable: true + checked: pane.editMode + ToolTip.text: qsTr("Редактирование") + onClicked: { pane.editMode = true; editBtn.checked = true; viewBtn.checked = false } + } + ToolButton { + id: viewBtn + text: "👁" + checkable: true + checked: !pane.editMode + ToolTip.text: qsTr("Просмотр") + onClicked: { pane.editMode = false; editBtn.checked = false; viewBtn.checked = true } + } + ToolButton { + id: editBtn + visible: false + checkable: true + checked: true + onClicked: { pane.editMode = true; viewBtn.checked = false } + } + ToolButton { + text: "\u25B8\u25CB\u25C0" + visible: pane.canOpenBeside && !documentManager.sideBySide + ToolTip.text: qsTr("Открыть рядом") + onClicked: pane.openBeside() + } + ToolButton { + text: "\u2715" + visible: pane.closable + ToolTip.text: qsTr("Закрыть панель") + onClicked: pane.closePane() } } + } - Rectangle { - Layout.fillWidth: true - Layout.fillHeight: true - color: "white" + // ---------- Область контента (под шапкой, заполняет остаток) ---------- + 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("Документ не выбран") - } - - // Отладочный индикатор (временно) - Label { - visible: true - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.margins: 4 - font.pixelSize: 10 - color: "#999" - text: "docIndex=" + pane.docIndex + " editMode=" + pane.editMode - + " contentLen=" + editor.text.length - } + 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 @@ -262,7 +246,6 @@ Item { placeholderText: qsTr("Документ не выбран") } } - } // ---------- Просмотр (режим просмотра) ---------- function loadContent() {