From a9b43055f57a4ca0ebb1711fe5b612181b5a01f1 Mon Sep 17 00:00:00 2001 From: Vidar Langseid Date: Wed, 5 Jun 2024 15:04:52 +0200 Subject: [PATCH 1/2] IBX-8340: RichText: Not possible to create a link to a custom route --- .../Resources/public/js/CKEditor/link/ui/link-form-view.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bundle/Resources/public/js/CKEditor/link/ui/link-form-view.js b/src/bundle/Resources/public/js/CKEditor/link/ui/link-form-view.js index 7305c492..820916c2 100644 --- a/src/bundle/Resources/public/js/CKEditor/link/ui/link-form-view.js +++ b/src/bundle/Resources/public/js/CKEditor/link/ui/link-form-view.js @@ -205,11 +205,13 @@ class IbexaLinkFormView extends View { } const anchorPrefix = '#'; + const relativeLinkPrefix = '/'; const schemaPattern = /^[a-z0-9]+:\/?\/?/i; const isAnchor = href.indexOf(anchorPrefix) === 0; + const isRelativeLink = href.indexOf(relativeLinkPrefix) === 0; const isLocation = schemaPattern.test(href); - if (isAnchor || isLocation) { + if (isAnchor || isLocation || isRelativeLink) { return href; } From f4d2fabfd507593274a2bbddeb2a6d56e78f5f2a Mon Sep 17 00:00:00 2001 From: Vidar Langseid Date: Tue, 25 Jun 2024 13:09:47 +0200 Subject: [PATCH 2/2] Update src/bundle/Resources/public/js/CKEditor/link/ui/link-form-view.js Co-authored-by: Jakub Brzegowski --- .../Resources/public/js/CKEditor/link/ui/link-form-view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bundle/Resources/public/js/CKEditor/link/ui/link-form-view.js b/src/bundle/Resources/public/js/CKEditor/link/ui/link-form-view.js index 820916c2..4c342bcd 100644 --- a/src/bundle/Resources/public/js/CKEditor/link/ui/link-form-view.js +++ b/src/bundle/Resources/public/js/CKEditor/link/ui/link-form-view.js @@ -208,7 +208,7 @@ class IbexaLinkFormView extends View { const relativeLinkPrefix = '/'; const schemaPattern = /^[a-z0-9]+:\/?\/?/i; const isAnchor = href.indexOf(anchorPrefix) === 0; - const isRelativeLink = href.indexOf(relativeLinkPrefix) === 0; + const isRelativeLink = href.startsWith(relativeLinkPrefix); const isLocation = schemaPattern.test(href); if (isAnchor || isLocation || isRelativeLink) {