[webkit-qt] Could QWebFrame generate simple HTML code?

程梁 chengliang.soft at gmail.com
Tue Aug 14 20:13:24 PDT 2012


I'm afraid not, for this will return just return

hey<div>newline</div>.

the tags are still wrong.

Maybe I should embed an online HTML WYSIWYG editor...

2012/8/14 Coda Highland <chighland at gmail.com>

> On Tue, Aug 14, 2012 at 12:29 AM, 程梁 <chengliang.soft at gmail.com> wrote:
> > Hey, I'm trying to develop a WYSIWYG HTML editor based on QtWebkit, but
> > nowadays
> > I found a problem:
> >
> > The HTML source code generated by QWebFrame::toHtml() is rather complex,
> > for example, it will add style to <body /> which is not necessary. Could
> I
> > generate
> > the HTML source code by myself? If I use QTextEdit, I could loop all text
> > blocks and
> > try to create source code according to each block. But how could I do the
> > same
> > with QWebFrame?
> >
> > For example, the code I got will be
> >
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> > "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<div>newline</div></body></html>
> >
> > in which I just write hey and I want to get
> >
> > <p>hey</p>
> >
> > <p>newline</p>
> >
> > as simple.
> >
> > The problem is the first line's code is without any tags and the second
> line
> > is warpped with <div>
> > which <p> should be better.
> >
> > How could I solve this problem? Thank you!
>
> evaluateJavaScript("return document.body.innerHTML"); maybe?
>
> /s/ Adam
>



-- 
Cheng Liang <http://about.me/devbean>
Nanjing, China
http://www.devbean.info
from: devbean at devbean.info
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-qt/attachments/20120815/9229f7b2/attachment.html>


More information about the webkit-qt mailing list