fix: align knowledge workspace controls

This commit is contained in:
lofyer
2026-08-10 23:23:54 +08:00
parent 7ce58da5f5
commit 90c4e9d8cc
4 changed files with 36 additions and 2 deletions
@@ -422,6 +422,17 @@ describe('KnowledgeWorkspace', () => {
expect(screen.queryByTitle('D:\\Private\\架构说明.md')).not
.toBeInTheDocument()
expect(screen.queryByTitle('D:\\Private\\产品手册')).not.toBeInTheDocument()
const syncSource = screen.getByRole('button', {
name: '同步 产品手册'
})
const removeSource = screen.getByRole('button', {
name: '移除来源 产品手册'
})
expect(syncSource.parentElement).toBe(removeSource.parentElement)
expect(syncSource.parentElement).toHaveClass(
'knowledge-source-row__actions'
)
expect(removeSource).not.toHaveStyle({ padding: '8px' })
fireEvent.click(screen.getByRole('tab', { name: '知识图谱' }))
fireEvent.change(screen.getByLabelText('选择图谱实体'), {
+1 -1
View File
@@ -1300,7 +1300,7 @@ function DocumentsView({
onClick={() =>
void run(source.id, () => onRemoveSource(source.id))
}
style={{ ...styles.button, padding: 8 }}
style={styles.button}
type="button"
>
<Trash2 aria-hidden="true" size={14} />
@@ -108,6 +108,15 @@ describe('WorkspacePrimitives', () => {
expect(stylesheet).toMatch(
/\.page-tabs\s*\{[^}]*overflow-x:\s*auto;[^}]*flex-wrap:\s*nowrap;/u
)
expect(stylesheet).toMatch(
/\.knowledge-graph__detail > \.page-tabs--segmented\s*\{[^}]*min-height:\s*36px;[^}]*overflow:\s*hidden;[^}]*flex:\s*0 0 auto;/u
)
expect(stylesheet).toMatch(
/\.knowledge-graph__detail > \.page-tabs--segmented \.page-tabs__tab\s*\{[^}]*min-width:\s*0;[^}]*overflow:\s*hidden;[^}]*flex:\s*1;/u
)
expect(stylesheet).toMatch(
/\.knowledge-source-row__actions > button\s*\{[^}]*height:\s*var\(--control-height\);[^}]*min-height:\s*var\(--control-height\);[^}]*padding:\s*0 var\(--space-3\);[^}]*align-self:\s*center;/u
)
expect(stylesheet).not.toContain(
'.heartbeat-center > .page-tabs {\n display: grid;'
)
+15 -1
View File
@@ -6686,6 +6686,13 @@ details.settings-section > :not(summary) + :not(summary) {
gap: 8px;
}
.knowledge-source-row__actions > button {
height: var(--control-height);
min-height: var(--control-height);
padding: 0 var(--space-3);
align-self: center;
}
.knowledge-documents__url-form {
display: grid;
grid-template-columns: minmax(0, 1fr) auto auto;
@@ -6804,20 +6811,27 @@ details.settings-section > :not(summary) + :not(summary) {
}
.knowledge-graph__detail > .page-tabs--segmented {
width: calc(100% - (var(--space-4) * 2));
width: auto;
min-height: 36px;
margin: var(--space-4);
overflow: hidden;
align-self: stretch;
flex: 0 0 auto;
}
.knowledge-graph__detail > .page-tabs--segmented .page-tabs__tab {
min-width: 0;
overflow: hidden;
flex: 1;
justify-content: center;
text-overflow: ellipsis;
}
.knowledge-graph__detail-panel {
min-height: 0;
padding: 0 var(--space-4) var(--space-4);
overflow-y: auto;
flex: 1 1 auto;
scrollbar-gutter: stable;
}