[Interest] How to develop a WYSIWYG HTML editor based on QtWebkit?

Josiah Bryan josiahbryan at gmail.com
Wed Aug 8 14:15:34 CEST 2012

On Tue, Aug 7, 2012 at 11:35 PM, 程梁 <chengliang.soft at gmail.com> wrote:

> Thanks! I saw this example before. There is the same problem as I met.
> If you clear editing area and type something, you will got some HTML
> code like:
> http://www.w3.org/TR/html4/strict.dtd"><html><head>
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
> <title>HTML Editor Demo</title>
> </head><body style="word-wrap: break-word; -webkit-nbsp-mode: space;
> -webkit-line-break: after-white-space; ">hey</body></html>
> in which I just write hey and I want to get
> <p>hey</p>
> <snip>

If that's the case, I'd just do a simple javascript function to HTML-ize
everything underneath body. Not sure if this works in WebKit, but a
javascript call like: document.body.innerHTML() should give you just the
content of the body. You could wrap it in <p> tags if no tags found in the
HTML (e.g. just one long string.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120808/10b29852/attachment.html>

More information about the Interest mailing list