Import: Import don't show warnings for supported elements

This commit is contained in:
John McLear 2021-03-02 17:14:47 +00:00 committed by GitHub
parent f24353e806
commit f95b09e0b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 6 deletions

View file

@ -18,15 +18,14 @@
const db = require('../db/DB');
const hooks = require('../../static/js/pluginfw/hooks');
const supportedElems = require('../../static/js/contentcollector').supportedElems;
exports.setPadRaw = (padId, r) => {
const records = JSON.parse(r);
const blockElems = ['div', 'br', 'p', 'pre', 'li', 'author', 'lmkr', 'insertorder'];
// get supported block Elements from plugins, we will use this later.
hooks.callAll('ccRegisterBlockElements').forEach((element) => {
blockElems.push(element);
supportedElems.push(element);
});
Object.keys(records).forEach(async (key) => {
@ -65,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 (blockElems.indexOf(attribName) === -1) {
if (supportedElems.indexOf(attribName) === -1) {
console.warn('Plugin missing: ' +
`You might want to install a plugin to support this node name: ${attribName}`);
}