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

Add variable to control whether typing attributes should be recalculated when deleting backward #1346

Merged

Conversation

fluiddot
Copy link
Contributor

@fluiddot fluiddot commented Dec 31, 2021

Related to Gutenberg PR: WordPress/gutenberg#37676

The purpose of this PR is allowing to control whether the typing attributes should be recalculated when deleting backward, this will be handy when we want typing attributes/text format to be fully controlled by other libraries, therefore prevent that Aztec modifies them.

Additionally, there's a comment in the recalculateTypingAttributes function that states the following (reference):

/// Only call this method when sure that the typingAttributes need to be recalculated.  Keep in mind that
/// recalculating the typingAttributes in the wrong moment can cause trouble (for example reverting a decision
/// by the user to turn a style off).

If the recalculation only should happen in specific cases, this aligns with the idea of giving control over whether to recalculate the typing attributes through a variable.

To test:
This change shouldn't modify the current behavior when deleting text, so we should only verify that deleting backward works as expected.

This variable allows to control whether typing attributes should be recalculated when deleting backward, by default it's enabled.
@fluiddot fluiddot self-assigned this Dec 31, 2021
Copy link
Contributor

@guarani guarani left a comment

Choose a reason for hiding this comment

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

Change looks good to me! I see that you're not calling recalculateTypingAttributes in Gutenberg, but calling it (as was done previously) when Aztec is used outside of Gutenberg. It all seems to make sense so LGTM.

@fluiddot fluiddot added this to the Next Stable milestone Jan 5, 2022
@fluiddot fluiddot merged commit d5b846f into develop Jan 5, 2022
@fluiddot fluiddot deleted the add/should-recalculate-typing-attributes-on-delete branch January 5, 2022 11:10
@fluiddot fluiddot mentioned this pull request Jan 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants