diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-09-13 11:01:42 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-09-13 11:01:42 +0200 |
commit | 8edb362d96ed740cf5f387649d760c17c7c17d31 (patch) | |
tree | 5b7eac591419d848be483b50854fded3091fb532 /framework/qml/TextEditor.qml | |
parent | e87ecb949e77211eb21e30a97a65426f87231414 (diff) | |
download | kube-8edb362d96ed740cf5f387649d760c17c7c17d31.tar.gz kube-8edb362d96ed740cf5f387649d760c17c7c17d31.zip |
Keep TextEditor as our html editor
Diffstat (limited to 'framework/qml/TextEditor.qml')
-rw-r--r-- | framework/qml/TextEditor.qml | 30 |
1 files changed, 29 insertions, 1 deletions
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 | |||
23 | import org.kube.framework 1.0 as Kube | 23 | import org.kube.framework 1.0 as Kube |
24 | 24 | ||
25 | FocusScope { | 25 | FocusScope { |
26 | property alias text: edit.text | 26 | id: root |
27 | property string text: "" | ||
28 | |||
29 | property bool htmlEnabled: false | ||
30 | |||
31 | property alias bold: document.bold | ||
32 | property alias italic: document.italic | ||
33 | property alias underline: document.underline | ||
34 | |||
35 | property string initialText | ||
36 | onInitialTextChanged: { | ||
37 | if (text == "") { | ||
38 | edit.text = initialText | ||
39 | } | ||
40 | } | ||
41 | |||
42 | Kube.DocumentHandler { | ||
43 | id: document | ||
44 | document: edit.textDocument | ||
45 | cursorPosition: edit.cursorPosition | ||
46 | selectionStart: edit.selectionStart | ||
47 | selectionEnd: edit.selectionEnd | ||
48 | //textColor: colorDialog.color | ||
49 | onTextChanged: root.text = text | ||
50 | } | ||
51 | |||
27 | Kube.ScrollHelper { | 52 | Kube.ScrollHelper { |
28 | anchors.fill: parent | 53 | anchors.fill: parent |
29 | flickable: flickableItem | 54 | flickable: flickableItem |
@@ -37,7 +62,10 @@ FocusScope { | |||
37 | focus: true | 62 | focus: true |
38 | anchors.fill: parent | 63 | anchors.fill: parent |
39 | selectByMouse: true | 64 | selectByMouse: true |
65 | persistentSelection: true | ||
40 | wrapMode: TextEdit.Wrap | 66 | wrapMode: TextEdit.Wrap |
67 | textFormat: Qt.RichText | ||
68 | cursorPosition: document.cursorPosition | ||
41 | } | 69 | } |
42 | TextArea.flickable: edit | 70 | TextArea.flickable: edit |
43 | } | 71 | } |