wordpress-mobile / AztecEditor-iOS

A reusable native iOS visual HTML text editor component.
Mozilla Public License 2.0
612 stars 146 forks source link

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

Closed fluiddot closed 2 years ago

fluiddot commented 2 years ago

Related to Gutenberg PR: https://github.com/WordPress/gutenberg/pull/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.