summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Montel <[email protected]>2018-03-07 07:12:09 +0100
committerLaurent Montel <[email protected]>2018-03-07 07:12:09 +0100
commit9e515d7b5fc4f26a9fdb1de71d4ec4f9103e1c76 (patch)
tree6728f447b371898e2120ddb01bb9b68e17457e08
parent23f0305ee9f3143ad0ee6f30c1a1e413abce4ab0 (diff)
Improve it
-rw-r--r--kmail/editorconvertertextplugins/markdown/data/markdownindex.html31
-rw-r--r--kmail/editorconvertertextplugins/markdown/markdowndocument.cpp3
2 files changed, 12 insertions, 22 deletions
diff --git a/kmail/editorconvertertextplugins/markdown/data/markdownindex.html b/kmail/editorconvertertextplugins/markdown/data/markdownindex.html
index 5d15107..8623a06 100644
--- a/kmail/editorconvertertextplugins/markdown/data/markdownindex.html
+++ b/kmail/editorconvertertextplugins/markdown/data/markdownindex.html
@@ -2,8 +2,8 @@
<html lang="en">
<meta charset="utf-8">
<head>
- <link rel="stylesheet" type="text/css" href="markdown.css">
- <script src="marked.min.js"></script>
+ <link rel="stylesheet" type="text/css" href="3rdparty/markdown.css">
+ <script src="3rdparty/marked.min.js"></script>
<script src="qwebchannel.js"></script>
</head>
<body>
@@ -13,31 +13,20 @@
var placeholder = document.getElementById('placeholder');
- var viewObject;
-
var updateText = function(text) {
placeholder.innerHTML = marked(text);
- viewObject.emitRenderingDone();
}
new QWebChannel(qt.webChannelTransport,
- function(channel) {
- var sourceTextObject = channel.objects.sourceTextObject;
- viewObject = channel.objects.viewObject;
-
- // document.body.onscroll does not work (sometimes?)
- window.onscroll = function() {
- viewObject.setScrollPosition(document.body.scrollLeft, document.body.scrollTop);
- };
- viewObject.requestSetScrollPosition.connect(function(x,y) {
- document.body.scrollTop = y;
- document.body.scrollLeft = x;
- });
-
- updateText(sourceTextObject.text);
- sourceTextObject.textChanged.connect(updateText);
- }
+ function(channel) {
+ var content = channel.objects.content;
+ updateText(content.text);
+ content.textChanged.connect(updateText);
+ }
);
</script>
</body>
</html>
+
+
+
diff --git a/kmail/editorconvertertextplugins/markdown/markdowndocument.cpp b/kmail/editorconvertertextplugins/markdown/markdowndocument.cpp
index 4657f07..49aa647 100644
--- a/kmail/editorconvertertextplugins/markdown/markdowndocument.cpp
+++ b/kmail/editorconvertertextplugins/markdown/markdowndocument.cpp
@@ -18,7 +18,7 @@
*/
#include "markdowndocument.h"
-
+#include <QDebug>
MarkdownDocument::MarkdownDocument(QObject *parent)
: QObject(parent)
{
@@ -35,6 +35,7 @@ void MarkdownDocument::setText(const QString &text)
if (mText == text)
return;
mText = text;
+ qDebug() << " void MarkdownDocument::setText(const QString &text)"<<text;
Q_EMIT textChanged(mText);
}