feat: improve editor
This commit is contained in:
parent
b784264d96
commit
ccf6a17f72
12 changed files with 68 additions and 24 deletions
|
@ -9,6 +9,7 @@ const {
|
|||
draftKey,
|
||||
initial = getDefaultDraft() as never /* Bug of vue-core */,
|
||||
expanded: _expanded = false,
|
||||
placeholder,
|
||||
} = defineProps<{
|
||||
draftKey: string
|
||||
initial?: () => Draft
|
||||
|
@ -18,6 +19,7 @@ const {
|
|||
expanded?: boolean
|
||||
}>()
|
||||
|
||||
const { t } = useI18n()
|
||||
// eslint-disable-next-line prefer-const
|
||||
let { draft, isEmpty } = $(useDraft(draftKey, initial))
|
||||
|
||||
|
@ -30,7 +32,7 @@ const { editor } = useTiptap({
|
|||
get: () => draft.params.status,
|
||||
set: newVal => draft.params.status = newVal,
|
||||
}),
|
||||
placeholder: computed(() => draft.placeholder),
|
||||
placeholder: computed(() => placeholder || draft.params.inReplyToId ? t('placeholder.replying') : t('placeholder.default_1')),
|
||||
autofocus: shouldExpanded,
|
||||
onSubmit: publish,
|
||||
onFocus() { isExpanded = true },
|
||||
|
|
|
@ -20,7 +20,7 @@ const selectedLanguage = computed({
|
|||
|
||||
<template>
|
||||
<NodeViewWrapper>
|
||||
<div relative my2>
|
||||
<div relative my2 class="code-block">
|
||||
<select v-model="selectedLanguage" contenteditable="false" absolute top-1 right-1 rounded px2 op0 hover:op100 focus:op100 transition>
|
||||
<option :value="null">
|
||||
plain
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue