mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-09 00:08:18 +08:00
e7180a86ce
This also allowed to remove all webpack 'externals' overhead.
22 lines
561 B
JavaScript
22 lines
561 B
JavaScript
let cachedUrl = null;
|
|
const getUrl = () => {
|
|
if (!cachedUrl) {
|
|
const version = jQuery('#rlAppVersion').attr('content') || '0.0.0';
|
|
cachedUrl = `rainloop/v/${version}/static/css/svg/icons.svg`;
|
|
}
|
|
|
|
return cachedUrl;
|
|
};
|
|
|
|
export default {
|
|
template: '<b></b>',
|
|
viewModel: {
|
|
createViewModel: ({ icon = 'null' }, componentInfo) => {
|
|
if (componentInfo && componentInfo.element) {
|
|
jQuery(componentInfo.element).replaceWith(
|
|
`<svg class="svg-icon svg-icon-${icon}"><use xlink:href="${getUrl()}#svg-icon-${icon}"></use></svg>`
|
|
);
|
|
}
|
|
}
|
|
}
|
|
};
|