-
Notifications
You must be signed in to change notification settings - Fork 1
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
Ignore HTML tags? #2
Comments
Hi @tomer953 !
If you don't care to add them as native, just use
If you just use a textarea and not some kind of richt text editor, your text contents will always be text only, so I'm not sure, what you're getting at there...? 🤔 But of course when displaying them, you will have to escape html before passing it on to |
Thanks, I will try to explain the flow again, the components are:
now I try to solve the following problem: the actual challenge is what is the best solution to save the message in the db, so you can render it correctly to other users. I'm trying to think about a good flow to do so, maybe:
OR, maybe just use rich-text-editor instead of the textbox, and directly store the innerHTML ? |
Hm... Well its seems like this is still more of a question of what you want to provide for your audience (or - if there's a customer - what they requested). 🤔 Editing part (When creating/editing texts containing emojis):Do you want/need to 1. display sprites or are 2. you satisfied using native emojis? in case of 1) You'll need the user to type in a In neither case can I think of a use case where you'd want to use the Storing part (When transmitting the data to the server and serializing it):Option 1 Why?: When rendering them, you might want to change their layout/sprite set at some point in the future without having to create a complex DB migration that needs to alter the contained html itself. (If you - to provide a stupid example - have something like The second advantage of course is, that you'd also be able to display a text-only (no-sprites) version of your text later on, should you ever need to. To convert sprites to unicode (If you have chosen 1 in the "editing part") you need to generate sprites that retain the unicode representation in the html (e.g. as hidden text content - see this code for example), so you can replace the sprite html with the unicode emoji when transmitting the data to the backend. Option2 Displaying part (When showing texts including emojis, that were stored in the DB in the frontend):
|
Hey,
a little background, I have a simple chat application,
right now I support only native emojis, because I save the user input in the db as: "text: string",
then I show in the chat:
<div> {{ message.text }} </div>
now, if I want to support all the different emojis set, I believe I need to save the message not as a simple string but as html,
or generate some unique pattern like "hello world {{emojiId:set:tone:size}}...." then use regex to replace.
I find it a bit confusing, then I saw your pipe - it seems to solve my problem, but it cause a new problem:
now my input is capable of sending html tags, so users can abuse it (ie, use styles and font-size 100px etc)
Do you have idea, how to:
The text was updated successfully, but these errors were encountered: