Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

Merge branch 'feat/1.0.8/ui' into feat/ui-1.1.0

haitaoo0c3efb66ab8a
diff --cc i18n/en_US.yaml
index db294d2e,5800297a..6c52b9ca
--- a/i18n/en_US.yaml
+++ b/i18n/en_US.yaml
@@@ -301,9 -301,9 +301,10 @@@ ui
upgrade: Answer Upgrade
maintenance: Website Maintenance
users: Users
+ oauth_callback: Processing
http_404: HTTP Error 404
http_50X: HTTP Error 500
+ http_403: HTTP Error 403
notifications:
title: Notifications
inbox: Inbox
diff --cc ui/src/utils/common.ts
index 991209e9,ce950ab7..af660e65
--- a/ui/src/utils/common.ts
+++ b/ui/src/utils/common.ts
@@@ -235,52 -233,6 +233,26 @@@ function diffText(newText: string, oldT
return result.join('');
}
- function htmlToReact(html: string) {
- const cleanedHtml = DOMPurify.sanitize(html, {
- USE_PROFILES: { html: true },
- });
-
- const ele = document.createElement('div');
- ele.innerHTML = cleanedHtml;
-
- ele.querySelectorAll('table').forEach((table) => {
- if (
- (!table || (table.parentNode as HTMLDivElement))?.classList.contains(
- 'table-responsive',
- )
- ) {
- return;
- }
-
- table.classList.add('table', 'table-bordered');
- const div = document.createElement('div');
- div.className = 'table-responsive';
- table.parentNode?.replaceChild(div, table);
- div.appendChild(table);
- });
- return parse(ele.innerHTML);
- }
-
+function base64ToSvg(base64: string) {
+ // base64 to svg xml
+ const svgxml = atob(base64);
+
+ // svg add class btnSvg
+ const parser = new DOMParser();
+ const doc = parser.parseFromString(svgxml, 'image/svg+xml');
+ const svg = doc.querySelector('svg');
+ let str = '';
+ if (svg) {
+ svg.classList.add('btnSvg');
+ svg.classList.add('me-2');
+
+ // transform svg to string
+ const serializer = new XMLSerializer();
+ str = serializer.serializeToString(doc);
+ }
+ return str;
+}
+
export {
thousandthDivision,
formatCount,
@@@ -296,6 -248,4 +268,5 @@@
labelStyle,
handleFormError,
diffText,
- htmlToReact,
+ base64ToSvg,
};