[SailfishDevel] Communicate with WebView

Michael Fuchs michfu at gmx.at
Mon Mar 26 13:34:46 UTC 2018


Thanks a lot. Will try it later.

By "native API" you mean the Syntaxhighlighting, right?

This is a nice to have for my app, but first I'd like to display a 
rendered markdown page.

cheers,
Michael.

@alexey, sorry for multiple mails. ;)

Am 26.03.2018 um 11:56 schrieb Alexey Andreyev:
> Hi!
> 
> Attaching file with example.
> 
> But, anyway, if you are trying to create markdown editor it is much 
> easier and appropriate to use native api (not webkit/webengine):
> https://github.com/pbek/qmarkdowntextedit/blob/develop/markdownhighlighter.h
> 

> import QtQuick 2.2
> import Sailfish.Silica 1.0
> import QtWebKit 3.0
> ;import QtWebKit.experimental 1.0
> 
> WebView {
>     id: webView
> 
>     signal messageReceived(var message)
> 
>     function runJavaScript(script, callback) {
>         return webView.experimental.evaluateJavaScript(script, callback);
>     }
> 
>     property Item _webPage: webView.experimental.page
>     experimental.preferredMinimumContentsWidth: _webPage.width
>     experimental.deviceWidth: Screen.width
>     experimental.deviceHeight: Screen.height
>     experimental.enableInputFieldAnimation: false
> 
>     experimental.preferences.navigatorQtObjectEnabled: true
>     experimental.onMessageReceived: webView.messageReceived(message)
> }


> 2018-03-26 12:31 GMT+03:00 Michael Fuchs <michfu at gmx.at 
> <mailto:michfu at gmx.at>>:
> 
>     Hi sailors,
> 
>     is there a way to communicate with a WebView?
> 
>     I would like to make something like this:
>     https://doc.qt.io/qt-5.6/qtwebengine-webenginewidgets-markdowneditor-example.html
>     <https://doc.qt.io/qt-5.6/qtwebengine-webenginewidgets-markdowneditor-example.html>
> 
>     ...but WebChannels don't seem to be available.
> 
>     Also WebView.runJavaScript() isn't there.
> 
>     Thanks a lot,
> 
>     Michael.
>     _______________________________________________
>     SailfishOS.org Devel mailing list
>     To unsubscribe, please send a mail to
>     devel-unsubscribe at lists.sailfishos.org
>     <mailto:devel-unsubscribe at lists.sailfishos.org>
> 
> 
> 
> 
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscribe at lists.sailfishos.org
> 


More information about the Devel mailing list