mirror of
https://github.com/discourse/discourse.git
synced 2025-06-19 19:03:35 +08:00
DEV: allows to check if an icon is in the set (#11303)
This commit is contained in:
@ -114,8 +114,13 @@ export function setIconList(iconList) {
|
|||||||
_iconList = 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) {
|
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
|
console.warn(`The icon "${id}" is missing from the SVG subset.`); // eslint-disable-line no-console
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ import {
|
|||||||
} from "discourse/models/user";
|
} from "discourse/models/user";
|
||||||
|
|
||||||
// If you add any methods to the API ensure you bump up this number
|
// 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 {
|
class PluginApi {
|
||||||
constructor(version, container) {
|
constructor(version, container) {
|
||||||
|
Reference in New Issue
Block a user