返回介绍

tinymce-html-Schema

发布于 2019-05-06 06:49:56 字数 10516 浏览 1066 评论 0 收藏 0

Examples

if (tinymce.activeEditor.schema.isValidChild('p', 'span'))
   alert('span is valid child of p.');

 if (tinymce.activeEditor.schema.getElementRule('p'))
   alert('P is a valid element.');

Methods

namesummarydefined by
addCustomElements()Adds custom non HTML elements to the schema.tinymce.html.Schema
addValidChildren()Parses a valid children string and adds them to the schema structure. The valid children format is for example: "element[child1|child2]".tinymce.html.Schema
addValidElements()Parses a valid elements string and adds it to the schema. The valid elements format is for example "element[attr=default|otherattr]". Existing rules will be replaced with the ones specified, so this extends the schema.tinymce.html.Schema
getBlockElements()Returns a map with block elements.tinymce.html.Schema
getBoolAttrs()Returns a map with boolean attributes.tinymce.html.Schema
getCustomElements()Returns an map object of all custom elements.tinymce.html.Schema
getElementRule()Returns true/false if the specified element is valid or not according to the schema.tinymce.html.Schema
getInvalidStyles()Name/value map object with valid styles for each element.tinymce.html.Schema
getMoveCaretBeforeOnEnterElements()Returns a map with elements that the caret should be moved in front of after enter is pressedtinymce.html.Schema
getNonEmptyElements()Returns a map with elements that should be treated as contents regardless if it has text content in them or not such as TD, VIDEO or IMG.tinymce.html.Schema
getSelfClosingElements()Returns a map with self closing tags such as
  • .
  • tinymce.html.Schema
    getShortEndedElements()Returns a map with short ended elements such as BR or IMG.tinymce.html.Schema
    getSpecialElements()Returns a map with special elements. These are elements that needs to be parsed in a special way such as script, style, textarea etc. The map object values are regexps used to find the end of the element.tinymce.html.Schema
    getTextBlockElements()Returns a map with text block elements. Such as: p,h1-h6,div,addresstinymce.html.Schema
    getTextInlineElements()Returns a map of inline text format nodes for example strong/span or ins.tinymce.html.Schema
    getValidClasses()Name/value map object with valid classes for each element.tinymce.html.Schema
    getValidStyles()Name/value map object with valid styles for each element.tinymce.html.Schema
    getWhiteSpaceElements()Returns a map with elements where white space is to be preserved like PRE or SCRIPT.tinymce.html.Schema
    isValid()Returns true/false if the specified element name and optional attribute is valid according to the schema.tinymce.html.Schema
    isValidChild()Returns true/false if the specified element and it's child is valid or not according to the schema.tinymce.html.Schema
    setValidElements()Parses a valid elements string and sets it to the schema. The valid elements format is for example "element[attr=default|otherattr]". Existing rules will be replaced with the ones specified, so this extends the schema.tinymce.html.Schema

    Methods

    addCustomElements

    addCustomElements(custom_elements:String)

    Adds custom non HTML elements to the schema.

    Parameters
    • custom_elements (String) - Comma separated list of custom elements to add.

    addValidChildren

    addValidChildren(valid_children:String)

    Parses a valid children string and adds them to the schema structure. The valid children format is for example: "element[child1|child2]".

    Parameters
    • valid_children (String) - Valid children elements string to parse

    addValidElements

    addValidElements(valid_elements:String)

    Parses a valid elements string and adds it to the schema. The valid elements format is for example "element[attr=default|otherattr]". Existing rules will be replaced with the ones specified, so this extends the schema.

    Parameters
    • valid_elements (String) - String in the valid elements format to be parsed.

    getBlockElements

    getBlockElements():Object

    Returns a map with block elements.

    Return value
    • Object - Name/value lookup map for block elements.

    getBoolAttrs

    getBoolAttrs():Object

    Returns a map with boolean attributes.

    Return value
    • Object - Name/value lookup map for boolean attributes.

    getCustomElements

    getCustomElements():Object

    Returns an map object of all custom elements.

    Return value
    • Object - Name/value map object of all custom elements.

    getElementRule

    getElementRule(name:String):Object

    Returns true/false if the specified element is valid or not according to the schema.

    Parameters
    • name (String) - Element name to check for.
    Return value
    • Object - Element object or undefined if the element isn't valid.

    getInvalidStyles

    getInvalidStyles()

    Name/value map object with valid styles for each element.

    getMoveCaretBeforeOnEnterElements

    getMoveCaretBeforeOnEnterElements():Object

    Returns a map with elements that the caret should be moved in front of after enter is pressed

    Return value
    • Object - Name/value lookup map for elements to place the caret in front of.

    getNonEmptyElements

    getNonEmptyElements():Object

    Returns a map with elements that should be treated as contents regardless if it has text content in them or not such as TD, VIDEO or IMG.

    Return value
    • Object - Name/value lookup map for non empty elements.

    getSelfClosingElements

    getSelfClosingElements():Object

    Returns a map with self closing tags such as

  • .

    Return value
    • Object - Name/value lookup map for self closing tags elements.

    getShortEndedElements

    getShortEndedElements():Object

    Returns a map with short ended elements such as BR or IMG.

    Return value
    • Object - Name/value lookup map for short ended elements.

    getSpecialElements

    getSpecialElements():Object

    Returns a map with special elements. These are elements that needs to be parsed in a special way such as script, style, textarea etc. The map object values are regexps used to find the end of the element.

    Return value
    • Object - Name/value lookup map for special elements.

    getTextBlockElements

    getTextBlockElements():Object

    Returns a map with text block elements. Such as: p,h1-h6,div,address

    Return value
    • Object - Name/value lookup map for block elements.

    getTextInlineElements

    getTextInlineElements():Object

    Returns a map of inline text format nodes for example strong/span or ins.

    Return value
    • Object - Name/value lookup map for text format elements.

    getValidClasses

    getValidClasses()

    Name/value map object with valid classes for each element.

    getValidStyles

    getValidStyles()

    Name/value map object with valid styles for each element.

    getWhiteSpaceElements

    getWhiteSpaceElements():Object

    Returns a map with elements where white space is to be preserved like PRE or SCRIPT.

    Return value
    • Object - Name/value lookup map for white space elements.

    isValid

    isValid(name:String, attr:String):Boolean

    Returns true/false if the specified element name and optional attribute is valid according to the schema.

    Parameters
    • name (String) - Name of element to check.
    • attr (String) - Optional attribute name to check for.
    Return value
    • Boolean - True/false if the element and attribute is valid.

    isValidChild

    isValidChild(name:String, child:String):Boolean

    Returns true/false if the specified element and it's child is valid or not according to the schema.

    Parameters
    • name (String) - Element name to check for.
    • child (String) - Element child to verify.
    Return value
    • Boolean - True/false if the element is a valid child of the specified parent.

    setValidElements

    setValidElements(valid_elements:String)

    Parses a valid elements string and sets it to the schema. The valid elements format is for example "element[attr=default|otherattr]". Existing rules will be replaced with the ones specified, so this extends the schema.

    Parameters
    • valid_elements (String) - String in the valid elements format to be parsed.

    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 和您的相关数据。
      原文