refactor: remove KbdPlugin and MoreToolbarButton, and add Superscript and Subscript options to InsertToolbarButton for cleaner toolbar functionality

This commit is contained in:
Anish Sarkar 2026-02-17 01:50:09 +05:30
parent 841e764729
commit df3f724caf
6 changed files with 24 additions and 139 deletions

View file

@ -19,6 +19,8 @@ import {
QuoteIcon,
RadicalIcon,
SquareIcon,
SubscriptIcon,
SuperscriptIcon,
TableIcon,
} from 'lucide-react';
import { KEYS } from 'platejs';
@ -156,6 +158,28 @@ const groups: Group[] = [
},
})),
},
{
group: 'Marks',
items: [
{
icon: <SuperscriptIcon />,
label: 'Superscript',
value: KEYS.sup,
},
{
icon: <SubscriptIcon />,
label: 'Subscript',
value: KEYS.sub,
},
].map((item) => ({
...item,
onSelect: (editor: PlateEditor, value: string) => {
editor.tf.toggleMark(value, {
remove: value === KEYS.sup ? KEYS.sub : KEYS.sup,
});
},
})),
},
];
export function InsertToolbarButton(props: DropdownMenuProps) {