formatting state not being updated as soon as change triggered
ayushanand18 opened this issue ยท 3 comments
Overview
The formatting state is not being updated as soon as the button is clicked or a keyboard shortcut is used.
For e.g., When I press Ctrl+B
or click the B
(for bold) on the Rich Text Editor, it doesn't show it is turned on. The button is highlighted, suggesting turned on, only when I input the next letter from my keyboard.
Steps to reproduce
- Run
npm run storybook:start
or navigate to https://typist.doist.dev/ - Navigate to
Rich-text
->Default
from the left menu. - Click on
B
orCtrl+B
/Cmd+B
to toggle bold. - Observation: The icon is not yet highlighted suggesting to the user that it didn't turn on. On all other major platforms the button turns on the moment the change is triggered.
- However, the next letter has the updated formatting (in bold) as per expectations.
Questions
- Is this a design choice by the team? Because this behaviour is different from other major WYSIWYG editors like MS Word, Google Docs, LibreOffice Writer or even web-based editors (eg Froala https://froala.com/wysiwyg-editor/demo/).
If this is something the team is looking forward to, I can help contribute to a fix.
Thanks!
Thank you for reporting this issue @ayushanand18, but please note that this is not a production a issue, it's only affecting the Storybook editors which are only used for documentation and demonstration purposes.
The way the toolbar detects if a formatting option - like bold - is toggled is exactly how the official Tiptap examples do it (ref), and given that the default examples do not exhibit this issue, I'm wondering if the issue on our examples is because we are using Storybook.
Is this a design choice by the team?
It's not, it's very likely a bug on our Storybook demos.
If this is something the team is looking forward to, I can help contribute to a fix.
If you have a fix in mind, by all means, open a PR and we'll take a look. But it's important to note that for this particular issue/fix, production code (i.e. src/
) should not be altered (unless it turns out to be a production issue).
Thanks a ton @rfgamaral for the information! I'll try to ready a fix at earliest.
๐ This issue has been resolved in version 1.2.7 ๐
The release is available on:
Your semantic-release bot ๐ฆ๐