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

Can't get Text content to wrap new lines, though the template works in Playground #7021

Open
khof312 opened this issue Feb 5, 2025 · 3 comments

Comments

@khof312
Copy link

khof312 commented Feb 5, 2025

I am following the instructions for getting text wrapping to work on LabelStudio templates. While the template text wraps in the Playground, it does not wrap in my local LabelStudio interface. Other CSS styling works.

To Reproduce
Use the following template:

<View>
  <Style>.htx-text{ white-space: pre-wrap; }</Style>
  <Style>.ant-radio-wrapper {border: 2px solid green;} </Style>
  
  <Text  value="a\\nb" name="text"  />

  <Choices name="choices" toName="text" choice="single-radio">
    <Choice value="1"/>
    <Choice value="2"/>
  </Choices>
</View>

Expected behavior
The text should be displayed on multiple lines.

Screenshots
In the playground:
Image
Locally:
Image

Environment (please complete the following information):

  • OS: Linux
  • Label Studio Version 1.15.0
@khof312 khof312 changed the title Can't get TextArea content to wrap new lines, though the template works in PlayGround Can't get Text content to wrap new lines, though the template works in Playground Feb 5, 2025
@heidi-humansignal
Copy link
Collaborator

Hello,

Thanks for reaching out. Based on the instructions and our docs, the component can preserve newlines when you add a style rule like:

<Style>.htx-text{ white-space: pre-wrap; }</Style>

Since it works in the Playground but not in your local instance, here are a few suggestions to troubleshoot the issue:

  1. Please try adding an extra selector to enforce the rule in your local Label Studio interface. For example, update your style block to:

    <Style> .htx-text, .lsf-richtext__container.lsf-htx-richtext { white-space: pre-wrap; }</Style>

Thank you,
Abu

Comment by Abubakar Saad
Workflow Run

@khof312
Copy link
Author

khof312 commented Feb 12, 2025

Hi Abu,

Thanks for the suggestion, but it's still not working. I can see that the style is being applied (not overwritten), but still, the interface does not reflect it. I'd appreciate it if you have any other ideas to try...thank you!

Image

@heidi-humansignal
Copy link
Collaborator

Hello,

Try using the !important and see if that works? That is weird how styles is not being applied on in this case.

Thank you,
Abu

Comment by Abubakar Saad
Workflow Run

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

No branches or pull requests

2 participants