Skip to content

Commit 0ea09b7

Browse files
authored
Merge pull request #419 from Shaikh-Mudassir/fix-toolbar-highlighting
fixed issue text editor buttons should be highlighted when selected #415
2 parents 7f19775 + 71c8d8b commit 0ea09b7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

frontend/src/components/RichTextEditor/Toolbar/EditorToolbar.jsx

+18
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,18 @@ const Toolbar = ({ editor }) => {
5656
<Button
5757
onClick={() => editor.chain().focus().toggleBold().run()}
5858
disabled={!editor.can().chain().focus().toggleBold().run()}
59+
style = {{
60+
backgroundColor : editor.isActive("bold") ? "#e0e0e0": "transparent",
61+
}}
5962
>
6063
<FormatBold />
6164
</Button>
6265
<Button
6366
onClick={() => editor.chain().focus().toggleItalic().run()}
6467
disabled={!editor.can().chain().focus().toggleItalic().run()}
68+
style = {{
69+
backgroundColor : editor.isActive("italic")? "#e0e0e0" : "transparent",
70+
}}
6571
>
6672
<FormatItalic />
6773
</Button>
@@ -70,6 +76,10 @@ const Toolbar = ({ editor }) => {
7076
disabled={
7177
!editor.can().chain().focus().toggleHeading({ level: 2 }).run()
7278
}
79+
style = {{
80+
backgroundColor: editor.isActive("heading", {level:3})
81+
? "#e0e0e0" : "transparent",
82+
}}
7383
>
7484
<Title />
7585
</Button>
@@ -79,12 +89,20 @@ const Toolbar = ({ editor }) => {
7989
<Button
8090
onClick={() => editor.chain().focus().toggleBulletList().run()}
8191
disabled={!editor.can().chain().focus().toggleBulletList().run()}
92+
style = {{
93+
backgroundColor : editor.isActive("bulletList") ? "#e0e0e0" : "transparent",
94+
95+
}}
8296
>
8397
<FormatListBulleted />
8498
</Button>
8599
<Button
86100
onClick={() => editor.chain().focus().toggleOrderedList().run()}
87101
disabled={!editor.can().chain().focus().toggleOrderedList().run()}
102+
103+
style = {{
104+
backgroundColor : editor.isActive("orderedList") ? "#e0e0e0" : "transparent",
105+
}}
88106
>
89107
<FormatListNumbered />
90108
</Button>

0 commit comments

Comments
 (0)