Feedback of reusable wysiwyg editor (#6357)
* make text editor reusable * use dropdown component for block type * remove ring when clicking on block type * allow excluding items in toolbar * refactor code * make AddVariableDropdown reusable * fixed missed translations * fixes variable translation issue * change missed translation variables * make AddVariablesDropdown reusable * reorder block types in dropdown * remove not needed prop * code clean up * center add variable dropwdown icon * remove rounded borders in dropwdown on hover and active * center icons * fix tool bar items dropdown * add constant for dynamic text variables * remove not needed variables (added from merge) Co-authored-by: CarinaWolli <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: alannnc <[email protected]>
This commit is contained in:
6 files changed
+30
-38
No files matched your search
@@ -18,14 +18,14 @@ export const AddVariablesDropdown = (props: IAddVariablesDropdown) => {
|
||||
<>
|
||||
<div className="hidden sm:flex">
|
||||
{t("add_variable")}
|
||||
<Icon.FiChevronDown className="ml-1 h-4 w-4" />
|
||||
<Icon.FiChevronDown className="mt-[2px] ml-1 h-4 w-4" />
|
||||
</div>
|
||||
<div className="block sm:hidden">+</div>
|
||||
</>
|
||||
) : (
|
||||
<div className="flex">
|
||||
{t("add_variable")}
|
||||
<Icon.FiChevronDown className="ml-1 h-4 w-4" />
|
||||
<Icon.FiChevronDown className="mt-[2px] ml-1 h-4 w-4" />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -418,8 +418,8 @@ export default function ToolbarPlugin(props: TextEditorProps) {
|
||||
type="button"
|
||||
onClick={() => format(key)}
|
||||
className={classNames(
|
||||
"toolbar-item w-full focus:ring-0",
|
||||
blockType === key ? "w-full bg-gray-100" : ""
|
||||
"toolbar-item w-full rounded-none focus:ring-0",
|
||||
blockType === key ? "w-full bg-gray-100" : ""
|
||||
)}>
|
||||
<>
|
||||
<span className={"icon block-type " + key} />
|
||||
@@ -444,7 +444,7 @@ export default function ToolbarPlugin(props: TextEditorProps) {
|
||||
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "italic");
|
||||
}
|
||||
}}
|
||||
className={"toolbar-item spaced " + (isBold ? "active" : "")}
|
||||
className={"toolbar-item spaced rounded-md " + (isBold ? "active" : "")}
|
||||
aria-label="Format Bold">
|
||||
<i className="format bold" />
|
||||
</button>
|
||||
@@ -458,7 +458,7 @@ export default function ToolbarPlugin(props: TextEditorProps) {
|
||||
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "bold");
|
||||
}
|
||||
}}
|
||||
className={"toolbar-item spaced " + (isItalic ? "active" : "")}
|
||||
className={"toolbar-item spaced rounded-md " + (isItalic ? "active" : "")}
|
||||
aria-label="Format Italics">
|
||||
<i className="format italic" />
|
||||
</button>
|
||||
@@ -468,7 +468,7 @@ export default function ToolbarPlugin(props: TextEditorProps) {
|
||||
<button
|
||||
type="button"
|
||||
onClick={insertLink}
|
||||
className={"toolbar-item spaced " + (isLink ? "active" : "")}
|
||||
className={"toolbar-item spaced rounded-md " + (isLink ? "active" : "")}
|
||||
aria-label="Insert Link">
|
||||
<i className="format link" />
|
||||
</button>
|
||||
|
||||
Reference in new issue
Block a user