diff --git a/ui/qml/OutlineView.qml b/ui/qml/OutlineView.qml index 6231374..ca5a43e 100644 --- a/ui/qml/OutlineView.qml +++ b/ui/qml/OutlineView.qml @@ -1306,42 +1306,55 @@ ListView { del.editingBody = false } - ScrollView { + // Bordered scroll frame holding the editor. Uses the + // Flickable + TextArea.flickable idiom (not ScrollView), + // which the Breeze style accepts; a custom background on a + // styled TextArea trips Breeze's TextArea internals. + Rectangle { Layout.fillWidth: true Layout.preferredHeight: Math.min( Math.max(bodyEditor.contentHeight + 16, outline.baseFontSize * 6), outline.baseFontSize * 20) - clip: true + color: theme.baseColor + border.color: theme.midColor + border.width: 1 + radius: 3 - TextArea { - id: bodyEditor - wrapMode: TextArea.Wrap - font.family: "monospace" - font.pointSize: outline.baseFontSize - selectByMouse: true - background: Rectangle { - color: theme.baseColor - border.color: theme.midColor - border.width: 1 - radius: 3 - } - // Seed from the raw body when the editor opens. - onVisibleChanged: { - if (visible) { - text = docModel.bodyText(del.index) - forceActiveFocus() - cursorPosition = text.length + Flickable { + id: bodyFlick + anchors.fill: parent + anchors.margins: 4 + clip: true + contentWidth: width + contentHeight: bodyEditor.contentHeight + boundsBehavior: Flickable.StopAtBounds + ScrollBar.vertical: ScrollBar {} + + TextArea.flickable: TextArea { + id: bodyEditor + wrapMode: TextArea.Wrap + font.family: "monospace" + font.pointSize: outline.baseFontSize + selectByMouse: true + background: null + // Seed from the raw body when the editor opens. + onVisibleChanged: { + if (visible) { + text = docModel.bodyText(del.index) + forceActiveFocus() + cursorPosition = text.length + } } - } - // Ctrl+Enter saves; Escape cancels. - Keys.onPressed: (ev) => { - if ((ev.key === Qt.Key_Return || ev.key === Qt.Key_Enter) - && (ev.modifiers & Qt.ControlModifier)) { - bodyEditColumn.saveBody() - ev.accepted = true - } else if (ev.key === Qt.Key_Escape) { - del.editingBody = false - ev.accepted = true + // Ctrl+Enter saves; Escape cancels. + Keys.onPressed: (ev) => { + if ((ev.key === Qt.Key_Return || ev.key === Qt.Key_Enter) + && (ev.modifiers & Qt.ControlModifier)) { + bodyEditColumn.saveBody() + ev.accepted = true + } else if (ev.key === Qt.Key_Escape) { + del.editingBody = false + ev.accepted = true + } } } }