feat: Add page refresh functionality and enhance table styling in WikiBrowser
- Implemented a new `refreshSelectedPage` function to update the content of the currently selected wiki page without altering navigation history, improving user experience by ensuring up-to-date information is displayed. - Enhanced the graph view to reload when the user is currently viewing it, ensuring new nodes and edges are visible. - Added comprehensive CSS styles for markdown tables, improving their presentation and usability within the WikiBrowser interface. These changes enhance the interactivity and visual consistency of the WikiBrowser, providing users with a more dynamic and engaging experience.
This commit is contained in:
@@ -837,10 +837,29 @@ async function loadStats() {
|
|||||||
clearInterval(statsTimer)
|
clearInterval(statsTimer)
|
||||||
statsTimer = null
|
statsTimer = null
|
||||||
loadPages()
|
loadPages()
|
||||||
|
// Also refresh the currently opened page (right panel) so users see updated content
|
||||||
|
refreshSelectedPage()
|
||||||
|
// If currently viewing the graph, reload it as well so new nodes/edges show up
|
||||||
|
if (props.view === 'graph') {
|
||||||
|
loadGraph()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (e) { /* ignore */ }
|
} catch (e) { /* ignore */ }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Refresh the currently selected page's content without touching navigation history
|
||||||
|
async function refreshSelectedPage() {
|
||||||
|
if (!selectedPage.value) return
|
||||||
|
const slug = selectedPage.value.slug
|
||||||
|
try {
|
||||||
|
const res = await getWikiPage(props.knowledgeBaseId, slug)
|
||||||
|
selectedPage.value = (res as any).data || res as any
|
||||||
|
await loadPageIssues(slug)
|
||||||
|
} catch (e) {
|
||||||
|
console.error(`Failed to refresh wiki page ${slug}:`, e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function loadGraph() {
|
async function loadGraph() {
|
||||||
graphLoading.value = true
|
graphLoading.value = true
|
||||||
graphReady.value = false
|
graphReady.value = false
|
||||||
@@ -2251,6 +2270,59 @@ onUnmounted(() => {
|
|||||||
text-decoration: none !important;
|
text-decoration: none !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── Markdown tables (GFM) ──
|
||||||
|
:deep(table) {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
overflow-x: auto;
|
||||||
|
margin: 0 0 16px;
|
||||||
|
border-collapse: collapse;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.55;
|
||||||
|
background: var(--td-bg-color-container);
|
||||||
|
border: 1px solid var(--td-component-stroke);
|
||||||
|
border-radius: 6px;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(table thead) {
|
||||||
|
background: var(--td-bg-color-secondarycontainer);
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(table th),
|
||||||
|
:deep(table td) {
|
||||||
|
padding: 8px 12px;
|
||||||
|
border-bottom: 1px solid var(--td-component-stroke);
|
||||||
|
border-right: 1px solid var(--td-component-stroke);
|
||||||
|
text-align: left;
|
||||||
|
vertical-align: top;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(table th) {
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--td-text-color-primary);
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(table th:last-child),
|
||||||
|
:deep(table td:last-child) {
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(table tbody tr:last-child td) {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(table tbody tr:hover) {
|
||||||
|
background: var(--td-bg-color-secondarycontainer);
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(table code) {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.wiki-reader-backlinks {
|
.wiki-reader-backlinks {
|
||||||
|
|||||||
Reference in New Issue
Block a user