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

Line break (\n) as delimiter #160

Closed
eav93 opened this issue Dec 6, 2018 · 6 comments
Closed

Line break (\n) as delimiter #160

eav93 opened this issue Dec 6, 2018 · 6 comments

Comments

@eav93
Copy link

eav93 commented Dec 6, 2018

Hello, I want set \n as delimiter, but you remove this elements on "normalize".

@yairEO
Copy link
Owner

yairEO commented Dec 8, 2018

Why would you want tags to be in a vertical list layout instead of horizontal "bricks" layout?

@eav93
Copy link
Author

eav93 commented Dec 8, 2018

i want divide text with /n on paste, to horizontal tags list.

@yairEO
Copy link
Owner

yairEO commented Dec 8, 2018

I was thinking about this for the past 2 hours and I really don't have a good solution.

The \s regex in normalize is intended to cleanup any new lines, tabs and spaces.
These things are 99% of the time more unwanted than wanted (like in your case) so, removing this cleanup process will cause, in my opinion, more harm than good.

Why are you pasting a string which has new lines? this should be corrected at the source if possible, or at maybe replace the delimiter to a comma or something.

@yairEO
Copy link
Owner

yairEO commented Feb 19, 2019

Fixed. Now you can input things such as:

aaa
bbb
ccc

The way it works is by doing this trick:

replace(/(?:\r\n|\r|\n)/g, this.settings.delimiters.source.charAt(1))

which replaces new lines with the first delimiter specified (if one was specified)

@eav93
Copy link
Author

eav93 commented Jun 29, 2019

Now, delimiters are regular expressions. When I set
{delimiters: ',|;'}
this.settings.delimiters.source.charAt(1)=='|'

@yairEO yairEO changed the title Line break (\n) as delimetr Line break (\n) as delimiter Nov 28, 2019
@yairEO
Copy link
Owner

yairEO commented Aug 5, 2020

To have multi-line pasted text become multiple tags, the delimiters setting should be as follows:

delimiters: ",|\n|\r"

It's imperative to use both \n & \r

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