From 672a2f33d06a1be412a21d9903bd3c66fd0b972d Mon Sep 17 00:00:00 2001 From: "lina.wolf" Date: Mon, 22 Sep 2025 16:18:58 +0200 Subject: [PATCH] [BUGFIX] Reuse short links in link reference modal The short link in rst was displayed with a slash, while it was in general displayed without This caused error: https://forge.typo3.org/issues/107519 --- .../assets/js/link-reference-modal.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/typo3-docs-theme/assets/js/link-reference-modal.js b/packages/typo3-docs-theme/assets/js/link-reference-modal.js index d74d4fe4b..024c1840c 100644 --- a/packages/typo3-docs-theme/assets/js/link-reference-modal.js +++ b/packages/typo3-docs-theme/assets/js/link-reference-modal.js @@ -22,7 +22,7 @@ function generateShortUri(linkReferenceModal, section, headerText, rstAnchor, filename) { const urlPrefix = 'https://docs.typo3.org/permalink/'; const interlinkTarget = linkReferenceModal.dataset.interlinkShortcode || 'somemanual'; - // Replaces a link like "typo3/cms-sys-note" to "typo3-cms-sys-note" (https://docs.typo3.org/permalink/typo3-cms-sys-note:for-editors) + // Replaces a link like "typo3/cms-sys-note" to "typo3-cms-sys-note" const adjustedInterlinkTarget = interlinkTarget.replaceAll('/', '-', interlinkTarget); if (rstAnchor) { @@ -37,14 +37,10 @@ } function generateRstLink(linkReferenceModal, section, headerText, rstAnchor, filename) { - const interlinkTarget = linkReferenceModal.dataset.interlinkShortcode || 'somemanual'; - if (rstAnchor) { - return `\`${headerText} \`_`; - } - if (filename === '') { - return ''; - } - return `:doc:\`${headerText} <${interlinkTarget}:${filename}#${section?.id || ''}>\``; + const url = generateShortUri(linkReferenceModal, section, headerText, rstAnchor, filename); + if (!url) return ''; + // Always use the permalink produced by generateShortUri + return `\`${headerText} <${url}>\`_`; } function showHideRstAnchorAlert(linkReferenceModal, rstAnchor) {