2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 06:47:20 +08:00

feat: 阶段提交

This commit is contained in:
2026-01-12 07:09:33 +08:00
parent 794a620113
commit a5a396f60e
5 changed files with 31 additions and 35 deletions

View File

@@ -51,7 +51,7 @@ async function initEditor() {
// Display settings
lineNumbers: settings.lineNumbers,
renderWhitespace: settings.renderWhitespace,
'bracketPairColorization.enabled': settings.bracketPairColorization,
bracketPairColorization: { enabled: settings.bracketPairColorization },
guides: {
indentation: settings.guides,
bracketPairs: settings.guides
@@ -308,7 +308,7 @@ watch(
// Display settings
lineNumbers: settings.lineNumbers,
renderWhitespace: settings.renderWhitespace,
'bracketPairColorization.enabled': settings.bracketPairColorization,
bracketPairColorization: { enabled: settings.bracketPairColorization },
guides: {
indentation: settings.guides,
bracketPairs: settings.guides

View File

@@ -40,10 +40,10 @@ const encodings = ['utf-8', 'gbk', 'gb2312', 'iso-8859-1', 'utf-16', 'utf-16le',
// 缩进选项
const indentOptions = computed(() => [
{ label: `${$gettext('Spaces')}: 2`, value: { tabSize: 2, insertSpaces: true } },
{ label: `${$gettext('Spaces')}: 4`, value: { tabSize: 4, insertSpaces: true } },
{ label: `${$gettext('Tabs')}: 2`, value: { tabSize: 2, insertSpaces: false } },
{ label: `${$gettext('Tabs')}: 4`, value: { tabSize: 4, insertSpaces: false } }
{ label: `${$gettext('Spaces')}: 2`, value: '2-spaces' },
{ label: `${$gettext('Spaces')}: 4`, value: '4-spaces' },
{ label: `${$gettext('Tabs')}: 2`, value: '2-tabs' },
{ label: `${$gettext('Tabs')}: 4`, value: '4-tabs' }
])
// 当前缩进显示
@@ -74,8 +74,12 @@ function handleLanguageChange(value: string) {
}
// 更新缩进
function handleIndentChange(value: { tabSize: number; insertSpaces: boolean }) {
editorStore.updateSettings(value)
function handleIndentChange(value: string) {
const [size, type] = value.split('-')
editorStore.updateSettings({
tabSize: parseInt(size),
insertSpaces: type === 'spaces'
})
}
</script>

View File

@@ -142,9 +142,10 @@ function handleSettings() {
}
// 字体大小调整
function handleFontSizeChange(delta: number) {
const newSize = Math.max(10, Math.min(24, editorStore.settings.fontSize + delta))
editorStore.updateSettings({ fontSize: newSize })
function handleFontSizeChange(value: number | null) {
if (value !== null) {
editorStore.updateSettings({ fontSize: value })
}
}
// 切换小地图
@@ -244,21 +245,16 @@ defineExpose({
<n-divider vertical />
<!-- 视图操作 -->
<n-button-group size="small">
<n-button @click="handleFontSizeChange(-1)" :title="$gettext('Decrease Font Size')">
<template #icon>
<i-mdi-format-font-size-decrease />
</template>
</n-button>
<n-button class="font-size-display">
{{ editorStore.settings.fontSize }}
</n-button>
<n-button @click="handleFontSizeChange(1)" :title="$gettext('Increase Font Size')">
<template #icon>
<i-mdi-format-font-size-increase />
</template>
</n-button>
</n-button-group>
<n-input-number
:value="editorStore.settings.fontSize"
@update:value="handleFontSizeChange"
size="small"
button-placement="both"
:min="10"
:max="24"
:show-button="true"
class="w-80"
/>
<n-button
size="small"
@@ -305,10 +301,4 @@ defineExpose({
.spacer {
flex: 1;
}
.font-size-display {
min-width: 40px;
cursor: default;
pointer-events: none;
}
</style>

View File

@@ -64,7 +64,7 @@ watch(rootPath, (newPath) => {
// 键盘快捷键
function handleKeydown(e: KeyboardEvent) {
const isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0
const isMac = /Mac|iPod|iPhone|iPad/.test(navigator.userAgent)
const modKey = isMac ? e.metaKey : e.ctrlKey
// Ctrl/Cmd+S 保存

View File

@@ -117,11 +117,13 @@ function handleExpandedKeysUpdate(keys: string[]) {
}
// 选择节点(打开文件)
async function handleSelect(keys: string[], option: TreeOption[]) {
function handleSelect(keys: string[], option: (TreeOption | null)[]) {
if (keys.length === 0) return
selectedKeys.value = keys
const node = option[0]
if (!node) return
const isDir = (node as any)?.isDir
// 搜索模式下点击文件夹,跳转到该目录
@@ -784,7 +786,7 @@ defineExpose({
@update:selected-keys="handleSelect"
selectable
expand-on-click
virtual-scroll
virtual-scrollå
class="file-tree-content"
style="height: 100%"
/>