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

Request for help. My product manager has requested to preserve line breaks in SQL expressions, but the content I obtained through parser.sqlify no longer contains any line breaks. #1689

Open
jxh150535011 opened this issue Dec 4, 2023 · 2 comments
Assignees

Comments

@jxh150535011
Copy link

Original requirement: The product manager wants users to input custom expressions, and the frontend performs formatting validation, field validation, and provides shortcuts for syntax input. I have successfully addressed these requirements using this library. For example, when performing field validation, I return the fields in the form of [xx] and later dynamically replace these [xx] with <span title="xx does not exist">xx</span> using regular expressions. Of course, I have taken into account the risk of HTML injection.

Now the problem is, when users input line breaks, for example, some users may input very long expressions and expect to preserve some basic formatting. However, when using sqlify, the line breaks and content indentation are lost. Can you please advise on how to proceed?"

@jxh150535011
Copy link
Author

jxh150535011 commented Dec 4, 2023

原始需求: 产品经理希望让用户输入自定义表达式,前端进行格式校验、字段校验、快捷的语法输入,这些我用这个库都很好的解决了。例如字段校验的时候,我是将字段返回成[xx] 的形式,在后续通过正则来动态替换这些[xx] => <span title="xx does not exist">xx</span>,当然我已经有效的考虑了html注入的风险。` 现在问题是,当用户输入换行符,例如 有些用户在输入表达式的时候可能非常的长,所以期望保留一些基本的格式,这个时候进行 sqlify ,这个换行 或内容缩进就都没了,请问我该怎么办 ”

@cchepelov
Copy link
Contributor

cchepelov#1

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

No branches or pull requests

3 participants