From 771f11ee90cd42d7c4294c17aec365a242bf2334 Mon Sep 17 00:00:00 2001 From: ogerly Date: Sun, 15 May 2022 09:44:15 +0200 Subject: [PATCH 1/4] replace hashtag in d.tube url --- webapp/components/Editor/plugins/eventHandler.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/webapp/components/Editor/plugins/eventHandler.js b/webapp/components/Editor/plugins/eventHandler.js index 4e2448d23..053c54152 100644 --- a/webapp/components/Editor/plugins/eventHandler.js +++ b/webapp/components/Editor/plugins/eventHandler.js @@ -11,6 +11,10 @@ export default class EventHandler extends Extension { new Plugin({ props: { transformPastedText(text) { + // remove hashtag from d.tube url + if ( text.search(/d.tube/) > 0) { + text = text.replace(/\/#!\//gim, '/') + } return text.trim() }, transformPastedHTML(html) { From 61679549d26ca381c6712aa9cca2ea0548ea9477 Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 22 Jun 2022 11:01:28 +0200 Subject: [PATCH 2/4] add comment for general hashtag in link is not the problem --- webapp/components/Editor/nodes/Hashtag.js | 2 +- webapp/components/Editor/plugins/eventHandler.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/webapp/components/Editor/nodes/Hashtag.js b/webapp/components/Editor/nodes/Hashtag.js index d591c3e30..0c616984a 100644 --- a/webapp/components/Editor/nodes/Hashtag.js +++ b/webapp/components/Editor/nodes/Hashtag.js @@ -8,7 +8,7 @@ export default class Hashtag extends TipTapMention { get defaultOptions() { return { matcher: { - char: '#', + char: '=', allowSpaces: false, startOfLine: false, }, diff --git a/webapp/components/Editor/plugins/eventHandler.js b/webapp/components/Editor/plugins/eventHandler.js index 053c54152..24f4d3f35 100644 --- a/webapp/components/Editor/plugins/eventHandler.js +++ b/webapp/components/Editor/plugins/eventHandler.js @@ -11,7 +11,10 @@ export default class EventHandler extends Extension { new Plugin({ props: { transformPastedText(text) { - // remove hashtag from d.tube url + /* remove hashtag from d.tube url + * hashtags in url general are not a problem because the following link work like expected: + * http://www.nsosp.org/de/Quanten-Fluss-Theorie/index.php#OM:FrQFT:Home:Inhalt + */ if ( text.search(/d.tube/) > 0) { text = text.replace(/\/#!\//gim, '/') } From 652fdcca5ccc93846a241471bcebbd8b664c3636 Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 22 Jun 2022 11:03:32 +0200 Subject: [PATCH 3/4] yarn lint --- webapp/components/Editor/plugins/eventHandler.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/webapp/components/Editor/plugins/eventHandler.js b/webapp/components/Editor/plugins/eventHandler.js index 24f4d3f35..1d823491a 100644 --- a/webapp/components/Editor/plugins/eventHandler.js +++ b/webapp/components/Editor/plugins/eventHandler.js @@ -12,11 +12,11 @@ export default class EventHandler extends Extension { props: { transformPastedText(text) { /* remove hashtag from d.tube url - * hashtags in url general are not a problem because the following link work like expected: + * hashtags in url general are not a problem because the following link work like expected: * http://www.nsosp.org/de/Quanten-Fluss-Theorie/index.php#OM:FrQFT:Home:Inhalt - */ - if ( text.search(/d.tube/) > 0) { - text = text.replace(/\/#!\//gim, '/') + */ + if (text.search(/d.tube/) > 0) { + text = text.replace(/\/#!\//gim, '/') } return text.trim() }, From c92d437723bb0ef1b131a369705ef60627676edd Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 22 Jun 2022 11:05:40 +0200 Subject: [PATCH 4/4] change hashtag test from = to # --- webapp/components/Editor/nodes/Hashtag.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/components/Editor/nodes/Hashtag.js b/webapp/components/Editor/nodes/Hashtag.js index 0c616984a..d591c3e30 100644 --- a/webapp/components/Editor/nodes/Hashtag.js +++ b/webapp/components/Editor/nodes/Hashtag.js @@ -8,7 +8,7 @@ export default class Hashtag extends TipTapMention { get defaultOptions() { return { matcher: { - char: '=', + char: '#', allowSpaces: false, startOfLine: false, },