DEV: allows to check if an icon is in the set (#11303)

This commit is contained in:
Joffrey JAFFEUX
2020-11-20 17:34:55 +01:00
committed by GitHub
parent 7539c2ed7f
commit 8a90a5610f
2 changed files with 7 additions and 2 deletions

View File

@ -114,8 +114,13 @@ export function setIconList(iconList) {
_iconList = iconList;
}
export function isExistingIconId(id) {
// _iconList is actually an array as a string: '["foo", "bar"]'
return _iconList && _iconList.indexOf(`"${id}"`) >= 0;
}
function warnIfMissing(id) {
if (warnMissingIcons && _iconList && _iconList.indexOf(id) === -1) {
if (warnMissingIcons && !isExistingIconId(id)) {
console.warn(`The icon "${id}" is missing from the SVG subset.`); // eslint-disable-line no-console
}
}

View File

@ -67,7 +67,7 @@ import {
} from "discourse/models/user";
// If you add any methods to the API ensure you bump up this number
const PLUGIN_API_VERSION = "0.11.0";
const PLUGIN_API_VERSION = "0.11.1";
class PluginApi {
constructor(version, container) {