Skip to content

Conversation

@amyworrall
Copy link
Contributor

Re-port insertText() from JS

@amyworrall
Copy link
Contributor Author

To accommodate changes in the web version of Lexical since we began the iOS project, as well as additional features now supported by iOS Lexical that were not present when we first wrote insertText(), I went back to the latest Lexical JS source and ported insertText() and deleteCharacter() line-by-line into Swift.

Practical problems this solves include some issues relating to formatting, e.g. whether formatting is applied to the selection upon certain actions (e.g. character deletion). It is also a good thing in general to have behaviour that is very similar to Lexical JS.

Note: as part of doing this work, I spotted a marked text bug: type some text, then apply a format (eg bold), then type a keystroke that initiates marked text. Instead of the expected character appearing, two non-marked characters appear after the caret. This bug is not new with this refactor -- it appears in the old codepath as well -- but I'm mentioning it here to document it.

@facebook-github-bot
Copy link
Contributor

@amyworrall has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

Hi @amyworrall!

Thank you for your pull request.

We require contributors to sign our Contributor License Agreement, and yours needs attention.

You currently have a record in our system, but the CLA is no longer valid, and will need to be resubmitted.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

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.

3 participants