Skip to content

Commit

Permalink
fix: codeblock
Browse files Browse the repository at this point in the history
  • Loading branch information
hunghg255 committed Oct 20, 2024
1 parent 016a150 commit 0ee6f3f
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions src/extensions/CodeBlock/components/CodeBlockActiveButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import React, { useMemo } from 'react'
import type { BundledLanguage } from 'shiki'
import {
ActionButton,
Select,
SelectContent,
SelectItem,
SelectTrigger,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from '@/components'
import { MAP_LANGUAGE_CODE_LABELS } from '@/constants'

Expand Down Expand Up @@ -40,30 +40,26 @@ function CodeBlockActiveButton({ action, languages, ...props }: Props) {
}, [languages])

return (
<Select>
<SelectTrigger disabled={props?.disabled} asChild>
<DropdownMenu>
<DropdownMenuTrigger disabled={props?.disabled} asChild>
<ActionButton
tooltip={props?.tooltip}
disabled={props?.disabled}
icon={props?.icon}
/>
</SelectTrigger>
<SelectContent className="richtext-w-full richtext-max-h-60 richtext-overflow-y-auto">
</DropdownMenuTrigger>
<DropdownMenuContent className="richtext-w-full !richtext-max-h-[180px] !richtext-overflow-y-scroll">
{langs?.map((item: any) => {
return (
<SelectItem
value={item.language}
key={`codeblock-${item.title}`}
onClick={() => onClick(item.language)}
>
<DropdownMenuItem key={`codeblock-${item.title}`} onClick={() => onClick(item.language)}>
<div className="richtext-h-full richtext-ml-1">
{item.title}
</div>
</SelectItem>
</DropdownMenuItem>
)
})}
</SelectContent>
</Select>
</DropdownMenuContent>
</DropdownMenu>
)
}

Expand Down

0 comments on commit 0ee6f3f

Please sign in to comment.