/*! * Jodit Editor (https://xdsoft.net/jodit/) * Released under MIT see LICENSE.txt in the project root for license information. * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net */ import type { CanUndef, IDictionary, IUIIconState, IViewBased } from '../../types'; import { css } from '../helpers/css'; export class Icon { private static icons: IDictionary = {}; private static getIcon(name: string): string | undefined { if (/^ { let iconElement: CanUndef; if (icon) { const clearName = icon.name.replace(/[^a-zA-Z0-9]/g, '_'); if (icon.iconURL) { iconElement = jodit.c.span(); css( iconElement, 'backgroundImage', 'url(' + icon.iconURL.replace( '{basePath}', jodit?.basePath || '' ) + ')' ); } else { const svg = jodit.e.fire('getIcon', icon.name, icon, clearName) || Icon.get(icon.name, '') || jodit.o.extraIcons?.[icon.name]; if (svg) { iconElement = jodit.c.fromHTML(svg.trim()); if (!/^