From c22443294eacdfbc26d4aee4e5ae0db94cbc6d37 Mon Sep 17 00:00:00 2001 From: Markus Klein <markus.klein@typo3.org> Date: Fri, 3 Apr 2020 22:30:22 +0200 Subject: [PATCH] [BUGFIX] Convert page UID to proper link syntax in LinkBrowser If the pageIdSelector feature is enabled for the RTE the entered page UID needs to be formatted with correct link syntax. Resolves: #82942 Releases: master, 9.5 Change-Id: I93bc583ba279d0bde549582388791fc48150d933 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64064 Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de> Tested-by: Josef Glatz <josefglatz@gmail.com> Tested-by: TYPO3com <noreply@typo3.com> Tested-by: Georg Ringer <georg.ringer@gmail.com> Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de> Reviewed-by: Josef Glatz <josefglatz@gmail.com> Reviewed-by: Georg Ringer <georg.ringer@gmail.com> --- .../Resources/Public/TypeScript/PageLinkHandler.ts | 8 +++++++- .../Resources/Public/JavaScript/PageLinkHandler.js | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/PageLinkHandler.ts b/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/PageLinkHandler.ts index 4d5c64eb3e4e..2e4812b990ac 100644 --- a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/PageLinkHandler.ts +++ b/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/PageLinkHandler.ts @@ -45,11 +45,17 @@ class PageLinkHandler { public linkPageByTextfield = (event: JQueryEventObject): void => { event.preventDefault(); - const value = $('#luid').val(); + let value = $('#luid').val(); if (!value) { return; } + // make sure we use proper link syntax if this is an integer only + const valueAsNumber = parseInt(value, 10); + if (!isNaN(valueAsNumber)) { + value = 't3://page?uid=' + valueAsNumber; + } + LinkBrowser.finalizeFunction(value); } diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/PageLinkHandler.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/PageLinkHandler.js index 628b6ff45126..30e86ae3202c 100644 --- a/typo3/sysext/recordlist/Resources/Public/JavaScript/PageLinkHandler.js +++ b/typo3/sysext/recordlist/Resources/Public/JavaScript/PageLinkHandler.js @@ -10,4 +10,4 @@ * * The TYPO3 project - inspiring people to share! */ -define(["require","exports","jquery","./LinkBrowser"],(function(n,t,i,e){"use strict";return new class{constructor(){this.currentLink="",this.linkPage=n=>{n.preventDefault(),e.finalizeFunction(i(n.currentTarget).attr("href"))},this.linkPageByTextfield=n=>{n.preventDefault();const t=i("#luid").val();t&&e.finalizeFunction(t)},this.linkCurrent=n=>{n.preventDefault(),e.finalizeFunction(this.currentLink)},i(()=>{this.currentLink=i("body").data("currentLink"),i("a.t3js-pageLink").on("click",this.linkPage),i("input.t3js-linkCurrent").on("click",this.linkCurrent),i("input.t3js-pageLink").on("click",this.linkPageByTextfield)})}}})); \ No newline at end of file +define(["require","exports","jquery","./LinkBrowser"],(function(t,n,i,e){"use strict";return new class{constructor(){this.currentLink="",this.linkPage=t=>{t.preventDefault(),e.finalizeFunction(i(t.currentTarget).attr("href"))},this.linkPageByTextfield=t=>{t.preventDefault();let n=i("#luid").val();if(!n)return;const r=parseInt(n,10);isNaN(r)||(n="t3://page?uid="+r),e.finalizeFunction(n)},this.linkCurrent=t=>{t.preventDefault(),e.finalizeFunction(this.currentLink)},i(()=>{this.currentLink=i("body").data("currentLink"),i("a.t3js-pageLink").on("click",this.linkPage),i("input.t3js-linkCurrent").on("click",this.linkCurrent),i("input.t3js-pageLink").on("click",this.linkPageByTextfield)})}}})); \ No newline at end of file -- GitLab