mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-10 04:22:27 +10:00
feat(rich-input): Highlight the selected options of rich inputs
This commit is contained in:
@ -151,6 +151,7 @@ const Toolbar = ({ editor }: { editor: Editor }) => {
|
|||||||
type="button"
|
type="button"
|
||||||
pressed={editor.isActive("bold")}
|
pressed={editor.isActive("bold")}
|
||||||
disabled={!editor.can().chain().toggleBold().run()}
|
disabled={!editor.can().chain().toggleBold().run()}
|
||||||
|
className={editor.isActive("bold") ? "bg-secondary" : undefined}
|
||||||
onPressedChange={() => editor.chain().focus().toggleBold().run()}
|
onPressedChange={() => editor.chain().focus().toggleBold().run()}
|
||||||
>
|
>
|
||||||
<TextBIcon />
|
<TextBIcon />
|
||||||
@ -163,6 +164,7 @@ const Toolbar = ({ editor }: { editor: Editor }) => {
|
|||||||
type="button"
|
type="button"
|
||||||
pressed={editor.isActive("italic")}
|
pressed={editor.isActive("italic")}
|
||||||
disabled={!editor.can().chain().focus().toggleItalic().run()}
|
disabled={!editor.can().chain().focus().toggleItalic().run()}
|
||||||
|
className={editor.isActive("italic") ? "bg-secondary" : undefined}
|
||||||
onPressedChange={() => editor.chain().focus().toggleItalic().run()}
|
onPressedChange={() => editor.chain().focus().toggleItalic().run()}
|
||||||
>
|
>
|
||||||
<TextItalicIcon />
|
<TextItalicIcon />
|
||||||
@ -175,6 +177,7 @@ const Toolbar = ({ editor }: { editor: Editor }) => {
|
|||||||
type="button"
|
type="button"
|
||||||
pressed={editor.isActive("strike")}
|
pressed={editor.isActive("strike")}
|
||||||
disabled={!editor.can().chain().focus().toggleStrike().run()}
|
disabled={!editor.can().chain().focus().toggleStrike().run()}
|
||||||
|
className={editor.isActive("strike") ? "bg-secondary" : undefined}
|
||||||
onPressedChange={() => editor.chain().focus().toggleStrike().run()}
|
onPressedChange={() => editor.chain().focus().toggleStrike().run()}
|
||||||
>
|
>
|
||||||
<TextStrikethroughIcon />
|
<TextStrikethroughIcon />
|
||||||
@ -187,6 +190,7 @@ const Toolbar = ({ editor }: { editor: Editor }) => {
|
|||||||
type="button"
|
type="button"
|
||||||
pressed={editor.isActive("underline")}
|
pressed={editor.isActive("underline")}
|
||||||
disabled={!editor.can().chain().focus().toggleUnderline().run()}
|
disabled={!editor.can().chain().focus().toggleUnderline().run()}
|
||||||
|
className={editor.isActive("underline") ? "bg-secondary" : undefined}
|
||||||
onPressedChange={() => editor.chain().focus().toggleUnderline().run()}
|
onPressedChange={() => editor.chain().focus().toggleUnderline().run()}
|
||||||
>
|
>
|
||||||
<TextAUnderlineIcon />
|
<TextAUnderlineIcon />
|
||||||
@ -199,6 +203,7 @@ const Toolbar = ({ editor }: { editor: Editor }) => {
|
|||||||
type="button"
|
type="button"
|
||||||
pressed={editor.isActive("highlight")}
|
pressed={editor.isActive("highlight")}
|
||||||
disabled={!editor.can().chain().focus().toggleHighlight().run()}
|
disabled={!editor.can().chain().focus().toggleHighlight().run()}
|
||||||
|
className={editor.isActive("highlight") ? "bg-secondary" : undefined}
|
||||||
onPressedChange={() => editor.chain().focus().toggleHighlight().run()}
|
onPressedChange={() => editor.chain().focus().toggleHighlight().run()}
|
||||||
>
|
>
|
||||||
<HighlighterCircleIcon />
|
<HighlighterCircleIcon />
|
||||||
@ -217,6 +222,7 @@ const Toolbar = ({ editor }: { editor: Editor }) => {
|
|||||||
type="button"
|
type="button"
|
||||||
pressed={editor.isActive("code")}
|
pressed={editor.isActive("code")}
|
||||||
disabled={!editor.can().chain().focus().toggleCode().run()}
|
disabled={!editor.can().chain().focus().toggleCode().run()}
|
||||||
|
className={editor.isActive("code") ? "bg-secondary" : undefined}
|
||||||
onPressedChange={() => editor.chain().focus().toggleCode().run()}
|
onPressedChange={() => editor.chain().focus().toggleCode().run()}
|
||||||
>
|
>
|
||||||
<CodeIconImport />
|
<CodeIconImport />
|
||||||
@ -229,6 +235,7 @@ const Toolbar = ({ editor }: { editor: Editor }) => {
|
|||||||
type="button"
|
type="button"
|
||||||
pressed={editor.isActive("codeBlock")}
|
pressed={editor.isActive("codeBlock")}
|
||||||
disabled={!editor.can().chain().focus().toggleCodeBlock().run()}
|
disabled={!editor.can().chain().focus().toggleCodeBlock().run()}
|
||||||
|
className={editor.isActive("codeBlock") ? "bg-secondary" : undefined}
|
||||||
onPressedChange={() => editor.chain().focus().toggleCodeBlock().run()}
|
onPressedChange={() => editor.chain().focus().toggleCodeBlock().run()}
|
||||||
>
|
>
|
||||||
<CodeBlockIconImport />
|
<CodeBlockIconImport />
|
||||||
@ -241,6 +248,7 @@ const Toolbar = ({ editor }: { editor: Editor }) => {
|
|||||||
type="button"
|
type="button"
|
||||||
pressed={editor.isActive("heading", { level: 1 })}
|
pressed={editor.isActive("heading", { level: 1 })}
|
||||||
disabled={!editor.can().chain().focus().toggleHeading({ level: 1 }).run()}
|
disabled={!editor.can().chain().focus().toggleHeading({ level: 1 }).run()}
|
||||||
|
className={editor.isActive("heading", { level: 1 }) ? "bg-secondary" : undefined}
|
||||||
onPressedChange={() => editor.chain().focus().toggleHeading({ level: 1 }).run()}
|
onPressedChange={() => editor.chain().focus().toggleHeading({ level: 1 }).run()}
|
||||||
>
|
>
|
||||||
<TextHOneIcon />
|
<TextHOneIcon />
|
||||||
@ -253,6 +261,7 @@ const Toolbar = ({ editor }: { editor: Editor }) => {
|
|||||||
type="button"
|
type="button"
|
||||||
pressed={editor.isActive("heading", { level: 2 })}
|
pressed={editor.isActive("heading", { level: 2 })}
|
||||||
disabled={!editor.can().chain().focus().toggleHeading({ level: 2 }).run()}
|
disabled={!editor.can().chain().focus().toggleHeading({ level: 2 }).run()}
|
||||||
|
className={editor.isActive("heading", { level: 2 }) ? "bg-secondary" : undefined}
|
||||||
onPressedChange={() => editor.chain().focus().toggleHeading({ level: 2 }).run()}
|
onPressedChange={() => editor.chain().focus().toggleHeading({ level: 2 }).run()}
|
||||||
>
|
>
|
||||||
<TextHTwoIcon />
|
<TextHTwoIcon />
|
||||||
@ -265,6 +274,7 @@ const Toolbar = ({ editor }: { editor: Editor }) => {
|
|||||||
type="button"
|
type="button"
|
||||||
pressed={editor.isActive("heading", { level: 3 })}
|
pressed={editor.isActive("heading", { level: 3 })}
|
||||||
disabled={!editor.can().chain().focus().toggleHeading({ level: 3 }).run()}
|
disabled={!editor.can().chain().focus().toggleHeading({ level: 3 }).run()}
|
||||||
|
className={editor.isActive("heading", { level: 3 }) ? "bg-secondary" : undefined}
|
||||||
onPressedChange={() => editor.chain().focus().toggleHeading({ level: 3 }).run()}
|
onPressedChange={() => editor.chain().focus().toggleHeading({ level: 3 }).run()}
|
||||||
>
|
>
|
||||||
<TextHThreeIcon />
|
<TextHThreeIcon />
|
||||||
@ -276,6 +286,7 @@ const Toolbar = ({ editor }: { editor: Editor }) => {
|
|||||||
size="sm"
|
size="sm"
|
||||||
type="button"
|
type="button"
|
||||||
pressed={editor.isActive("paragraph")}
|
pressed={editor.isActive("paragraph")}
|
||||||
|
className={editor.isActive("paragraph") ? "bg-secondary" : undefined}
|
||||||
onPressedChange={() => editor.chain().focus().setParagraph().run()}
|
onPressedChange={() => editor.chain().focus().setParagraph().run()}
|
||||||
>
|
>
|
||||||
<ParagraphIconImport />
|
<ParagraphIconImport />
|
||||||
@ -288,6 +299,7 @@ const Toolbar = ({ editor }: { editor: Editor }) => {
|
|||||||
type="button"
|
type="button"
|
||||||
pressed={editor.isActive({ textAlign: "left" })}
|
pressed={editor.isActive({ textAlign: "left" })}
|
||||||
disabled={!editor.can().chain().focus().setTextAlign("left").run()}
|
disabled={!editor.can().chain().focus().setTextAlign("left").run()}
|
||||||
|
className={editor.isActive({ textAlign: "left" }) ? "bg-secondary" : undefined}
|
||||||
onPressedChange={() => editor.chain().focus().setTextAlign("left").run()}
|
onPressedChange={() => editor.chain().focus().setTextAlign("left").run()}
|
||||||
>
|
>
|
||||||
<TextAlignLeftIcon />
|
<TextAlignLeftIcon />
|
||||||
@ -300,6 +312,7 @@ const Toolbar = ({ editor }: { editor: Editor }) => {
|
|||||||
type="button"
|
type="button"
|
||||||
pressed={editor.isActive({ textAlign: "center" })}
|
pressed={editor.isActive({ textAlign: "center" })}
|
||||||
disabled={!editor.can().chain().focus().setTextAlign("center").run()}
|
disabled={!editor.can().chain().focus().setTextAlign("center").run()}
|
||||||
|
className={editor.isActive({ textAlign: "center" }) ? "bg-secondary" : undefined}
|
||||||
onPressedChange={() => editor.chain().focus().setTextAlign("center").run()}
|
onPressedChange={() => editor.chain().focus().setTextAlign("center").run()}
|
||||||
>
|
>
|
||||||
<TextAlignCenterIcon />
|
<TextAlignCenterIcon />
|
||||||
@ -312,6 +325,7 @@ const Toolbar = ({ editor }: { editor: Editor }) => {
|
|||||||
type="button"
|
type="button"
|
||||||
pressed={editor.isActive({ textAlign: "right" })}
|
pressed={editor.isActive({ textAlign: "right" })}
|
||||||
disabled={!editor.can().chain().focus().setTextAlign("right").run()}
|
disabled={!editor.can().chain().focus().setTextAlign("right").run()}
|
||||||
|
className={editor.isActive({ textAlign: "right" }) ? "bg-secondary" : undefined}
|
||||||
onPressedChange={() => editor.chain().focus().setTextAlign("right").run()}
|
onPressedChange={() => editor.chain().focus().setTextAlign("right").run()}
|
||||||
>
|
>
|
||||||
<TextAlignRightIcon />
|
<TextAlignRightIcon />
|
||||||
@ -324,6 +338,7 @@ const Toolbar = ({ editor }: { editor: Editor }) => {
|
|||||||
type="button"
|
type="button"
|
||||||
pressed={editor.isActive({ textAlign: "justify" })}
|
pressed={editor.isActive({ textAlign: "justify" })}
|
||||||
disabled={!editor.can().chain().focus().setTextAlign("justify").run()}
|
disabled={!editor.can().chain().focus().setTextAlign("justify").run()}
|
||||||
|
className={editor.isActive({ textAlign: "justify" }) ? "bg-secondary" : undefined}
|
||||||
onPressedChange={() => editor.chain().focus().setTextAlign("justify").run()}
|
onPressedChange={() => editor.chain().focus().setTextAlign("justify").run()}
|
||||||
>
|
>
|
||||||
<TextAlignJustifyIcon />
|
<TextAlignJustifyIcon />
|
||||||
@ -336,6 +351,7 @@ const Toolbar = ({ editor }: { editor: Editor }) => {
|
|||||||
type="button"
|
type="button"
|
||||||
pressed={editor.isActive("bulletList")}
|
pressed={editor.isActive("bulletList")}
|
||||||
disabled={!editor.can().chain().focus().toggleBulletList().run()}
|
disabled={!editor.can().chain().focus().toggleBulletList().run()}
|
||||||
|
className={editor.isActive("bulletList") ? "bg-secondary" : undefined}
|
||||||
onPressedChange={() => editor.chain().focus().toggleBulletList().run()}
|
onPressedChange={() => editor.chain().focus().toggleBulletList().run()}
|
||||||
>
|
>
|
||||||
<ListBulletsIcon />
|
<ListBulletsIcon />
|
||||||
@ -348,6 +364,7 @@ const Toolbar = ({ editor }: { editor: Editor }) => {
|
|||||||
type="button"
|
type="button"
|
||||||
pressed={editor.isActive("orderedList")}
|
pressed={editor.isActive("orderedList")}
|
||||||
disabled={!editor.can().chain().focus().toggleOrderedList().run()}
|
disabled={!editor.can().chain().focus().toggleOrderedList().run()}
|
||||||
|
className={editor.isActive("orderedList") ? "bg-secondary" : undefined}
|
||||||
onPressedChange={() => editor.chain().focus().toggleOrderedList().run()}
|
onPressedChange={() => editor.chain().focus().toggleOrderedList().run()}
|
||||||
>
|
>
|
||||||
<ListNumbersIcon />
|
<ListNumbersIcon />
|
||||||
|
|||||||
Reference in New Issue
Block a user