Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2020-11-12 11:17:29 +0300
committerJulius Härtl <jus@bitgrid.net>2020-11-12 11:18:02 +0300
commite8f73e7dedeac415aeb5e2fbc866a4abecaa8977 (patch)
treec65c0b6a97216b4b97e36c65e52d9e27cedc690f /src/marks/index.js
parente520937bbaccead7226ba97e66acf10af5a93487 (diff)
Validate link before opening
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'src/marks/index.js')
-rw-r--r--src/marks/index.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/marks/index.js b/src/marks/index.js
index 0a719aaca..1b71307d9 100644
--- a/src/marks/index.js
+++ b/src/marks/index.js
@@ -24,6 +24,7 @@ import { Bold, Italic as TipTapItalic, Strike as TipTapStrike, Link as TipTapLin
import { Plugin } from 'tiptap'
import { getMarkAttrs } from 'tiptap-utils'
import { domHref, parseHref } from './../helpers/links'
+import { markdownit } from './../EditorFactory'
/**
* This file maps prosemirror mark names to tiptap classes,
@@ -132,12 +133,16 @@ class Link extends TipTapLink {
// OC.Util.History.pushState('', htmlHref)
}
OCA.Viewer.open({ path })
- } else {
- window.open(htmlHref)
+ return
}
- } else {
- window.open(htmlHref)
}
+
+ if (!markdownit.validateLink(htmlHref)) {
+ console.error('Invalid link', htmlHref)
+ return
+ }
+
+ window.open(htmlHref)
}
},
},