mirror of
https://github.com/gradio-app/gradio.git
synced 2024-11-27 01:40:20 +08:00
Add target="_blank" to links in markdown (#4577)
* add DOMPurify afterSanitizeAttributes hook * changelog
This commit is contained in:
parent
8c001ca769
commit
2efa0b27ff
@ -13,6 +13,7 @@
|
||||
- Fix `make_waveform` to work with paths that contain spaces [@akx](https://github.com/akx) in [PR 4567](https://github.com/gradio-app/gradio/pull/4570)
|
||||
- Send captured data in `stop_recording` event for `gr.Audio` and `gr.Video` components by [@freddyaboulton](https://github.com/freddyaboulton) in [PR 4554](https://github.com/gradio-app/gradio/pull/4554)
|
||||
- Fix bug in `gr.Gallery` where `height` and `object_fit` parameters where being ignored by [@freddyaboulton](https://github.com/freddyaboulton) in [PR 4576](https://github.com/gradio-app/gradio/pull/4576)
|
||||
- Fixes an HTML sanitization issue in DOMPurify where links in markdown were not opening in a new window by [@hannahblair] in [PR 4577](https://github.com/gradio-app/gradio/pull/4577)
|
||||
|
||||
## Other Changes:
|
||||
|
||||
|
@ -16,6 +16,13 @@
|
||||
let el: HTMLSpanElement;
|
||||
let mounted = false;
|
||||
|
||||
DOMPurify.addHook("afterSanitizeAttributes", function (node) {
|
||||
if ("target" in node) {
|
||||
node.setAttribute("target", "_blank");
|
||||
node.setAttribute("rel", "noopener noreferrer");
|
||||
}
|
||||
});
|
||||
|
||||
afterUpdate(() => {
|
||||
tick().then(() => {
|
||||
if (message !== old_message) {
|
||||
|
Loading…
Reference in New Issue
Block a user