import: Use a Set for supported elements
parent
e31da37d00
commit
09c349e2a1
|
@ -25,7 +25,7 @@ exports.setPadRaw = (padId, r) => {
|
|||
|
||||
// get supported block Elements from plugins, we will use this later.
|
||||
hooks.callAll('ccRegisterBlockElements').forEach((element) => {
|
||||
supportedElems.push(element);
|
||||
supportedElems.add(element);
|
||||
});
|
||||
|
||||
Object.keys(records).forEach(async (key) => {
|
||||
|
@ -64,7 +64,7 @@ exports.setPadRaw = (padId, r) => {
|
|||
if (value.pool) {
|
||||
for (const attrib of Object.keys(value.pool.numToAttrib)) {
|
||||
const attribName = value.pool.numToAttrib[attrib][0];
|
||||
if (supportedElems.indexOf(attribName) === -1) {
|
||||
if (!supportedElems.has(attribName)) {
|
||||
console.warn('Plugin missing: ' +
|
||||
`You might want to install a plugin to support this node name: ${attribName}`);
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ const getAttribute = (n, a) => {
|
|||
return null;
|
||||
};
|
||||
// supportedElems are Supported natively within Etherpad and don't require a plugin
|
||||
const supportedElems = [
|
||||
const supportedElems = new Set([
|
||||
'author',
|
||||
'b',
|
||||
'bold',
|
||||
|
@ -76,7 +76,7 @@ const supportedElems = [
|
|||
'span',
|
||||
'u',
|
||||
'ul',
|
||||
];
|
||||
]);
|
||||
|
||||
const makeContentCollector = (collectStyles, abrowser, apool, className2Author) => {
|
||||
const _blockElems = {
|
||||
|
@ -88,7 +88,7 @@ const makeContentCollector = (collectStyles, abrowser, apool, className2Author)
|
|||
|
||||
hooks.callAll('ccRegisterBlockElements').forEach((element) => {
|
||||
_blockElems[element] = 1;
|
||||
supportedElems.push(element);
|
||||
supportedElems.add(element);
|
||||
});
|
||||
|
||||
const isBlockElement = (n) => !!_blockElems[tagName(n) || ''];
|
||||
|
@ -339,7 +339,7 @@ const makeContentCollector = (collectStyles, abrowser, apool, className2Author)
|
|||
state.localAttribs = null;
|
||||
const isBlock = isBlockElement(node);
|
||||
if (!isBlock && node.name && (node.name !== 'body')) {
|
||||
if (supportedElems.indexOf(node.name) === -1) {
|
||||
if (!supportedElems.has(node.name)) {
|
||||
console.warn('Plugin missing: ' +
|
||||
`You might want to install a plugin to support this node name: ${node.name}`);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue