返回介绍

tinymce-html-Writer

发布于 2019-05-06 06:49:58 字数 3339 浏览 1288 评论 0 收藏 0

Examples

var writer = new tinymce.html.Writer({indent: true});
var parser = new tinymce.html.SaxParser(writer).parse('<p><br></p>');
console.log(writer.getContent());

Methods

namesummarydefined by
cdata()Writes a comment node such as .tinymce.html.Writer
doctype()Writes a doctype node such as .tinymce.html.Writer
end()Writes the a end element such as

.
tinymce.html.Writer
getContent()Returns the contents that got serialized.tinymce.html.Writer
pi()Writes a PI node such as .tinymce.html.Writer
reset()Resets the internal buffer if one wants to reuse the writer.tinymce.html.Writer
start()Writes the a start element such as

.

tinymce.html.Writer
text()Writes a text node.tinymce.html.Writer

Methods

cdata

cdata(text:String)

Writes a comment node such as .

Parameters
  • text (String) - String to write out inside the comment.

doctype

doctype(text:String)

Writes a doctype node such as .

Parameters
  • text (String) - String to write out inside the doctype.

end

end(name:String)

Writes the a end element such as

.

Parameters
  • name (String) - Name of the element.

getContent

getContent():String

Returns the contents that got serialized.

Return value
  • String - HTML contents that got written down.

pi

pi(name:String, text:String)

Writes a PI node such as .

Parameters
  • name (String) - Name of the pi.
  • text (String) - String to write out inside the pi.

reset

reset()

Resets the internal buffer if one wants to reuse the writer.

start

start(name:String, attrs:Array, empty:Boolean)

Writes the a start element such as

.

Parameters
  • name (String) - Name of the element.
  • attrs (Array) - Optional attribute array or undefined if it hasn't any.
  • empty (Boolean) - Optional empty state if the tag should end like
    .

text

text(text:String, raw:Boolean)

Writes a text node.

Parameters
  • text (String) - String to write out.
  • raw (Boolean) - Optional raw state if true the contents wont get encoded.

Can't find what you're looking for? Let us know.

Except as otherwise noted, the content of this page is licensed under the Creative Commons BY-NC-SA 3.0 License, and code samples are licensed under the Apache 2.0 License.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文