feat(wiki): enhance anchored form popups and internationalization updates
Add new styles for anchored form popups in the wiki browser, improving the user interface for folder actions and confirmations. Update internationalization strings for move confirmation titles in English, Korean, Russian, and Chinese locales to enhance user experience across multiple languages. Refactor existing components to integrate the new popup styles and ensure consistent behavior.
This commit is contained in:
@@ -396,14 +396,80 @@
|
||||
}
|
||||
|
||||
/* ============================================
|
||||
五、暗色模式增强
|
||||
五、锚定表单/确认弹层(成员邀请、Wiki 移动/删除等)
|
||||
============================================ */
|
||||
.anchored-form-popup-overlay {
|
||||
z-index: 3500 !important;
|
||||
|
||||
.t-popup__content {
|
||||
padding: 14px 16px !important;
|
||||
min-width: 300px;
|
||||
max-width: min(392px, calc(100vw - 24px));
|
||||
border-radius: 12px !important;
|
||||
background: var(--td-bg-color-container) !important;
|
||||
border: 0.5px solid var(--td-component-stroke) !important;
|
||||
box-shadow:
|
||||
0 0 0 0.5px rgba(0, 0, 0, 0.03),
|
||||
0 2px 4px rgba(0, 0, 0, 0.04),
|
||||
0 8px 24px rgba(0, 0, 0, 0.1) !important;
|
||||
backdrop-filter: blur(20px) saturate(180%) !important;
|
||||
-webkit-backdrop-filter: blur(20px) saturate(180%) !important;
|
||||
}
|
||||
}
|
||||
|
||||
.anchored-form-popup-inner {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.anchored-form-popup-title {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
color: var(--td-text-color-primary);
|
||||
margin: 0 0 12px;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.anchored-form-popup-body {
|
||||
padding: 0 0 4px;
|
||||
color: var(--td-text-color-primary);
|
||||
font-size: 14px;
|
||||
line-height: 1.6;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.anchored-form-popup-footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
// Standalone card (teleport / fixed anchor) — same visual tokens as overlay above.
|
||||
.anchored-form-popup-card {
|
||||
padding: 14px 16px;
|
||||
min-width: 300px;
|
||||
max-width: min(392px, calc(100vw - 24px));
|
||||
border-radius: 12px;
|
||||
background: var(--td-bg-color-container);
|
||||
border: 0.5px solid var(--td-component-stroke);
|
||||
box-shadow:
|
||||
0 0 0 0.5px rgba(0, 0, 0, 0.03),
|
||||
0 2px 4px rgba(0, 0, 0, 0.04),
|
||||
0 8px 24px rgba(0, 0, 0, 0.1);
|
||||
backdrop-filter: blur(20px) saturate(180%);
|
||||
-webkit-backdrop-filter: blur(20px) saturate(180%);
|
||||
}
|
||||
|
||||
/* ============================================
|
||||
六、暗色模式增强
|
||||
============================================ */
|
||||
:root[theme-mode="dark"] {
|
||||
.card-more-popup .t-popup__content,
|
||||
.card-more .t-popup__content,
|
||||
.tag-more-popup .t-popup__content,
|
||||
.card-tag-popup .t-popup__content {
|
||||
background: rgba(36, 36, 36, 0.85) !important;
|
||||
.card-tag-popup .t-popup__content,
|
||||
.anchored-form-popup-overlay .t-popup__content {
|
||||
background: rgba(36, 36, 36, 0.92) !important;
|
||||
border-color: rgba(255, 255, 255, 0.08) !important;
|
||||
box-shadow:
|
||||
0 0 0 0.5px rgba(255, 255, 255, 0.05),
|
||||
@@ -411,6 +477,15 @@
|
||||
0 8px 32px rgba(0, 0, 0, 0.28) !important;
|
||||
}
|
||||
|
||||
.anchored-form-popup-card {
|
||||
background: rgba(36, 36, 36, 0.92);
|
||||
border-color: rgba(255, 255, 255, 0.08);
|
||||
box-shadow:
|
||||
0 0 0 0.5px rgba(255, 255, 255, 0.05),
|
||||
0 2px 4px rgba(0, 0, 0, 0.12),
|
||||
0 8px 32px rgba(0, 0, 0, 0.28);
|
||||
}
|
||||
|
||||
.t-popup__content .t-dropdown__menu {
|
||||
background: rgba(36, 36, 36, 0.85);
|
||||
border-color: rgba(255, 255, 255, 0.08);
|
||||
|
||||
@@ -2541,6 +2541,7 @@ export default {
|
||||
moveFolderFailed: 'Failed to move folder',
|
||||
moveFolderIntoSelf: 'Cannot move a folder into itself or its descendant',
|
||||
moveConfirm: 'Move to "{target}"?',
|
||||
moveConfirmTitle: 'Confirm move',
|
||||
rootFolderLabel: 'Root',
|
||||
dropToRoot: 'Drop here to move to root',
|
||||
filterSummary: 'Summaries',
|
||||
|
||||
@@ -3400,6 +3400,7 @@ export default {
|
||||
moveFolderFailed: "디렉터리 이동 실패",
|
||||
moveFolderIntoSelf: "디렉터리를 자기 자신이나 하위 디렉터리로 이동할 수 없습니다",
|
||||
moveConfirm: "'{target}'(으)로 이동할까요?",
|
||||
moveConfirmTitle: "이동 확인",
|
||||
rootFolderLabel: "루트",
|
||||
dropToRoot: "여기에 놓아 루트로 이동",
|
||||
filterSummary: "요약",
|
||||
|
||||
@@ -2905,6 +2905,7 @@ export default {
|
||||
moveFolderFailed: 'Не удалось переместить каталог',
|
||||
moveFolderIntoSelf: 'Нельзя переместить каталог в себя или свой подкаталог',
|
||||
moveConfirm: 'Переместить в «{target}»?',
|
||||
moveConfirmTitle: 'Подтвердить перемещение',
|
||||
rootFolderLabel: 'Корень',
|
||||
dropToRoot: 'Перетащите сюда, чтобы переместить в корень',
|
||||
filterSummary: 'Резюме',
|
||||
|
||||
@@ -3405,6 +3405,7 @@ export default {
|
||||
moveFolderFailed: "移动目录失败",
|
||||
moveFolderIntoSelf: "不能将目录移动到自身或其子目录中",
|
||||
moveConfirm: "移动到「{target}」?",
|
||||
moveConfirmTitle: "确认移动",
|
||||
rootFolderLabel: "根目录",
|
||||
dropToRoot: "拖到空白处移动到根目录",
|
||||
filterSummary: "摘要",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,25 +4,11 @@
|
||||
confirm) happens inside this one popup so no full-page dialog is spawned.
|
||||
click.stop on the trigger and content prevents the surrounding directory
|
||||
row from treating the interaction as an expand/collapse toggle. -->
|
||||
<t-popup
|
||||
v-model:visible="open"
|
||||
trigger="click"
|
||||
placement="bottom-start"
|
||||
destroy-on-close
|
||||
overlay-class-name="card-more-popup wiki-folder-action-overlay"
|
||||
@visible-change="onVisibleChange"
|
||||
>
|
||||
<span
|
||||
:class="[
|
||||
'wiki-directory-action',
|
||||
{ 'wiki-directory-action--reveal': !createOnly, 'is-open': open, 'wiki-directory-action--labeled': createOnly && label },
|
||||
]"
|
||||
:title="createOnly ? t('knowledgeEditor.wikiBrowser.newFolder') : t('knowledgeEditor.wikiBrowser.folderActions')"
|
||||
@click.stop
|
||||
@dragstart.prevent.stop
|
||||
>
|
||||
<t-icon :name="createOnly ? 'folder-add' : 'more'" />
|
||||
<span v-if="createOnly && label" class="wiki-directory-action-label">{{ label }}</span>
|
||||
<t-popup v-model:visible="open" trigger="click" placement="bottom-start" destroy-on-close
|
||||
:overlay-class-name="popupOverlayClass" @visible-change="onVisibleChange">
|
||||
<span :class="['wiki-directory-action', 'wiki-directory-action--reveal', { 'is-open': open }]"
|
||||
:title="t('knowledgeEditor.wikiBrowser.folderActions')" @click.stop @dragstart.prevent.stop>
|
||||
<t-icon name="more" />
|
||||
</span>
|
||||
<template #content>
|
||||
<div class="wiki-folder-menu" @click.stop>
|
||||
@@ -41,39 +27,42 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template v-else-if="mode === 'create'">
|
||||
<div v-else-if="mode === 'create'" class="anchored-form-popup-inner">
|
||||
<div class="anchored-form-popup-title">{{ t('knowledgeEditor.wikiBrowser.newSubfolder') }}</div>
|
||||
<t-input
|
||||
ref="inputRef"
|
||||
v-model="nameInput"
|
||||
:placeholder="t('knowledgeEditor.wikiBrowser.folderNamePlaceholder')"
|
||||
@enter="submitName"
|
||||
/>
|
||||
<div class="wiki-folder-menu-footer">
|
||||
<t-button size="small" variant="outline" @click="open = false">
|
||||
<div class="anchored-form-popup-footer">
|
||||
<t-button variant="outline" @click="open = false">
|
||||
{{ t('common.cancel') }}
|
||||
</t-button>
|
||||
<t-button size="small" theme="primary" :disabled="!nameInput.trim()" @click="submitName">
|
||||
<t-button theme="primary" :disabled="!nameInput.trim()" @click="submitName">
|
||||
{{ t('common.confirm') }}
|
||||
</t-button>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<template v-else>
|
||||
<div v-if="!deletable" class="wiki-folder-confirm">
|
||||
{{ t('knowledgeEditor.wikiBrowser.deleteFolderNotEmpty') }}
|
||||
<div v-else class="anchored-form-popup-inner">
|
||||
<div class="anchored-form-popup-title">{{ t('knowledgeEditor.wikiBrowser.deleteFolder') }}</div>
|
||||
<div class="anchored-form-popup-body">
|
||||
{{
|
||||
deletable
|
||||
? t('knowledgeEditor.wikiBrowser.deleteFolderConfirm', { name })
|
||||
: t('knowledgeEditor.wikiBrowser.deleteFolderNotEmpty')
|
||||
}}
|
||||
</div>
|
||||
<div v-else class="wiki-folder-confirm">
|
||||
{{ t('knowledgeEditor.wikiBrowser.deleteFolderConfirm', { name }) }}
|
||||
</div>
|
||||
<div class="wiki-folder-menu-footer">
|
||||
<t-button size="small" variant="outline" @click="open = false">
|
||||
<div class="anchored-form-popup-footer">
|
||||
<t-button variant="outline" @click="open = false">
|
||||
{{ deletable ? t('common.cancel') : t('common.confirm') }}
|
||||
</t-button>
|
||||
<t-button v-if="deletable" size="small" theme="danger" @click="submitDelete">
|
||||
<t-button v-if="deletable" theme="danger" @click="submitDelete">
|
||||
{{ t('common.confirm') }}
|
||||
</t-button>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</t-popup>
|
||||
@@ -87,18 +76,10 @@ const props = withDefaults(defineProps<{
|
||||
name?: string
|
||||
pageCount?: number
|
||||
hasChildren?: boolean
|
||||
// createOnly turns the trigger into a single "new folder" affordance that
|
||||
// opens straight to the name input (used by the root-folder toolbar entry).
|
||||
createOnly?: boolean
|
||||
// label, when set on a createOnly trigger, renders text next to the icon so
|
||||
// the toolbar entry reads as a button instead of a bare icon.
|
||||
label?: string
|
||||
}>(), {
|
||||
name: '',
|
||||
pageCount: 0,
|
||||
hasChildren: false,
|
||||
createOnly: false,
|
||||
label: '',
|
||||
})
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -116,18 +97,19 @@ const inputRef = ref<{ focus: () => void } | null>(null)
|
||||
|
||||
const deletable = computed(() => props.pageCount === 0 && !props.hasChildren)
|
||||
|
||||
const popupOverlayClass = computed(() => (
|
||||
mode.value === 'menu'
|
||||
? 'card-more-popup wiki-folder-action-overlay'
|
||||
: 'anchored-form-popup-overlay'
|
||||
))
|
||||
|
||||
function onVisibleChange(visible: boolean) {
|
||||
if (!visible) {
|
||||
mode.value = 'menu'
|
||||
nameInput.value = ''
|
||||
return
|
||||
}
|
||||
// createOnly skips the menu and lands directly on the name input.
|
||||
if (props.createOnly) {
|
||||
enterMode('create')
|
||||
} else {
|
||||
mode.value = 'menu'
|
||||
}
|
||||
mode.value = 'menu'
|
||||
}
|
||||
|
||||
function enterMode(next: 'create' | 'delete') {
|
||||
@@ -171,8 +153,6 @@ function submitDelete() {
|
||||
}
|
||||
}
|
||||
|
||||
// Hover-reveal for the per-folder "more" trigger: hidden by default, shown when
|
||||
// the row is hovered (parent supplies that rule via :deep) or the popup is open.
|
||||
.wiki-directory-action--reveal {
|
||||
opacity: 0;
|
||||
|
||||
@@ -180,51 +160,13 @@ function submitDelete() {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Labeled variant: the toolbar "new folder" button reads as icon + text.
|
||||
.wiki-directory-action--labeled {
|
||||
gap: 4px;
|
||||
padding: 2px 6px;
|
||||
border-radius: 6px;
|
||||
font-size: 12px;
|
||||
color: var(--td-text-color-secondary);
|
||||
|
||||
&:hover {
|
||||
color: var(--td-brand-color);
|
||||
background: var(--td-bg-color-container-hover);
|
||||
}
|
||||
}
|
||||
|
||||
.wiki-directory-action-label {
|
||||
line-height: 1;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="less">
|
||||
// Popup content teleports to <body>, so these must be global. The menu chrome
|
||||
// (background, border, shadow, item styling) comes from the shared
|
||||
// `card-more-popup` + `.popup-menu` rules in assets/dropdown-menu.less so this
|
||||
// menu matches every other dropdown in the app; only the create-input and
|
||||
// delete-confirm panes need a little extra layout here.
|
||||
// Menu chrome comes from card-more-popup + .popup-menu in dropdown-menu.less.
|
||||
.wiki-folder-action-overlay {
|
||||
.wiki-folder-menu {
|
||||
min-width: 188px;
|
||||
}
|
||||
|
||||
.wiki-folder-confirm {
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
color: var(--td-text-color-primary);
|
||||
padding: 4px 6px 8px;
|
||||
max-width: 280px;
|
||||
}
|
||||
|
||||
.wiki-folder-menu-footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
margin-top: 8px;
|
||||
padding: 0 2px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1088,9 +1088,11 @@ func (s *wikiPageService) GetFolder(ctx context.Context, kbID string, id string)
|
||||
|
||||
// ListChildFolders returns the direct children of parentID for a tree view
|
||||
// scoped to pageTypes. PageCount is recursive (the folder's whole subtree) so
|
||||
// a parent reflects everything filed beneath it, and a folder is only shown
|
||||
// when its subtree holds a page of pageTypes or it is entirely empty — which
|
||||
// keeps, say, the summary tab from listing folders that only hold entity pages.
|
||||
// a parent reflects everything filed beneath it. A folder is shown when its
|
||||
// subtree holds a page matching pageTypes. Wholly-empty folders (no pages of
|
||||
// any type underneath) are only listed when multiple types are requested —
|
||||
// the merged knowledge view — so single-type tabs like summary do not surface
|
||||
// empty containers.
|
||||
func (s *wikiPageService) ListChildFolders(
|
||||
ctx context.Context, kbID string, parentID string, pageTypes []string,
|
||||
) ([]types.WikiFolderNode, error) {
|
||||
@@ -1111,10 +1113,19 @@ func (s *wikiPageService) ListChildFolders(
|
||||
}
|
||||
recScoped := recursiveFolderCounts(all, scopedDirect)
|
||||
recAll := recursiveFolderCounts(all, allDirect)
|
||||
showEmptyFolders := len(pageTypes) > 1
|
||||
// A folder belongs in this view if it (recursively) contains a page of the
|
||||
// requested types, or if it is a completely empty container (no pages of
|
||||
// any type anywhere underneath).
|
||||
relevant := func(id string) bool { return recScoped[id] > 0 || recAll[id] == 0 }
|
||||
// requested types, or — only in the merged knowledge view — if it is a
|
||||
// completely empty container with no pages of any type underneath.
|
||||
relevant := func(id string) bool {
|
||||
if recScoped[id] > 0 {
|
||||
return true
|
||||
}
|
||||
if showEmptyFolders {
|
||||
return recAll[id] == 0
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
out := make([]types.WikiFolderNode, 0)
|
||||
for _, f := range all {
|
||||
|
||||
Reference in New Issue
Block a user