Skip to content

Commit

Permalink
fix: browser console warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Seedsa committed Sep 27, 2024
1 parent 35ef84d commit c1f0901
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 12 deletions.
2 changes: 2 additions & 0 deletions src/components/ActionButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Tooltip, TooltipContent, TooltipTrigger, TooltipProvider } from '@/comp
import type { TooltipContentProps } from 'radix-vue'
import { icons, Icon } from '@/components/icons'
import type { Editor } from '@tiptap/core'
import type { HTMLAttributes } from 'vue'
interface Props {
icon?: keyof typeof icons
Expand All @@ -20,6 +21,7 @@ interface Props {
action?: ButtonViewReturnComponentProps['action']
isActive?: ButtonViewReturnComponentProps['isActive']
editor?: Editor
class?: HTMLAttributes['class']
}
withDefaults(defineProps<Props>(), {
icon: undefined,
Expand Down
9 changes: 8 additions & 1 deletion src/components/ActionDropdownButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ const props = withDefaults(defineProps<Props>(), {
<template>
<DropdownMenu>
<DropdownMenuTrigger :disabled="disabled">
<ActionMenuButton :class="btn_class" :title="title" :icon="icon" :tooltip="tooltip" :disabled="disabled" />
<ActionMenuButton
:class="btn_class"
:title="title"
:icon="icon"
:tooltip="tooltip"
:disabled="disabled"
:is-active="isActive"
/>
</DropdownMenuTrigger>
<DropdownMenuContent :class="cn('min-w-24', props.class)" align="start" side="bottom" v-bind="$attrs">
<slot />
Expand Down
5 changes: 4 additions & 1 deletion src/components/ActionDropdownButtonSplit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ interface Props {
tooltip?: string
disabled?: boolean
class?: string
shortcutKeys?: string[]
btn_class?: string
action?: ButtonViewReturnComponentProps['action']
isActive?: ButtonViewReturnComponentProps['isActive']
Expand All @@ -25,20 +26,22 @@ const props = withDefaults(defineProps<Props>(), {
disabled: false,
action: undefined,
isActive: undefined,
shortcutKeys: undefined,
class: '',
btn_class: '',
})
</script>

<template>
<div class="flex items-center h-[32px] hover:bg-muted rounded-md">
<div class="flex items-center h-[32px] hover:bg-muted rounded-md" :class="[isActive?.() && 'bg-muted']">
<ActionButton
:class="btn_class"
:action="action"
:title="title"
:icon="icon"
:tooltip="tooltip"
:disabled="disabled"
:shortcut-keys="shortcutKeys"
>
</ActionButton>
<DropdownMenu>
Expand Down
2 changes: 0 additions & 2 deletions src/components/Printer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ import { useHotkeys } from '@/hooks'
interface Props {
editor: Editor
disabled?: boolean
containerRef: Object
}
const props = withDefaults(defineProps<Props>(), {
disabled: false,
containerRef: undefined,
})
const { state } = useTiptapStore()
const srcdoc = ref('')
Expand Down
1 change: 0 additions & 1 deletion src/components/menus/AIMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ async function handleCompletion(context: string, prompt_: string) {
}
}
const tippyOptions = reactive<Record<string, unknown>>({
key: 'ai',
maxWidth: 600,
zIndex: 99,
appendTo: 'parent',
Expand Down
2 changes: 1 addition & 1 deletion src/components/menus/ContentMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type PluginRefType = Plugin<{
}>
interface Props {
className: string
className?: string
editor: Editor
disabled?: boolean
pluginKey?: PluginKey | string
Expand Down
1 change: 1 addition & 0 deletions src/components/menus/ImageBubbleMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ function handleRemove() {
popperOptions: {
modifiers: [{ name: 'flip', enabled: false }],
},
appendTo: 'parent',
getReferenceClientRect: getReferenceClientRect.value,
plugins: [sticky],
sticky: 'popper',
Expand Down
5 changes: 0 additions & 5 deletions src/extensions/FontFamily/FontFamily.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { FontFamily as TiptapFontFamily } from '@tiptap/extension-font-family'
import FontFamilyButton from './components/FontFamilyMenuButton.vue'
import type { GeneralOptions } from '@/type'
import { DEFAULT_FONT_FAMILY_MAP } from '@/constants'
import TextStyle from '@tiptap/extension-text-style'

export interface FontFamilyOptions extends TiptapFontFamilyOptions, GeneralOptions<FontFamilyOptions> {
fontFamilyMap: {
Expand Down Expand Up @@ -81,8 +80,4 @@ export const FontFamily = TiptapFontFamily.extend<FontFamilyOptions>({
},
}
},

addExtensions() {
return [TextStyle]
},
})
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useLocale } from '@/locales'
import type { Editor } from '@tiptap/vue-3'
import ActionDropdownButtonSplit from '@/components/ActionDropdownButtonSplit.vue'
import { DropdownMenuItem } from '@/components/ui/dropdown-menu'
import { ButtonViewReturnComponentProps } from '@/type'
interface OrderedListOption {
label: string
Expand All @@ -23,11 +24,15 @@ interface Props {
editor: Editor
disabled?: boolean
tooltip?: string
shortcutKeys?: string[]
isActive?: ButtonViewReturnComponentProps['isActive']
}
const props = withDefaults(defineProps<Props>(), {
disabled: false,
tooltip: '',
shortcutKeys: undefined,
isActive: undefined,
})
const { t } = useLocale()
Expand Down Expand Up @@ -77,11 +82,13 @@ function toggleOrderedList(item: OrderedListOption) {
:action="toggleOrderedList"
:disabled="disabled"
:tooltip="tooltip"
:is-active="isActive"
:shortcutKeys="shortcutKeys"
class="min-w-4 w-full grid grid-cols-3 gap-1"
>
<TooltipProvider>
<Tooltip :delay-duration="0" v-for="item in OrderedListOptions" :key="item.value">
<TooltipTrigger>
<TooltipTrigger as-child>
<DropdownMenuItem class="p-0" @click="toggleOrderedList(item)">
<div
:class="[active === item.value ? 'bg-accent border border-accent-foreground' : '']"
Expand Down
5 changes: 5 additions & 0 deletions src/shims-vue.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module '*.vue' {
import { DefineComponent } from 'vue'
const component: DefineComponent<{}, {}, any>
export default component
}

0 comments on commit c1f0901

Please sign in to comment.