codu-code / codu

Codú's open-source codebase. A space for coders. Visit our community!
https://codu.co/
Apache License 2.0
134 stars 141 forks source link

Editor: Link tag missing _blank att in rendered html #497

Closed xiaoniuniu89 closed 12 months ago

xiaoniuniu89 commented 1 year ago

Context

This is a story of master feature #197 The editor is in components/editor

Expected Behavior

Links should have an _blank attribute so they open in a new tab.

Current Behavior

Links in the editor are fine. Links in rendered html (click preview in the editor) are missing this attr. Likely need to add to the config of Dom purifier in RenderPost.tsx

Steps to reproduce

  1. load the app and go to /alpha/create/new
  2. add a link
  3. click preview
  4. inspect the link in the dev tools, there will be no target="_blank" att.

Additional info

https://www.npmjs.com/package/dompurify#can-i-configure-dompurify

DarrachBarneveld commented 1 year ago

Would like to tackle a few of these editor issues 👍

NiallJoeMaher commented 1 year ago

@DarrachBarneveld could these be split into a separate PR? Thanks 🦾

DarrachBarneveld commented 1 year ago

No problem, will do soon