mirror of
https://github.com/formbricks/formbricks.git
synced 2026-04-24 11:39:22 -05:00
fix: Unexpected Behavior when Toggling Italics in Text Editor and improve clarity of formatting status (#1506)
Co-authored-by: Dhruwang <dhruwangjariwala18@gmail.com> Co-authored-by: Dhruwang Jariwala <67850763+Dhruwang@users.noreply.github.com>
This commit is contained in:
@@ -453,11 +453,8 @@ export default function ToolbarPlugin(props: TextEditorProps) {
|
||||
StartIcon={Bold}
|
||||
onClick={() => {
|
||||
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "bold");
|
||||
if (isItalic) {
|
||||
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "italic");
|
||||
}
|
||||
}}
|
||||
className={isBold ? "bg-subtle" : ""}
|
||||
className={isBold ? "bg-subtle active-button" : "inactive-button"}
|
||||
/>
|
||||
)}
|
||||
{!props.excludedToolbarItems?.includes("italic") && (
|
||||
@@ -468,11 +465,8 @@ export default function ToolbarPlugin(props: TextEditorProps) {
|
||||
StartIcon={Italic}
|
||||
onClick={() => {
|
||||
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "italic");
|
||||
if (isItalic) {
|
||||
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "bold");
|
||||
}
|
||||
}}
|
||||
className={isItalic ? "bg-subtle" : ""}
|
||||
className={isItalic ? "bg-subtle active-button" : "inactive-button"}
|
||||
/>
|
||||
)}
|
||||
{!props.excludedToolbarItems?.includes("link") && (
|
||||
@@ -483,7 +477,7 @@ export default function ToolbarPlugin(props: TextEditorProps) {
|
||||
type="button"
|
||||
StartIcon={Link}
|
||||
onClick={insertLink}
|
||||
className={isLink ? "bg-subtle" : ""}
|
||||
className={isLink ? "bg-subtle active-button" : "inactive-button"}
|
||||
/>
|
||||
{isLink && createPortal(<FloatingLinkEditor editor={editor} />, document.body)}{" "}
|
||||
</>
|
||||
|
||||
@@ -335,3 +335,12 @@ i.italic {
|
||||
i.link {
|
||||
background-image: url(images/icons/link.svg);
|
||||
}
|
||||
|
||||
.active-button {
|
||||
color: #000000;
|
||||
|
||||
}
|
||||
|
||||
.inactive-button {
|
||||
color: #777;
|
||||
}
|
||||
Reference in New Issue
Block a user