-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
More control on editor.normalizeNode
#5295
Conversation
🦋 Changeset detectedLatest commit: 2dc096a 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 |
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.
Looks useful to me. Leaving this open for a few days to give others time to review and/or give feedback.
@dylans @zbeyens @ianstormtaylor Was this PR doing any good? I've just tried to use the operation from within normalizeNode and it looks like this is always undefined since most transform operations are running within It also looks a bit wrong to me, passing the operation to onChange, since the call to onChange is kind of asynchronous, which means more than 1 operation could have been executed when calling onChange. You anyways can access the operations through editor.operations isn't it? Documentation seems a bit minimal.. Wouldn't the correct approach be, to use the following code inside normalizeNode, in order to find out what caused the current call to normalizeNode?
|
You're right. This option was experimental and can be removed since no use-case has been built upon it. |
* feat * fix * Create two-books-bow.md * docs * feat * fix
Description
not sure if the coding style fits as it looks to be the first time we have many parameters in an editor method, any suggestion is welcome
Non-breaking changes:
editor
method that can be overridden to control when the normalization should stop. Default behavior (unchanged) is to throw an error when it iterates over 42 times the dirty paths length.editor.onChange
signature change:(options?: { operation?: Operation }) => void
whereoperation
is triggering the function.editor.normalizeNode
signature change:(entry: NodeEntry, options?: { operation?: Operation }) => void
whereoperation
is triggering the function.EditorNormalizeOptions
new optionoperation?: Operation
whereoperation
is triggering the function.Issue
Fixes: #5222
Checks
yarn test
.yarn lint
. (Fix errors withyarn fix
.)yarn start
.)yarn changeset add
.)