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

How to add a line break in a string field #1145

Open
JesusMartinAlonso opened this issue May 2, 2019 · 7 comments
Open

How to add a line break in a string field #1145

JesusMartinAlonso opened this issue May 2, 2019 · 7 comments
Labels
First-Good-Issue First Good Issue - Relatively easy issue for new contributers O-Community T-Enhancement

Comments

@JesusMartinAlonso
Copy link

JesusMartinAlonso commented May 2, 2019

Is your feature request related to a problem? Please describe.
I want to add strings with line breaks. I have tried to copy the text (with line breaks) from a text editor but it doesn't work. Also I tried to add a "\n" but neither works.

Describe the solution you'd like
A way to enter line breaks in strings fields

Describe alternatives you've considered
Maybe a combination of alt + enter keys

Additional context
Realm Studio Mac OS 3.5.0

@bmunkholm bmunkholm added First-Good-Issue First Good Issue - Relatively easy issue for new contributers T-Enhancement labels May 6, 2019
@cliftonlabrum
Copy link

@JesusMartinAlonso Is your intent to just be able to see the line breaks in Realm Studio? Or do you need to be able to detect and display a line break using the string in your application?

I've stored Markdown in a string field before, and the line breaks are preserved when I pull the string out of Realm and render the text.

@JesusMartinAlonso
Copy link
Author

Thanks for your reply

What I need is to paste a text in a string field in Realm Studio preserving line breaks of the original text. I've tested again for Realm Studio Mac OS 3.6.1. and unfortunately is not working. You can test yourself:

1.- Create a multiline text in your favorite editor text. For example:

Test with

line breaks created


to test Realm Studio

2.- Copy/Paste to a string field of your realm database opened in Realm Studio

3.-Line breaks are removed.

If you copy the text from realm to the editor you can see that the whole text is displayed in one line.
If you run your app the result is the same.
Test with line breaks created to test Realm Studio

@kraenhansen
Copy link
Member

From a quick Googling, it looks to me as a single-row textarea element is the easiest way to achieve this behaviour. We could change https://github.com/realm/realm-studio/blob/master/src/ui/RealmBrowser/Content/Table/types/StringCell/StringCell.tsx#L46 to use the <Input type="textarea" ... (see https://reactstrap.github.io/components/form/) and ensure the rows attribute is set to "1" and the resize CSS property is set to none.

@roberhofer
Copy link

Seems there is a related issue: #1162

@Shefto
Copy link

Shefto commented Sep 6, 2019

Workaround for me has been to do this using Realm Browser which can handle the line breaks, but I would prefer to be able to do this in Studio also.

@JesusMartinAlonso
Copy link
Author

Hi @Shefto! Thanks for your contribution! I will give it a try.
Hope there is a fix for this issue soon

@bmunkholm
Copy link
Contributor

We love contributions if anyone would like to ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-Good-Issue First Good Issue - Relatively easy issue for new contributers O-Community T-Enhancement
Projects
None yet
Development

No branches or pull requests

8 participants