라이브 코드 블록 설정 패널 닫힘 수정

This commit is contained in:
2026-06-09 14:19:26 +09:00
parent b69039c7ff
commit 34b2d0a4c0
11 changed files with 64 additions and 10 deletions

View File

@@ -120,7 +120,8 @@ const emit = defineEmits([
'slash-end',
'slash-apply',
'enter-advance',
'leave-block'
'leave-block',
'focus-line'
])
const rootRef = ref(null)
@@ -205,9 +206,26 @@ onBeforeUnmount(() => {
*/
const onFocus = () => {
isFocused.value = true
nextTick(emitFocusedSourceLine)
syncSlashState()
}
/**
* 현재 커서가 있는 원본 줄을 부모에 알린다.
* @returns {void}
*/
const emitFocusedSourceLine = () => {
if (props.sourceLine === null) {
return
}
const lineContext = resolvedEnterMode.value === 'multiline'
? getCaretLineContext()
: { lineIndex: 0 }
emit('focus-line', props.sourceLine + lineContext.lineIndex)
}
/**
* 슬래시 명령 입력 상태를 부모에 알린다.
* @returns {void}
@@ -241,6 +259,7 @@ const syncSlashState = () => {
* @returns {void}
*/
const onEditorInput = () => {
emitFocusedSourceLine()
syncSlashState()
emit('input', readEditorValue())
}
@@ -1408,6 +1427,8 @@ const onCompositionEnd = () => {
* @returns {void}
*/
const onKeyup = (event) => {
emitFocusedSourceLine()
const now = Date.now()
if (
@@ -1473,6 +1494,7 @@ defineExpose({ focusEditor, readEditorValue })
@focus="onFocus"
@blur="onBlur"
@input="onEditorInput"
@click="emitFocusedSourceLine"
@paste="onPaste"
@keydown="onKeydown"
@keyup="onKeyup"