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

Fix html tags in blog post #16314

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

ChaseNelson
Copy link
Contributor

@ChaseNelson ChaseNelson commented Nov 1, 2024

Resolves: #16256

Uses CSS to hide the write / preview button container in the markdown editor
image

@kraktus
Copy link
Member

kraktus commented Nov 2, 2024

Hey, thanks for the PR! Reading back my comment I see how I could be misread, but we do not want to support arbitrary HTML in blog post due to security/XSS concern. We rather want to disable the preview WYSIWYG editor.

@ChaseNelson
Copy link
Contributor Author

Hey @kraktus! That make sense. I updated the toast-ui editor styling to hide the write/preview button container, since the editor does not have an option to disable the preview tab.

@kraktus
Copy link
Member

kraktus commented Nov 4, 2024

Thanks! That's better already, can we just hide HTML rendering in the preview instead of the preview altogether?

@ChaseNelson
Copy link
Contributor Author

Updated to escape html tags when the preview button is clicked.

https://www.loom.com/share/ab90f5980905400687be3a426ca16b61?sid=e5743dad-9131-4b03-a10a-632c22447251

@ornicar
Copy link
Collaborator

ornicar commented Nov 9, 2024

I think it's weird that clicking "preview" effectively modifies the text. I would expect a preview to be without side effects.

@kraktus
Copy link
Member

kraktus commented Nov 12, 2024

I was hoping an option to disable html preview in toastui-editor options, but judging by nhn/tui.editor#679 it does not seem possible and should really be something fixed at this level

@kraktus
Copy link
Member

kraktus commented Nov 12, 2024

Actually maybe looking at customHTMLSanitizer https://nhn.github.io/tui.editor/latest/ToastUIEditorViewer would be worth it

@ChaseNelson
Copy link
Contributor Author

The customHTMLSanitizer does not affect the WYSIWYG editor. So if you add an image tag in the Markdown editor and then switch to the WYSIWYG editor the image will appear regardless of whatever filtering the customHTMLSanitizer is doing.

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

Successfully merging this pull request may close these issues.

Discrepancy between Preview and final result in Blogs
3 participants