슬래시 명령 커서 복원 계산 분리
This commit is contained in:
@@ -46,6 +46,7 @@ import {
|
||||
import {
|
||||
filterSlashCommands,
|
||||
getSlashCommandFocusTarget,
|
||||
getSlashCommandTextareaSelection,
|
||||
insertMarkdownLinesAtSlashTarget,
|
||||
isMediaSlashAction,
|
||||
parseSlashInput,
|
||||
@@ -2648,10 +2649,12 @@ const focusPreviewAfterSlashCommand = (line, replacementLines) => {
|
||||
* @returns {void}
|
||||
*/
|
||||
const focusTextareaAfterSlashCommand = (line, replacementLines) => {
|
||||
const value = markdownValue.value ?? ''
|
||||
const lineStart = value.split('\n').slice(0, line).join('\n').length + (line > 0 ? 1 : 0)
|
||||
const { offset } = getSlashCommandFocusTarget(line, replacementLines)
|
||||
setTextareaSelection(lineStart + offset, lineStart + offset)
|
||||
const selection = getSlashCommandTextareaSelection({
|
||||
markdown: markdownValue.value ?? '',
|
||||
startLine: line,
|
||||
lines: replacementLines
|
||||
})
|
||||
setTextareaSelection(selection.start, selection.end)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user