Skip to content

Commit

Permalink
fix(kt-comment): fix cancel text click behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
santiagoballadares committed Jan 10, 2024
1 parent d622708 commit 7711385
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ export default defineComponent({
const translations = useTranslationNamespace('KtComment')
const containerRef = ref<HTMLDivElement | null>(null)
const hasFocus = ref<boolean>(false)
const hasFocus = ref(false)
const showCancelMessage = ref(false)
const textareaRef = ref<HTMLTextAreaElement | null>(null)
useResizeTextarea(
Expand All @@ -86,11 +87,15 @@ export default defineComponent({
)
const blurTextarea = () => blurElement(containerRef.value)
const focusTextarea = () => textareaRef.value?.focus()
const focusTextarea = () => {
textareaRef.value?.focus()
showCancelMessage.value = true
}
const onCancel = () => {
emit('cancel')
blurTextarea()
showCancelMessage.value = false
}
const onClick = (event: MouseEvent | KeyboardEvent) => {
Expand Down Expand Up @@ -128,7 +133,7 @@ export default defineComponent({
onInput: (event: { target: HTMLTextAreaElement }) =>
emit('input', event.target.value),
onToggleInternal: () => emit('toggleInternal'),
showCancelMessage: computed(() => hasFocus.value || props.value !== ''),
showCancelMessage,
textareaRef,
toggleInternalButtonProps: computed(
(): Pick<
Expand Down

0 comments on commit 7711385

Please sign in to comment.