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:
authored and GitHub committed 2023-01-09 19:22:17 -07:00
1 parent 62713940b0
commit 430430e0cd
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>
@@ -129,7 +129,6 @@ pre::-webkit-scrollbar-thumb {
.toolbar button.toolbar-item {
border: 0;
display: flex;
border-radius: 10px;
padding: 8px;
cursor: pointer;
vertical-align: middle;
@@ -145,7 +144,8 @@ pre::-webkit-scrollbar-thumb {
display: inline-block;
height: 18px;
width: 18px;
margin-top: 2px;
margin-top: 1px;
margin-left: 1px;
vertical-align: -0.25em;
display: flex;
opacity: 0.6;