Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rich-text-editor) - single click actions #633

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

gavin-everett-genesys
Copy link
Collaborator

@gavin-everett-genesys gavin-everett-genesys commented Sep 30, 2024

This change includes the following,

  1. Addition of actions which include bold, italic, underline and strikethrough, undo, redo, clear formatting, delete, bullet list, ordered list, block quote
  2. Also includes the disabled state and the optional action divider.

Next steps :

  1. I am going to update this PR to include all the actions that just require a single click since its pretty straight forward to implement. For actions that require dropdowns / popovers I will create seperate.

I am currently in the process of tokenising this.

Copy link

package.json Outdated Show resolved Hide resolved
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be tokenising this and the other files shortly.

@gavin-everett-genesys gavin-everett-genesys changed the title feat(rich-text-editor) - typographical emphasis actions feat(rich-text-editor) - single click actions Oct 1, 2024
@gavin-everett-genesys
Copy link
Collaborator Author

I am going to update this PR to include all the actions that just require a single click since its pretty straight forward to implement. For actions that require dropdowns / popovers I will create seperate.

@conor-darcy
Copy link
Collaborator

conor-darcy commented Oct 9, 2024

The icon doesn't seem vertically centred, probably default line height.
image

@conor-darcy
Copy link
Collaborator

Ordered lists, unordered lists, Block Quotes throwing errors:
Can not convert <> to a Fragment (looks like multiple versions of prosemirror-model were loaded)

@conor-darcy
Copy link
Collaborator

Should delete clear the content?

@conor-darcy
Copy link
Collaborator

Should delete clear the content?

Ignore that, seems to be working & I can't reproduce the issue.

<h1>gux-rich-text-editor</h1>
<gux-rich-text-editor-beta>
<gux-rich-text-editor-action-group slot="typographical-emphasis">
<gux-rich-text-editor-action action="bold"></gux-rich-text-editor-action>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be gux-rich-text-editor-button?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the designs they are referenced as actions. Also wanted to keep it consistent with the name we have for actions in the table-toolbar as its similar.

}

.tiptap {
font-size: 14px;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this styling is every app going to need something like this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is tiptap styling but you can also have no styling at all and just have the default editor styles. I have configured it to have the same stylings as the figma designs. Its optional really but might be handy to have it as a template I guess. I could add a comment over it maybe.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be including it in a light dom css file that is shipped with the components?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep this makes sense to me 👍

@gavin-everett-genesys
Copy link
Collaborator Author

gavin-everett-genesys commented Oct 10, 2024

Can not convert <> to a Fragment (looks like multiple versions of prosemirror-model were loaded)

Looking for a workaround atm, theres a few open issues on github surrounding it
(https://github.com/ueberdosis/tiptap/issues/3800)

addition of rich-text-editor

✅ Closes: COMUI-2963
fix divider gaps

✅ Closes: COMUI-2963
update width of rte

✅ Closes: COMUI-2963
join import statements

✅ Closes: COMUI-2963
@gavin-everett-genesys
Copy link
Collaborator Author

Ordered lists, unordered lists, Block Quotes throwing errors: Can not convert <> to a Fragment (looks like multiple versions of prosemirror-model were loaded)

There seems to a broken CDN import from https://esm.sh. I changed the imports to use jsdelivr instead and it works fine.

(ueberdosis/tiptap#4873)

move tiptap styles to light scss file

✅ Closes: COMUI-2963
>
<div class="gux-rich-text-editor-toolbar-container">
<div class="gux-typographical-emphasis-container">
<slot name="typographical-emphasis"></slot>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we conditionally render these slots? Or better still, the wrappers.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that makes sense to me 👍

<slot name="typographical-emphasis"></slot>
</div>
<div class="gux-text-styling-container">
<slot name="text-styling"></slot>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we need the named slots, would one single slot not work where you just slot in multiple gux-rich-text-editor-action-group's?
This would be more flexible allowing devs to construct the toolbar as they see fit...may UX want this restricted?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the designs in figma it states that each group should have its own slot. I am open to change but thinking how the responsive behaviour will work also. At the moment I can use the wrapper classes potentially for hiding and showing those action groups whereas if were just using a single slot I am not sure how that will work. Open to suggestions

return (
<div class="gux-action-group-divider">
<div class="gux-divider"></div>
</div>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can probably do this with one div.

type="button"
disabled={this.disabled}
class={{ 'gux-is-active': this.isActive }}
aria-pressed={this.isActive.toString()}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need an aria-label or some way to describe the button as the icon is decorative?
I know the label is in the tooltip but to got to tab past the button into the tooltip to get the label.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think the use of screenreader-text property on the the icon will suffice 🤔

.prosemirror pre {
white-space: pre-wrap;
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a better class to hang the styles off?
If you use another library you won't get .prosemirror or .tiptap.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot, I am now just applying an editor-styles class to the editor on load. I assume other editors might have the same functionality where they can add a class.

address PR comments

✅ Closes: COMUI-2963
address PR comments

✅ Closes: COMUI-2963
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants