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 /components | |
parent | e87ecb949e77211eb21e30a97a65426f87231414 (diff) | |
download | kube-8edb362d96ed740cf5f387649d760c17c7c17d31.tar.gz kube-8edb362d96ed740cf5f387649d760c17c7c17d31.zip |
Keep TextEditor as our html editor
Diffstat (limited to 'components')
-rw-r--r-- | components/kube/contents/ui/ComposerView.qml | 41 |
1 files changed, 17 insertions, 24 deletions
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 { | |||
287 | Kube.IconButton { | 287 | Kube.IconButton { |
288 | iconName: Kube.Icons.bold | 288 | iconName: Kube.Icons.bold |
289 | checkable: true | 289 | checkable: true |
290 | checked: document.bold | 290 | checked: textEditor.bold |
291 | onClicked: document.bold = !document.bold | 291 | onClicked: textEditor.bold = !textEditor.bold |
292 | focusPolicy: Qt.TabFocus | 292 | focusPolicy: Qt.TabFocus |
293 | focus: false | 293 | focus: false |
294 | } | 294 | } |
295 | Kube.IconButton { | 295 | Kube.IconButton { |
296 | iconName: Kube.Icons.italic | 296 | iconName: Kube.Icons.italic |
297 | checkable: true | 297 | checkable: true |
298 | checked: document.italic | 298 | checked: textEditor.italic |
299 | onClicked: document.italic = !document.italic | 299 | onClicked: textEditor.italic = !textEditor.italic |
300 | focusPolicy: Qt.TabFocus | 300 | focusPolicy: Qt.TabFocus |
301 | focus: false | 301 | focus: false |
302 | } | 302 | } |
303 | Kube.IconButton { | 303 | Kube.IconButton { |
304 | iconName: Kube.Icons.underline | 304 | iconName: Kube.Icons.underline |
305 | checkable: true | 305 | checkable: true |
306 | checked: document.underline | 306 | checked: textEditor.underline |
307 | onClicked: document.underline = !document.underline | 307 | onClicked: textEditor.underline = !textEditor.underline |
308 | focusPolicy: Qt.TabFocus | 308 | focusPolicy: Qt.TabFocus |
309 | focus: false | 309 | focus: false |
310 | } | 310 | } |
@@ -337,31 +337,24 @@ Kube.View { | |||
337 | } | 337 | } |
338 | } | 338 | } |
339 | 339 | ||
340 | Kube.DocumentHandler { | 340 | Kube.TextEditor { |
341 | id: document | ||
342 | document: textEditor.textDocument | ||
343 | cursorPosition: textEditor.cursorPosition | ||
344 | selectionStart: textEditor.selectionStart | ||
345 | selectionEnd: textEditor.selectionEnd | ||
346 | //textColor: colorDialog.color | ||
347 | } | ||
348 | |||
349 | Kube.TextArea { | ||
350 | id: textEditor | 341 | id: textEditor |
351 | 342 | ||
352 | Layout.fillWidth: true | 343 | Layout.fillWidth: true |
353 | Layout.fillHeight: true | 344 | Layout.fillHeight: true |
354 | 345 | htmlEnabled: html.checked | |
355 | textFormat: Qt.RichText | ||
356 | wrapMode: TextArea.Wrap | ||
357 | focus: true | ||
358 | selectByMouse: true | ||
359 | persistentSelection: true | ||
360 | 346 | ||
361 | onActiveFocusChanged: closeFirstSplitIfNecessary() | 347 | onActiveFocusChanged: closeFirstSplitIfNecessary() |
362 | Keys.onEscapePressed: recipients.forceActiveFocus() | 348 | Keys.onEscapePressed: recipients.forceActiveFocus() |
363 | cursorPosition: document.cursorPosition | 349 | initialText: composerController.body |
364 | text: composerController.body | 350 | /** |
351 | * We need to: | ||
352 | * * initially load the text from the controller (for replies and whatnot) | ||
353 | * * Then only read from documenthandler in either html or plain (depending on the format). | ||
354 | * * Convert between html and plain when switching the format. | ||
355 | * * Skip invisible chars | ||
356 | * * Remove invisible chars from copied text somehow | ||
357 | */ | ||
365 | onTextChanged: composerController.body = text; | 358 | onTextChanged: composerController.body = text; |
366 | } | 359 | } |
367 | } | 360 | } |