관리자 제목 입력 흐름 보정
This commit is contained in:
@@ -564,10 +564,14 @@ watch(editorBlocks, () => {
|
||||
isApplyingExternalValue.value = false
|
||||
})
|
||||
}, { deep: true })
|
||||
|
||||
defineExpose({
|
||||
focusFirstBlock: () => focusBlock(0)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="admin-block-editor min-h-[32rem] bg-transparent py-4">
|
||||
<div class="admin-block-editor min-h-[32rem] bg-transparent py-4 text-ink">
|
||||
<div class="admin-block-editor__surface post-prose grid gap-1">
|
||||
<div
|
||||
v-for="(block, index) in editorBlocks"
|
||||
@@ -629,4 +633,8 @@ watch(editorBlocks, () => {
|
||||
color: var(--site-soft);
|
||||
content: attr(data-placeholder);
|
||||
}
|
||||
|
||||
.admin-block-editor__block {
|
||||
color: #1f2328;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -17,6 +17,7 @@ const props = defineProps({
|
||||
const emit = defineEmits(['submit'])
|
||||
|
||||
const slugTouched = ref(Boolean(props.initialPost.slug))
|
||||
const blockEditor = ref(null)
|
||||
|
||||
const form = reactive({
|
||||
title: props.initialPost.title || '',
|
||||
@@ -66,6 +67,14 @@ const parseTags = (value) => [...new Set(value
|
||||
.map((tag) => toSlug(tag))
|
||||
.filter(Boolean))]
|
||||
|
||||
/**
|
||||
* 제목 입력 후 본문 에디터로 이동
|
||||
* @returns {void}
|
||||
*/
|
||||
const focusContentEditor = () => {
|
||||
blockEditor.value?.focusFirstBlock()
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물 입력값 제출
|
||||
* @returns {void}
|
||||
@@ -94,14 +103,15 @@ const submitPost = () => {
|
||||
<section class="admin-post-form__content grid gap-4">
|
||||
<input
|
||||
v-model="form.title"
|
||||
class="admin-post-form__title-input border-0 bg-transparent px-0 py-2 text-5xl font-semibold leading-tight outline-none placeholder:text-soft"
|
||||
class="admin-post-form__title-input border-0 bg-transparent px-0 py-2 text-5xl font-semibold leading-tight text-ink outline-none placeholder:text-soft"
|
||||
type="text"
|
||||
placeholder="제목"
|
||||
required
|
||||
@keydown.enter.prevent="focusContentEditor"
|
||||
>
|
||||
|
||||
<div class="admin-post-form__field grid gap-2 text-sm">
|
||||
<AdminBlockEditor v-model="form.content" />
|
||||
<AdminBlockEditor ref="blockEditor" v-model="form.content" />
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user