@progress/kendo-angular-editor
Version:
Kendo UI Editor for Angular
28 lines (27 loc) • 1.18 kB
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { commonAttributes, getAttributes, getAttrs, hasAttrs, hole } from './utils';
const createSemanticNode = (tagName) => ({
// Uncaught SyntaxError: Mixing inline and block content (in content expression '(block | inline)*')
// content: '(block | inline)*',
content: 'block*',
group: 'block',
attrs: {
...commonAttributes()
},
parseDOM: [{
tag: tagName,
getAttrs: getAttributes
}],
toDOM: node => hasAttrs(node.attrs) ? [tagName, getAttrs(node.attrs), hole] : [tagName, hole]
});
/**
* @hidden
*/
export const semanticTagNames = ['article', 'main', 'nav', 'header', 'footer', 'aside', 'section'];
/**
* @hidden
*/
export const semanticNodes = semanticTagNames.reduce((acc, curr) => Object.assign(acc, { [curr]: createSemanticNode(curr) }), {});