fix: Sanitize url before opening
This commit is contained in:
@@ -132,7 +132,10 @@ export default class Link extends Mark {
|
|||||||
if (range && range.mark && this.options.onClickLink) {
|
if (range && range.mark && this.options.onClickLink) {
|
||||||
try {
|
try {
|
||||||
const event = new KeyboardEvent("keydown", { metaKey: false });
|
const event = new KeyboardEvent("keydown", { metaKey: false });
|
||||||
this.options.onClickLink(range.mark.attrs.href, event);
|
this.options.onClickLink(
|
||||||
|
sanitizeUrl(range.mark.attrs.href),
|
||||||
|
event
|
||||||
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.editor.props.onShowToast(
|
this.editor.props.onShowToast(
|
||||||
this.options.dictionary.openLinkError
|
this.options.dictionary.openLinkError
|
||||||
@@ -242,7 +245,7 @@ export default class Link extends Mark {
|
|||||||
if (this.options.onClickLink) {
|
if (this.options.onClickLink) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.options.onClickLink(href, event);
|
this.options.onClickLink(sanitizeUrl(href), event);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.editor.props.onShowToast(
|
this.editor.props.onShowToast(
|
||||||
|
|||||||
Reference in New Issue
Block a user