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

[Bug]: cursor should stick at the end in text wrap mode #2067

Open
Vishal-Patil-Gslab opened this issue Mar 3, 2023 · 4 comments
Open

[Bug]: cursor should stick at the end in text wrap mode #2067

Vishal-Patil-Gslab opened this issue Mar 3, 2023 · 4 comments
Labels

Comments

@Vishal-Patil-Gslab
Copy link

Vishal-Patil-Gslab commented Mar 3, 2023

What happened?

Currently when text wrap is enable the cursor jumps to middle while typing and also spaces are not preserve
Please find attached video https://screenrec.com/share/MCZlKosU3h

Version

3.3.0

What browsers are you seeing the problem on?

No response

What operating system are you seeing the problem on?

No response

@kumilingus
Copy link
Contributor

Using the textWrap property with the TextEditor is not currently supported.

We'll most likely fix the position of the cursor for the following textWrap configuration only.

textWrap: {
   height: null, // no height restriction
   preserveSpaces: true, // do not collapse spaces
}

If you limit the height of the text, the text will eventually overflow the area and scrollbars will need to be displayed. That is not a feature of SVG - rendering custom scrollbars and clipping the text would be required.

For the other cases, you might need to use a different approach:

  1. switch off the text wrapping before you start editing the text. switch it back after you stop editing the text.
  2. render a <textarea> above the element as shown here or here.
  3. use the <foreignObject> and set contenteditable on its content. The foreignObject example is here. Note, that there will be a better support for foreign objects in version v3.7.

@Vishal-Patil-Gslab
Copy link
Author

thanks @kumilingus for the different approaches with little bit of tweaks the text area approach will works for us.

also this is bit of off topic but do you have any upgrade documentation that points out any breaking changes while upgrading from one version to another. we are now on version 3.3.0 and using it with reactjs +typescript

@kumilingus
Copy link
Contributor

We're on version v3.6 and we follow the semantic versioning. There should be no breaking changes.

@artem-kliuev
Copy link

artem-kliuev commented Feb 28, 2024

@kumilingus hey, any updates on this? Faced same issue on v4.0.0. If textWrap option provided the caret is not working as expected with TextEditor. We using it with rect with growing height, not width, and textWrap is required here to prevent width changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants