Refactor settings store to rename proModel to proThinking and update related logic; enhance CSS for energy efficiency and reduced motion preferences; improve i18n translations for better clarity and consistency; modify proBlock utility functions for clearer instruction handling; streamline Vite configuration by removing unnecessary Univer.js dependencies.

This commit is contained in:
“ydy0615”
2026-05-31 16:38:10 +08:00
parent 3a1fd1c5d7
commit b82c6d392d
42 changed files with 3909 additions and 2509 deletions
+6 -2
View File
@@ -40,6 +40,7 @@ import { editorViewCtx } from '@milkdown/kit/core'
import { copilotPlugin, copilotConfigCtx, copilotGhostMark, setCopilotEnabled, clearGhostSuggestion } from '../plugins/copilotPlugin'
import { hiddenTextInputPlugin, hiddenTextNode, hiddenTextRemark, hiddenTextView } from '../plugins/hiddenTextPlugin'
import { fetchSuggestion } from '../utils/api.js'
import { isDocumentVisible, getRecommendedDebounce, getRecommendedSyncInterval } from '../composables/useVisibility.js'
const props = defineProps({
docType: { type: String, default: 'txt' },
@@ -81,13 +82,16 @@ const toggleCollapse = () => {
const syncContent = () => {
if (!crepe) return
// Skip content sync when tab is hidden (energy saving for nested editors)
if (!isDocumentVisible()) return
if (syncTimer) clearTimeout(syncTimer)
const syncInterval = getRecommendedSyncInterval(120)
syncTimer = setTimeout(async () => {
if (!crepe || syncingExternal) return
const markdown = await crepe.getMarkdown()
currentContent.value = markdown
props.onUpdateContent?.(markdown)
}, 120)
}, syncInterval)
}
const syncExternalContent = async (nextValue) => {
@@ -139,7 +143,7 @@ onMounted(async () => {
if (payload?.blocked) return ''
return fetchSuggestion(payload?.prefix ?? prefix, payload?.suffix ?? suffix, payload?.languageId ?? languageId, signal)
},
debounceMs: 900,
debounceMs: getRecommendedDebounce(900),
})
})