라이브 인용문 아래 이동 수정
This commit is contained in:
@@ -1829,20 +1829,30 @@ const onPreviewAppendParagraph = () => {
|
||||
|
||||
/**
|
||||
* 라이브 모드에서 지정 줄 아래에 마크다운 줄을 삽입한다.
|
||||
* @param {{ afterLine: number, lines: string[] }} payload - 삽입 위치·줄
|
||||
* @param {{ afterLine: number, lines: string[], focusLine?: number }} payload - 삽입 위치·줄
|
||||
* @returns {void}
|
||||
*/
|
||||
const onPreviewInsertAfterLine = ({ afterLine, lines }) => {
|
||||
const onPreviewInsertAfterLine = ({ afterLine, lines, focusLine }) => {
|
||||
if (typeof afterLine !== 'number' || !Array.isArray(lines)) {
|
||||
return
|
||||
}
|
||||
|
||||
const sourceLines = (markdownValue.value ?? '').split('\n')
|
||||
const nextFocusLine = typeof focusLine === 'number'
|
||||
? focusLine
|
||||
: afterLine + 1
|
||||
|
||||
markdownValue.value = [
|
||||
...sourceLines.slice(0, afterLine + 1),
|
||||
...lines,
|
||||
...sourceLines.slice(afterLine + 1)
|
||||
].join('\n')
|
||||
|
||||
activeLogicalLineIndex.value = nextFocusLine
|
||||
|
||||
nextTick(() => {
|
||||
previewRendererRef.value?.focusEditableAtLine(nextFocusLine, 0, 'start')
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user