当前位置: 首页 > 文档资料 > tinyMCE 帮助文档 >

tinymce-html-Writer

优质
小牛编辑
123浏览
2023-12-01

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.