From 8edb362d96ed740cf5f387649d760c17c7c17d31 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 13 Sep 2017 11:01:42 +0200 Subject: Keep TextEditor as our html editor --- framework/qml/TextEditor.qml | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'framework/qml') diff --git a/framework/qml/TextEditor.qml b/framework/qml/TextEditor.qml index 5f29cef3..047c9b77 100644 --- a/framework/qml/TextEditor.qml +++ b/framework/qml/TextEditor.qml @@ -23,7 +23,32 @@ import QtQuick.Controls 2.2 import org.kube.framework 1.0 as Kube FocusScope { - property alias text: edit.text + id: root + property string text: "" + + property bool htmlEnabled: false + + property alias bold: document.bold + property alias italic: document.italic + property alias underline: document.underline + + property string initialText + onInitialTextChanged: { + if (text == "") { + edit.text = initialText + } + } + + Kube.DocumentHandler { + id: document + document: edit.textDocument + cursorPosition: edit.cursorPosition + selectionStart: edit.selectionStart + selectionEnd: edit.selectionEnd + //textColor: colorDialog.color + onTextChanged: root.text = text + } + Kube.ScrollHelper { anchors.fill: parent flickable: flickableItem @@ -37,7 +62,10 @@ FocusScope { focus: true anchors.fill: parent selectByMouse: true + persistentSelection: true wrapMode: TextEdit.Wrap + textFormat: Qt.RichText + cursorPosition: document.cursorPosition } TextArea.flickable: edit } -- cgit v1.2.3