Does anyone know if the default rule set for valid_elements in TinyMCE 4 is the same as the one defined in TinyMCE 3, as it is missing from the documentation for TinyMCE 4 (have put a request in for it to be added).
valid_elements TinyMCE 4 documentation - missing the default rule set
valid_elements TinyMCE 3 documentation - includes the default rule set
Thanks
I looked this up in the source. Unfortunately it's not in the form of a single handy string, but it should give you the information you need.
Most of it is in the form 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
}
For those interested, it's in tinymce/src/core/main/ts/api/html/Schema.ts
around line 250
;
TinyMCE has since updated the documentation for TinyMCE 4. There is actually no default option for this tag anymore.
The default rule set for this option is a mixture of the full HTML5 and HTML4 specification or the HTML5 or HTML4 specification depending on the configured schema.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With