From 8093fece005fc910a9df00495a5e67baa1c4414f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 5 Aug 2019 12:55:10 +0200 Subject: [PATCH] Update URL regex taking e.g. "?" into account --- webapp/components/Editor/nodes/Embed.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webapp/components/Editor/nodes/Embed.js b/webapp/components/Editor/nodes/Embed.js index 8c8281f94..0a12e06ef 100644 --- a/webapp/components/Editor/nodes/Embed.js +++ b/webapp/components/Editor/nodes/Embed.js @@ -24,7 +24,8 @@ export default class Embed extends Node { pasteRules({ type, schema }) { return [ pasteRule( - /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-zA-Z]{2,}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/g, + // source: https://stackoverflow.com/a/3809435 + /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/g, type, url => ({ dataEmbedUrl: url }), ),