브랜드 컬러 설정 추가 v1.5.36
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
parseSlashInput,
|
||||
resolveSlashCommand
|
||||
} from '../../lib/markdown-slash-commands.js'
|
||||
import { CALLOUT_BACKGROUND_OPTIONS } from '../../lib/markdown-callout.js'
|
||||
import { getTextareaCaretCoordinates } from '../../lib/textarea-caret-coordinates.js'
|
||||
import {
|
||||
buildDefaultUploadSizeLimits,
|
||||
@@ -170,7 +171,7 @@ const closeBlockPanel = () => {
|
||||
}
|
||||
|
||||
/**
|
||||
* 커서 줄 기준 활성 블록(이미지·갤러리·임베드)
|
||||
* 커서 줄 기준 활성 블록(이미지·갤러리·임베드·인용)
|
||||
* @returns {Object|null}
|
||||
*/
|
||||
const activeBlockContext = computed(() => resolveActiveBlockContext(
|
||||
@@ -2074,6 +2075,38 @@ const updateActiveEmbedUrl = (url) => {
|
||||
replaceLineRange(block.startLine, block.endLine, [trimmed], false)
|
||||
}
|
||||
|
||||
/**
|
||||
* 현재 인용 블록 배경색을 수정한다.
|
||||
* @param {string} background - 배경색 옵션
|
||||
* @returns {void}
|
||||
*/
|
||||
const updateActiveQuoteBackground = (background) => {
|
||||
const block = activeBlockContext.value
|
||||
|
||||
if (!block || block.kind !== 'quote') {
|
||||
return
|
||||
}
|
||||
|
||||
ensureBlockPanelEngaged()
|
||||
const value = String(background || '').trim()
|
||||
|
||||
if (!CALLOUT_BACKGROUND_OPTIONS.includes(value)) {
|
||||
return
|
||||
}
|
||||
|
||||
const optionLine = `> [!bg=${value}]`
|
||||
const lines = (markdownValue.value || '').split('\n')
|
||||
const nextLines = [...lines]
|
||||
|
||||
if (block.hasQuoteOptions) {
|
||||
nextLines.splice(block.startLine, 1, optionLine)
|
||||
} else {
|
||||
nextLines.splice(block.startLine, 0, optionLine)
|
||||
}
|
||||
|
||||
markdownValue.value = nextLines.join('\n')
|
||||
}
|
||||
|
||||
/**
|
||||
* 이미지 마크다운을 삽입한다.
|
||||
* @param {{ url: string, alt?: string, width?: string }} image - 이미지 정보
|
||||
@@ -2140,6 +2173,7 @@ defineExpose({
|
||||
removeActiveMediaImage,
|
||||
appendImagesToActiveGallery,
|
||||
updateActiveEmbedUrl,
|
||||
updateActiveQuoteBackground,
|
||||
openMediaPicker
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user