라이브 콜아웃 빈 줄 보존 수정

This commit is contained in:
2026-06-05 11:09:33 +09:00
parent 6daf9ca15e
commit 16a12d304d
6 changed files with 19 additions and 9 deletions

View File

@@ -1,6 +1,5 @@
<script setup>
import {
escapeHtml,
getEditableCaretOffset,
markdownInlineToHtml,
readEditableTextFromElement,
@@ -133,11 +132,11 @@ const resolvedEnterMode = computed(() => {
const toEditorHtml = () => markdownInlineToHtml(props.modelValue.replace(/\n/g, ' '))
/**
* plainText 모드용 편집 HTML을 만든다.
* plainText 모드용 편집 텍스트를 만든다.
* @param {string} value - 본문
* @returns {string} HTML
* @returns {string} 텍스트
*/
const plainTextToEditorHtml = (value) => escapeHtml(String(value ?? '')).replace(/\n/g, '<br>')
const plainTextToEditorText = (value) => String(value ?? '')
/**
* 편집 영역 HTML을 동기화한다.
@@ -154,7 +153,7 @@ const syncEditorHtml = () => {
}
if (props.plainText) {
rootRef.value.innerHTML = plainTextToEditorHtml(props.modelValue)
rootRef.value.textContent = plainTextToEditorText(props.modelValue)
return
}
@@ -1069,6 +1068,7 @@ defineExpose({ focusEditor, readEditorValue })
:class="[
blockClass,
isFocused ? 'content-markdown-editable-inline--focused' : 'content-markdown-editable-inline--idle',
plainText ? 'content-markdown-editable-inline--plain' : '',
showingRaw ? 'content-markdown-editable-inline--raw' : ''
]"
:data-source-line="sourceLine ?? undefined"
@@ -1098,6 +1098,10 @@ defineExpose({ focusEditor, readEditorValue })
background-color: transparent;
}
.content-markdown-editable-inline--plain {
white-space: pre-wrap;
}
.content-markdown-editable-inline--raw {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
font-size: 0.92em;