From 3941bfa989fe81474d5f0648ec2b9e77a13963a3 Mon Sep 17 00:00:00 2001 From: Markus Johansson Date: Sun, 21 Apr 2024 14:40:43 +0200 Subject: [PATCH] Fixes issue with RTE query string links #1674 and ensures #1169 --- .../packages/tiny-mce/plugins/tiny-mce-linkpicker.plugin.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/tiny-mce/plugins/tiny-mce-linkpicker.plugin.ts b/src/Umbraco.Web.UI.Client/src/packages/tiny-mce/plugins/tiny-mce-linkpicker.plugin.ts index 32a04706a2..0536f0347e 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/tiny-mce/plugins/tiny-mce-linkpicker.plugin.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/tiny-mce/plugins/tiny-mce-linkpicker.plugin.ts @@ -72,7 +72,7 @@ export default class UmbTinyMceLinkPickerPlugin extends UmbTinyMcePluginBase { if (this.#anchorElement.href.includes('localLink:')) { const href = this.#anchorElement.getAttribute('href')!; - currentTarget.unique = href.split('localLink:')[1].slice(0, -1); + currentTarget.unique = href.substring(href.indexOf(":") + 1, href.indexOf("}")); } else if (this.#anchorElement.host.length) { currentTarget.url = this.#anchorElement.protocol ? this.#anchorElement.protocol + '//' : undefined; currentTarget.url += this.#anchorElement.host + this.#anchorElement.pathname; @@ -122,7 +122,9 @@ export default class UmbTinyMceLinkPickerPlugin extends UmbTinyMcePluginBase { a.title = name; } - if (this.#linkPickerData?.link.queryString?.startsWith('#')) { + if (this.#linkPickerData?.link.queryString?.startsWith('#') || + this.#linkPickerData?.link.queryString?.startsWith('?')) + { a['data-anchor'] = this.#linkPickerData?.link.queryString; a.href += this.#linkPickerData?.link.queryString; }