-
Notifications
You must be signed in to change notification settings - Fork 0
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: Add option to disable editors #8
Conversation
🦋 Changeset detectedLatest commit: bdbe9bb The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
--- | ||
"@guardian/prosemirror-editor": minor | ||
--- | ||
|
||
Add option to disable editors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify I understand the release process, it looks from the documentation that this file gets generated automatically by running yarn changeset
. Then the changesets GitHub Action will automatically open a release PR which I assume will convert the changeset info into a changelog? (example here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes - I was prompted to run yarn changeset
by Changeset Bot after my first commit, changesets
said there wasn't a 'changeset' and this added one, which I added in a follow-up commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have tested locally, revoking and re-granting myself Tagmanager CODE permission - looks good!
What does this change?
This adds support for a
disabled
prop to theRichTextEditor
.If the editor is disabled, it's styled differently, the editor content can't be changed, and the menu and keyboard shortcut plugins won't be initialised. The field will instead appear as uneditable text, showing a
not-allowed
cursor on hover.This is useful in our apps, where a field will often be disabled if a user lacks edit permissions (for example in tagmanager).
The PR adds some styling hints that the field is disabled, which weren't there in the Scribe editor this replaces.
Disabled Scribe editor:
Disabled prosemirror-editor (
not-allowed
cursor state not visible):Enabled prosemirror-editor:
How to test
This has been tested locally in tagmanager. If you wish to do the same:
yarn yalc
from the root of the projecttagmanager
locally.yalc add @guardian/prosemirror-editor
./scripts/setup
then./scripts/start