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.

feat(ui): add border and responsive on table

robinc08051ec2755
diff --git a/ui/src/components/Editor/utils/index.ts b/ui/src/components/Editor/utils/index.ts
index 8c767559..10ec9664 100644
--- a/ui/src/components/Editor/utils/index.ts
+++ b/ui/src/components/Editor/utils/index.ts
@@ -113,4 +113,20 @@ export function htmlRender(el: HTMLElement | null) {
});
},
);
+
+ el.querySelectorAll('table').forEach((table) => {
+ if (
+ (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);
+ });
}
diff --git a/ui/src/index.scss b/ui/src/index.scss
index 32197219..6619a3fa 100644
--- a/ui/src/index.scss
+++ b/ui/src/index.scss
@@ -239,6 +239,12 @@ a {
margin-bottom: 0;
}
}
+ table {
+ td,
+ th {
+ word-break: initial;
+ }
+ }
}
.upload-img-wrap {
@@ -285,8 +291,13 @@ a {
}
@keyframes bg-fade-out {
- 0%, 25% {background-color: var(--bs-highlight-bg)}
- 100% { background-color: transparent }
+ 0%,
+ 25% {
+ background-color: var(--bs-highlight-bg);
+ }
+ 100% {
+ background-color: transparent;
+ }
}
.bg-fade-out {
animation: 2s ease 1s bg-fade-out;