Skip to content

renderItem and styled pop-up in Angular 14 #360

Answered by csculley
necrolimb asked this question in Q&A
Discussion options

You must be logged in to vote

I'm not familiar with angular enough to be helpful unfortunately, but instead of returning the string, you can maybe write some JS like this:

const imgElement = document.createElement("img");
imgElement.classList += "ql-mention-list-item-photo";
imgElement.src = elem.imageLink;
const divElement = document.createElement("div");
divElement.innerText = elem.value;
return [imgElement, divElement];

This way, someone can't create an elem.imageLink or elem.value that could escape the string and start trying to execute code, but I'm not sure how to better plug those Node elements into angular :(

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by csculley
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #359 on January 16, 2024 16:12.