Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import UI from './src/ui';
// UI configuration
const itemsPerPage = 55; // 5 rows x 11 icons. Also see plugin-ui.js
let iconifyConfig = {
config: {
itemsPerPage: itemsPerPage,
search: {
limit: itemsPerPage * 2,
},
},
};
// Use local API for development. See config.common.js
if (process.env.ICONIFY_API) {
Iconify.setConfig('defaultAPI', process.env.ICONIFY_API_VALUE);
}
if (process.env.SEARCH_API) {
iconifyConfig.config.API = {
URI: process.env.SEARCH_API_VALUE,
};
}
let params = {
callback: (event, data) => {
console.log('Callback to plugin:', event, data);
},
iconify: iconifyConfig,
// Prefix to limit plugin to one collection. Changing this might be broken by stored route and require reset of options
// prefix: 'ic',
if (result === null) {
return;
}
// Create timer
timer = window.setInterval(nextTick, 100);
}
// Show notice that plug-in is in development mode, not ready for publishing
if (process.env.SEARCH_DEV) {
console.log('Running plug-in in development mode!');
}
// Disable Iconify storage
Iconify.setConfig('localStorage', false);
Iconify.setConfig('sessionStorage', false);
if (process.env.ICONIFY_API) {
// Use local API for development. See config.common.js
Iconify.setConfig('defaultAPI', process.env.ICONIFY_API_VALUE);
}
// Load samples
loadScript('https://code.iconify.design/samples.js');
delay(
counter => {
// Do not delay for more than 1 second
return counter > 10 || Iconify.iconExists('mdi:account-check');
},
() => {
let iconifyConfig = {
config: {
itemsPerPage: itemsPerPage,
}
if (result === null) {
return;
}
// Create timer
timer = window.setInterval(nextTick, 100);
}
// Show notice that plug-in is in development mode, not ready for publishing
if (process.env.SEARCH_DEV) {
console.log('Running plug-in in development mode!');
}
// Disable Iconify storage
Iconify.setConfig('localStorage', false);
Iconify.setConfig('sessionStorage', false);
if (process.env.ICONIFY_API) {
// Use local API for development. See config.common.js
Iconify.setConfig('defaultAPI', process.env.ICONIFY_API_VALUE);
}
// Load samples
loadScript('https://code.iconify.design/samples.js');
delay(
counter => {
// Do not delay for more than 1 second
return counter > 10 || Iconify.iconExists('mdi:account-check');
},
() => {
let iconifyConfig = {
config: {
// Create timer
timer = window.setInterval(nextTick, 100);
}
// Show notice that plug-in is in development mode, not ready for publishing
if (process.env.SEARCH_DEV) {
console.log('Running plug-in in development mode!');
}
// Disable Iconify storage
Iconify.setConfig('localStorage', false);
Iconify.setConfig('sessionStorage', false);
if (process.env.ICONIFY_API) {
// Use local API for development. See config.common.js
Iconify.setConfig('defaultAPI', process.env.ICONIFY_API_VALUE);
}
// Load samples
loadScript('https://code.iconify.design/samples.js');
delay(
counter => {
// Do not delay for more than 1 second
return counter > 10 || Iconify.iconExists('mdi:account-check');
},
() => {
let iconifyConfig = {
config: {
itemsPerPage: itemsPerPage,
search: {
limit: itemsPerPage * 2,
},
constructor(props) {
super(props);
let ui = props.ui,
params = ui.params;
// Set state
this.state = {
counter: 0,
};
// Disable cache for icons
Iconify.setConfig('localStorage', false);
Iconify.setConfig('sessionStorage', false);
// Notices
this.notices = [];
// Options
this.options = ui.options;
// Selected nodes tree
this.selectedNodes = params.selectedNodes ? [params.selectedNodes] : [];
// Page and routes
this.route =
params.route && params.route.page
? JSON.parse(JSON.stringify(params.route))
: {
constructor(props) {
super(props);
let ui = props.ui,
params = ui.params;
// Set state
this.state = {
counter: 0,
};
// Disable cache for icons
Iconify.setConfig('localStorage', false);
Iconify.setConfig('sessionStorage', false);
// Notices
this.notices = [];
// Options
this.options = ui.options;
// Selected nodes tree
this.selectedNodes = params.selectedNodes ? [params.selectedNodes] : [];
// Page and routes
this.route =
params.route && params.route.page
? JSON.parse(JSON.stringify(params.route))
: {
page: 'iconify',