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 --- components/kube/contents/ui/ComposerView.qml | 41 ++++++++++++---------------- 1 file changed, 17 insertions(+), 24 deletions(-) (limited to 'components') diff --git a/components/kube/contents/ui/ComposerView.qml b/components/kube/contents/ui/ComposerView.qml index 1571a746..29858767 100644 --- a/components/kube/contents/ui/ComposerView.qml +++ b/components/kube/contents/ui/ComposerView.qml @@ -287,24 +287,24 @@ Kube.View { Kube.IconButton { iconName: Kube.Icons.bold checkable: true - checked: document.bold - onClicked: document.bold = !document.bold + checked: textEditor.bold + onClicked: textEditor.bold = !textEditor.bold focusPolicy: Qt.TabFocus focus: false } Kube.IconButton { iconName: Kube.Icons.italic checkable: true - checked: document.italic - onClicked: document.italic = !document.italic + checked: textEditor.italic + onClicked: textEditor.italic = !textEditor.italic focusPolicy: Qt.TabFocus focus: false } Kube.IconButton { iconName: Kube.Icons.underline checkable: true - checked: document.underline - onClicked: document.underline = !document.underline + checked: textEditor.underline + onClicked: textEditor.underline = !textEditor.underline focusPolicy: Qt.TabFocus focus: false } @@ -337,31 +337,24 @@ Kube.View { } } - Kube.DocumentHandler { - id: document - document: textEditor.textDocument - cursorPosition: textEditor.cursorPosition - selectionStart: textEditor.selectionStart - selectionEnd: textEditor.selectionEnd - //textColor: colorDialog.color - } - - Kube.TextArea { + Kube.TextEditor { id: textEditor Layout.fillWidth: true Layout.fillHeight: true - - textFormat: Qt.RichText - wrapMode: TextArea.Wrap - focus: true - selectByMouse: true - persistentSelection: true + htmlEnabled: html.checked onActiveFocusChanged: closeFirstSplitIfNecessary() Keys.onEscapePressed: recipients.forceActiveFocus() - cursorPosition: document.cursorPosition - text: composerController.body + initialText: composerController.body + /** + * We need to: + * * initially load the text from the controller (for replies and whatnot) + * * Then only read from documenthandler in either html or plain (depending on the format). + * * Convert between html and plain when switching the format. + * * Skip invisible chars + * * Remove invisible chars from copied text somehow + */ onTextChanged: composerController.body = text; } } -- cgit v1.2.3