Use proper HTMLTemplateElement for all knockoutjs templates

This commit is contained in:
djmaze 2020-08-14 23:09:36 +02:00
parent efc2dd89e1
commit 29367a0ea7
5 changed files with 2 additions and 40 deletions

View file

@ -1,6 +0,0 @@
import { componentExportHelper } from 'Component/Abstract';
import { AbstractCheckbox } from 'Component/AbstractCheckbox';
class ClassicCheckboxComponent extends AbstractCheckbox {}
export default componentExportHelper(ClassicCheckboxComponent, 'ClassicCheckboxComponent');

View file

@ -1,22 +0,0 @@
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>`
);
}
}
}
};