有没有人知道TinyMCE 4中valid_elements的默认规则集是否与TinyMCE 3中定义的默认规则集相同,因为TinyMCE 4的文档中缺少该规则集(已经请求添加它)。
valid_elements TinyMCE 4 documentation - 缺少默认规则集
valid_elements TinyMCE 3 documentation - 包含默认规则集
由于
答案 0 :(得分:1)
TinyMCE已经更新了TinyMCE 4的文档。此标签实际上没有默认选项。
此选项的默认规则集是完整HTML5的混合 和HTML4规范或HTML5或HTML4规范的依赖 在配置的架构上。
答案 1 :(得分:1)
我在源代码中查询了此内容。不幸的是,它不是单个方便的字符串形式,而是应该为您提供所需的信息。
大多数形式为add(ELEMENT, ALLOWED_ATTRIBUTES)
// HTML4 base schema TODO: Move HTML5 specific attributes to HTML5 specific if statement
// Schema items <element name>, <specific attributes>, <children ..>
add('html', 'manifest', 'head body');
add('head', '', 'base command link meta noscript script style title');
add('title hr noscript br');
add('base', 'href target');
add('link', 'href rel media hreflang type sizes hreflang');
add('meta', 'name http-equiv content charset');
add('style', 'media type scoped');
add('script', 'src async defer type charset');
add('body', 'onafterprint onbeforeprint onbeforeunload onblur onerror onfocus ' +
'onhashchange onload onmessage onoffline ononline onpagehide onpageshow ' +
'onpopstate onresize onscroll onstorage onunload', flowContent);
add('address dt dd div caption', '', flowContent);
add('h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn', '', phrasingContent);
add('blockquote', 'cite', flowContent);
add('ol', 'reversed start type', 'li');
add('ul', '', 'li');
add('li', 'value', flowContent);
add('dl', '', 'dt dd');
add('a', 'href target rel media hreflang type', phrasingContent);
add('q', 'cite', phrasingContent);
add('ins del', 'cite datetime', flowContent);
add('img', 'src sizes srcset alt usemap ismap width height');
add('iframe', 'src name width height', flowContent);
add('embed', 'src type width height');
add('object', 'data type typemustmatch name usemap form width height', [flowContent, 'param'].join(' '));
add('param', 'name value');
add('map', 'name', [flowContent, 'area'].join(' '));
add('area', 'alt coords shape href target rel media hreflang type');
add('table', 'border', 'caption colgroup thead tfoot tbody tr' + (type === 'html4' ? ' col' : ''));
add('colgroup', 'span', 'col');
add('col', 'span');
add('tbody thead tfoot', '', 'tr');
add('tr', '', 'td th');
add('td', 'colspan rowspan headers', flowContent);
add('th', 'colspan rowspan headers scope abbr', flowContent);
add('form', 'accept-charset action autocomplete enctype method name novalidate target', flowContent);
add('fieldset', 'disabled form name', [flowContent, 'legend'].join(' '));
add('label', 'form for', phrasingContent);
add('input', 'accept alt autocomplete checked dirname disabled form formaction formenctype formmethod formnovalidate ' +
'formtarget height list max maxlength min multiple name pattern readonly required size src step type value width'
);
add('button', 'disabled form formaction formenctype formmethod formnovalidate formtarget name type value',
type === 'html4' ? flowContent : phrasingContent);
add('select', 'disabled form multiple name required size', 'option optgroup');
add('optgroup', 'disabled label', 'option');
add('option', 'disabled label selected value');
add('textarea', 'cols dirname disabled form maxlength name readonly required rows wrap');
add('menu', 'type label', [flowContent, 'li'].join(' '));
add('noscript', '', flowContent);
// Extend with HTML5 elements
if (type !== 'html4') {
add('wbr');
add('ruby', '', [phrasingContent, 'rt rp'].join(' '));
add('figcaption', '', flowContent);
add('mark rt rp summary bdi', '', phrasingContent);
add('canvas', 'width height', flowContent);
add('video', 'src crossorigin poster preload autoplay mediagroup loop ' +
'muted controls width height buffered', [flowContent, 'track source'].join(' '));
add('audio', 'src crossorigin preload autoplay mediagroup loop muted controls ' +
'buffered volume', [flowContent, 'track source'].join(' '));
add('picture', '', 'img source');
add('source', 'src srcset type media sizes');
add('track', 'kind src srclang label default');
add('datalist', '', [phrasingContent, 'option'].join(' '));
add('article section nav aside main header footer', '', flowContent);
add('hgroup', '', 'h1 h2 h3 h4 h5 h6');
add('figure', '', [flowContent, 'figcaption'].join(' '));
add('time', 'datetime', phrasingContent);
add('dialog', 'open', flowContent);
add('command', 'type label icon disabled checked radiogroup command');
add('output', 'for form name', phrasingContent);
add('progress', 'value max', phrasingContent);
add('meter', 'value min max low high optimum', phrasingContent);
add('details', 'open', [flowContent, 'summary'].join(' '));
add('keygen', 'autofocus challenge disabled form keytype name');
}
// Extend with HTML4 attributes unless it's html5-strict
if (type !== 'html5-strict') {
addAttrs('script', 'language xml:space');
addAttrs('style', 'xml:space');
addAttrs('object', 'declare classid code codebase codetype archive standby align border hspace vspace');
addAttrs('embed', 'align name hspace vspace');
addAttrs('param', 'valuetype type');
addAttrs('a', 'charset name rev shape coords');
addAttrs('br', 'clear');
addAttrs('applet', 'codebase archive code object alt name width height align hspace vspace');
addAttrs('img', 'name longdesc align border hspace vspace');
addAttrs('iframe', 'longdesc frameborder marginwidth marginheight scrolling align');
addAttrs('font basefont', 'size color face');
addAttrs('input', 'usemap align');
addAttrs('select', 'onchange');
addAttrs('textarea');
addAttrs('h1 h2 h3 h4 h5 h6 div p legend caption', 'align');
addAttrs('ul', 'type compact');
addAttrs('li', 'type');
addAttrs('ol dl menu dir', 'compact');
addAttrs('pre', 'width xml:space');
addAttrs('hr', 'align noshade size width');
addAttrs('isindex', 'prompt');
addAttrs('table', 'summary width frame rules cellspacing cellpadding align bgcolor');
addAttrs('col', 'width align char charoff valign');
addAttrs('colgroup', 'width align char charoff valign');
addAttrs('thead', 'align char charoff valign');
addAttrs('tr', 'align char charoff valign bgcolor');
addAttrs('th', 'axis align char charoff valign nowrap bgcolor width height');
addAttrs('form', 'accept');
addAttrs('td', 'abbr axis scope align char charoff valign nowrap bgcolor width height');
addAttrs('tfoot', 'align char charoff valign');
addAttrs('tbody', 'align char charoff valign');
addAttrs('area', 'nohref');
addAttrs('body', 'background bgcolor text link vlink alink');
}
// Extend with HTML5 attributes unless it's html4
if (type !== 'html4') {
addAttrs('input button select textarea', 'autofocus');
addAttrs('input textarea', 'placeholder');
addAttrs('a', 'download');
addAttrs('link script img', 'crossorigin');
addAttrs('iframe', 'sandbox seamless allowfullscreen'); // Excluded: srcdoc
}
对于那些感兴趣的人,它位于tinymce/src/core/main/ts/api/html/Schema.ts
行的250
中;