From 855ab6fc689c18bd66ac2042dd38c8d8beb519dd Mon Sep 17 00:00:00 2001 From: ralf Date: Mon, 11 Nov 2024 17:30:43 +0100 Subject: [PATCH] Reapply "changed et2-image to inline svg located inside /egroupware/* so they inherit color just like bootstrap icons" This reverts commit e4b345d0119215c2123d2c9511f4fdeead841c8f. --- api/js/etemplate/Et2Image/Et2Image.ts | 17 +++++++++++++++++ api/src/Image.php | 2 +- .../templates/default/images/bi-12-square.svg | 6 ------ .../templates/default/images/bi-31-square.svg | 2 +- .../templates/default/images/bi-card-list.svg | 5 +++++ 5 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 calendar/templates/default/images/bi-card-list.svg diff --git a/api/js/etemplate/Et2Image/Et2Image.ts b/api/js/etemplate/Et2Image/Et2Image.ts index f2bb363984..542dcf9825 100644 --- a/api/js/etemplate/Et2Image/Et2Image.ts +++ b/api/js/etemplate/Et2Image/Et2Image.ts @@ -13,6 +13,8 @@ import {Et2Widget} from "../Et2Widget/Et2Widget"; import {et2_IDetachedDOM} from "../et2_core_interfaces"; import {property} from "lit/decorators/property.js"; import {customElement} from "lit/decorators/custom-element.js"; +import {until} from "lit/directives/until.js"; +import {unsafeHTML} from "lit/directives/unsafe-html.js"; @customElement("et2-image") export class Et2Image extends Et2Widget(LitElement) implements et2_IDetachedDOM @@ -180,6 +182,21 @@ export class Et2Image extends Et2Widget(LitElement) implements et2_IDetachedDOM this.classList.add('bi-'+bootstrap[1]); return html``; } + + // our own svg images + //only call unsafeHtml when we are inside /egroupware/ + const ourSvg = url.match(/\/egroupware\/([^.]+)\.svg/); + if (ourSvg) + { + const svg = fetch(url) + .then(res => res.text() + .then(text => unsafeHTML(text))); + return html` + ${until(svg, html`...`)} + ` + } + + // fallback case (no svg, web source) return html` '1-square', 'calendar/list_view' => 'list', 'calendar/month_view' => 'calendar/bi-31-square', - 'calendar/multiweek_view' => 'card-list', + 'calendar/multiweek_view' => 'calendar/bi-card-list', 'calendar/needs-action' => 'question-circle', 'calendar/next' => 'arrow-bar-right', 'calendar/nonblocking' => 'ban', diff --git a/calendar/templates/default/images/bi-12-square.svg b/calendar/templates/default/images/bi-12-square.svg index 3ed32e22a5..3a310581cd 100644 --- a/calendar/templates/default/images/bi-12-square.svg +++ b/calendar/templates/default/images/bi-12-square.svg @@ -1,16 +1,10 @@ - diff --git a/calendar/templates/default/images/bi-31-square.svg b/calendar/templates/default/images/bi-31-square.svg index 92b1f77606..8bff231e5d 100644 --- a/calendar/templates/default/images/bi-31-square.svg +++ b/calendar/templates/default/images/bi-31-square.svg @@ -1,5 +1,5 @@ - + diff --git a/calendar/templates/default/images/bi-card-list.svg b/calendar/templates/default/images/bi-card-list.svg new file mode 100644 index 0000000000..28d14832dc --- /dev/null +++ b/calendar/templates/default/images/bi-card-list.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file