payload icon indicating copy to clipboard operation
payload copied to clipboard

feat(richtext-lexical)!: initialize lexical during sanitization

Open AlessioGr opened this issue 1 year ago • 0 comments

Description

BREAKING:

  • sanitizeFields is now an async function
  • the richText adapters now return a function instead of returning the adapter directly

This PR allows lexical to sanitize its own sub-fields within the feature() functions, as those are now called during the main payload sanitization process, in a controlled way. Additionally, you now have access to the sanitized config there, and they are run asynchronously.

In the end, this causes sanitization to happen a lot less frequently for lexical and should massively improve performance.

Additionally, this PR gets rid of maps (slower than for loops) and excessive copying (slow!!) during the sanitization process.

  • [ ] I have read and understand the CONTRIBUTING.md document in this repository.

Type of change

  • [ ] Chore (non-breaking change which does not add functionality)
  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] Change to the templates directory (does not affect core functionality)
  • [ ] Change to the examples directory (does not affect core functionality)
  • [ ] This change requires a documentation update

Checklist:

  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [ ] Existing test suite passes locally with my changes
  • [ ] I have made corresponding changes to the documentation

AlessioGr avatar Apr 29 '24 17:04 AlessioGr