diff --git a/src/input/richtext/RichTextToolbar.tsx b/src/input/richtext/RichTextToolbar.tsx index 5b15c930..b8415da0 100644 --- a/src/input/richtext/RichTextToolbar.tsx +++ b/src/input/richtext/RichTextToolbar.tsx @@ -32,7 +32,9 @@ enum Styles { paragraph = 'Normal text', h1 = 'Heading 1', h2 = 'Heading 2', - h3 = 'Heading 3' + h3 = 'Heading 3', + h4 = 'Heading 4', + h5 = 'Heading 5' } export type RichTextToolbarProps = { @@ -54,6 +56,10 @@ export const RichTextToolbar = forwardRef(function RichTextToolbar( ? 'h2' : editor.isActive('heading', {level: 3}) ? 'h3' + : editor.isActive('heading', {level: 4}) + ? 'h4' + : editor.isActive('heading', {level: 5}) + ? 'h5' : 'paragraph' function handleLink() { @@ -94,8 +100,8 @@ export const RichTextToolbar = forwardRef(function RichTextToolbar( .insertContent({ type: 'text', text: - picked.description || - (link as UrlReference).description || + picked.title || + (link as UrlReference).title || (link as UrlReference).url || '', marks: [{type: 'link', attrs}] @@ -144,6 +150,16 @@ export const RichTextToolbar = forwardRef(function RichTextToolbar( > Heading 3 + exec().setHeading({level: 4}).run()} + > + Heading 4 + + exec().setHeading({level: 5}).run()} + > + Heading 5 +
diff --git a/src/ui/Typo.module.scss b/src/ui/Typo.module.scss index 600b2877..13350cb5 100644 --- a/src/ui/Typo.module.scss +++ b/src/ui/Typo.module.scss @@ -61,6 +61,19 @@ } } +.h5 { + min-width: 0; + font-size: 11.5px; + font-weight: bold; + margin-bottom: 3px; + white-space: pre-line; + text-rendering: optimizeLegibility; + @extend .hyphenate; + &.is-flat { + margin-bottom: 0; + } +} + .p { font-size: 14px; line-height: 1.6; diff --git a/src/ui/util/CreateTypo.tsx b/src/ui/util/CreateTypo.tsx index 014b5047..7b9ef299 100644 --- a/src/ui/util/CreateTypo.tsx +++ b/src/ui/util/CreateTypo.tsx @@ -13,12 +13,13 @@ import {GenericStyles, Styler} from './Styler.js' type TypoStyles = | { root: Styler - h1: Styler link: Styler small: Styler + h1: Styler h2: Styler h3: Styler h4: Styler + h5: Styler p: Styler hyphenate: Styler monospace: Styler @@ -108,6 +109,21 @@ export function createTypo( ) } + function H5Component( + props: PropsWithAs, + ref: Ref + ) { + const {as: Type = 'h5', flat, light, ...rest} = props + return ( + + ) + } + function PComponent( props: PropsWithAs, ref: Ref @@ -169,6 +185,7 @@ export function createTypo( H2: forwardRefWithAs(H2Component), H3: forwardRefWithAs(H3Component), H4: forwardRefWithAs(H4Component), + H5: forwardRefWithAs(H5Component), P: forwardRefWithAs(PComponent), Link: LinkComponent, link: styles.link,