슬래시 메뉴 상태 초기화 정리

This commit is contained in:
2026-07-27 10:43:49 +09:00
parent 3cc99ebeec
commit 736f7d24ec
4 changed files with 23 additions and 18 deletions

View File

@@ -168,6 +168,16 @@ const liveSlashVisible = computed(() => liveSlashSourceLine.value !== null)
const liveSlashSuppressedLineList = computed(() => [...liveSlashSuppressedLines.value])
const visibleLiveSlashCommands = computed(() => filterSlashCommands(liveSlashQuery.value))
/**
* 슬래시 메뉴 입력 상태를 초기화한다.
* @returns {void}
*/
const clearLiveSlashState = () => {
liveSlashSourceLine.value = null
liveSlashQuery.value = ''
liveSlashHighlightedIndex.value = 0
}
/** 되돌리기 히스토리 최대 보관 개수 */
const EDITOR_UNDO_LIMIT = 100
/** @type {import('vue').Ref<Array<string|{ value: string, selectionStart: number, selectionEnd: number }>>} 본문 되돌리기 스택 */
@@ -1039,9 +1049,7 @@ const syncWriteSlashState = () => {
if (liveSlashSuppressedLines.value.has(line)) {
if (liveSlashSourceLine.value !== null) {
liveSlashSourceLine.value = null
liveSlashQuery.value = ''
liveSlashHighlightedIndex.value = 0
clearLiveSlashState()
}
return
@@ -2532,9 +2540,7 @@ const onLiveSlashUpdate = (payload) => {
if (liveSlashSuppressedLines.value.has(payload.sourceLine)) {
if (liveSlashSourceLine.value !== null) {
liveSlashSourceLine.value = null
liveSlashQuery.value = ''
liveSlashHighlightedIndex.value = 0
clearLiveSlashState()
}
return
@@ -2594,9 +2600,7 @@ const onLiveSlashEnd = (payload) => {
liveSlashSuppressedLines.value = next
}
liveSlashSourceLine.value = null
liveSlashQuery.value = ''
liveSlashHighlightedIndex.value = 0
clearLiveSlashState()
}
/**
@@ -2610,9 +2614,7 @@ const cancelLiveSlashCommand = () => {
liveSlashSuppressedLines.value = new Set([...liveSlashSuppressedLines.value, line])
}
liveSlashSourceLine.value = null
liveSlashQuery.value = ''
liveSlashHighlightedIndex.value = 0
clearLiveSlashState()
}
/**
@@ -2678,9 +2680,7 @@ const applyLiveSlashCommand = (command) => {
nextSuppressed.delete(line)
liveSlashSuppressedLines.value = nextSuppressed
replaceLineRange(line, line, replacementLines, false)
liveSlashSourceLine.value = null
liveSlashQuery.value = ''
liveSlashHighlightedIndex.value = 0
clearLiveSlashState()
if (activeMode.value === 'write') {
focusTextareaAfterSlashCommand(line, replacementLines)