-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fix for #5490 - Adds preventClearDocument
meta + makes it easier to disable specific core plugins.
#5514
Conversation
🦋 Changeset detectedLatest commit: c8a8fa7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 54 packages
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 |
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
packages/core/src/types.ts
Outdated
* Extensions not listed in the object will still be enabled. | ||
* @default true | ||
*/ | ||
enableCoreExtensions: boolean | Record<'editable' | 'clipboardTextSerializer' | 'commands' | 'focusEvents' | 'keymap' | 'tabindex', any>; |
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.
enableCoreExtensions: boolean | Record<'editable' | 'clipboardTextSerializer' | 'commands' | 'focusEvents' | 'keymap' | 'tabindex', any>; | |
enableCoreExtensions: boolean | Record<'editable' | 'clipboardTextSerializer' | 'commands' | 'focusEvents' | 'keymap' | 'tabindex', false>; |
Since false
is the only valid option
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.
Oops, meant to put boolean, but yeah, I guess false makes more sense.
packages/core/src/types.ts
Outdated
/** | ||
* If `false`, the core extensions will not be loaded. | ||
* You can pass an object to disable specific extensions (e.g. `{ keymap: false }`). | ||
* Extensions not listed in the object will still be enabled. | ||
* @default true | ||
*/ |
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.
/** | |
* If `false`, the core extensions will not be loaded. | |
* You can pass an object to disable specific extensions (e.g. `{ keymap: false }`). | |
* Extensions not listed in the object will still be enabled. | |
* @default true | |
*/ | |
/** | |
* Determines whether core extensions are enabled. | |
* | |
* If set to `false`, all core extensions will be disabled. | |
* To disable specific core extensions, provide an object where the keys are the extension names and the values are `false`. | |
* Extensions not listed in the object will remain enabled. | |
* | |
* @example | |
* // Disable all core extensions | |
* enabledCoreExtensions: false | |
* | |
* @example | |
* // Disable only the keymap core extension | |
* enabledCoreExtensions: { keymap: false } | |
* | |
* @default true | |
*/ |
Incorporated both suggested changes. |
Um, I just realized there is a slight bug with the types... The record should be a partial record. Should I open a new PR? |
Ah right, good catch. I'll fix it |
👍 Thanks. |
Changes Overview
preventClearDocument
to the clearDocument plugin to fix the main issue in [Bug]: The "clearDocument" plugin in the core keymap extension can cause issues with custom node change commands. #5490.enableCoreExtensions
to be an object disabling certain core extensions.Implementation Approach
Regarding the disabling of core extensions, @nperez0111, you suggested using
coreExtensionOptions
, but I thought this made a bit more sense. It's only a bit weird in that passing something likeenableCoreExtensions: { keymap: true }
still enables everything. Only passingfalse
will disable an extension (leaving others enabled). But I think that would be the most common use case.Otherwise what sort of interface did you have in mind?
Testing Done
I'm having a bit of issues running cypress locally. But I see the PRs have github actions.
I also tested it with my app to see everything was getting properly ignore/disabled.
Verification Steps
preventClearDocument
on the transaction. My reproduction in [Bug]: The "clearDocument" plugin in the core keymap extension can cause issues with custom node change commands. #5490 shows the issue clearly.Checklist
Am awaiting the github actions results, but otherwise no.