|
|
@ -28,6 +28,7 @@ const props = withDefaults(defineProps<TipTapProps>(), { |
|
|
extensions: undefined, |
|
|
extensions: undefined, |
|
|
imageUpload: undefined, |
|
|
imageUpload: undefined, |
|
|
minHeight: 240, |
|
|
minHeight: 240, |
|
|
|
|
|
maxHeight: 400, |
|
|
placeholder: $t('ui.tiptap.placeholder'), |
|
|
placeholder: $t('ui.tiptap.placeholder'), |
|
|
previewable: true, |
|
|
previewable: true, |
|
|
toolbar: true, |
|
|
toolbar: true, |
|
|
@ -41,9 +42,14 @@ const contentMinHeight = computed(() => |
|
|
? `${props.minHeight}px` |
|
|
? `${props.minHeight}px` |
|
|
: props.minHeight, |
|
|
: props.minHeight, |
|
|
); |
|
|
); |
|
|
|
|
|
const contentMaxHeight = computed(() => |
|
|
|
|
|
typeof props.maxHeight === 'number' |
|
|
|
|
|
? `${props.maxHeight}px` |
|
|
|
|
|
: props.maxHeight, |
|
|
|
|
|
); |
|
|
const tiptapContentClass = cn( |
|
|
const tiptapContentClass = cn( |
|
|
'vben-tiptap-content vben-tiptap__content', |
|
|
'vben-tiptap-content vben-tiptap__content', |
|
|
'text-foreground min-h-(--vben-tiptap-min-height) leading-7 outline-none', |
|
|
'text-foreground max-h-(--vben-tiptap-max-height) min-h-(--vben-tiptap-min-height) overflow-auto leading-7 outline-none', |
|
|
); |
|
|
); |
|
|
const blobUrlTracker = new Set<string>(); |
|
|
const blobUrlTracker = new Set<string>(); |
|
|
const editor = useEditor({ |
|
|
const editor = useEditor({ |
|
|
@ -154,7 +160,10 @@ onBeforeUnmount(() => { |
|
|
|
|
|
|
|
|
<template> |
|
|
<template> |
|
|
<div |
|
|
<div |
|
|
:style="{ '--vben-tiptap-min-height': contentMinHeight }" |
|
|
:style="{ |
|
|
|
|
|
'--vben-tiptap-min-height': contentMinHeight, |
|
|
|
|
|
'--vben-tiptap-max-height': contentMaxHeight, |
|
|
|
|
|
}" |
|
|
class="vben-tiptap overflow-hidden rounded-xl border border-border bg-card" |
|
|
class="vben-tiptap overflow-hidden rounded-xl border border-border bg-card" |
|
|
> |
|
|
> |
|
|
<div |
|
|
<div |
|
|
|