Include the localized page name to the [wsp] id
authorAlexander Ebert <ebert@woltlab.com>
Sat, 15 Dec 2018 19:09:15 +0000 (20:09 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 15 Dec 2018 19:09:15 +0000 (20:09 +0100)
This approach adds the title without conflicting with the custom label feature. It doesn't require any changes to the bbcode class, because `intval()` implicitly strips any non-numeric content that follows a number.

See #2668

com.woltlab.wcf/bbcode.xml
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Search.js

index ca0e209b017711ca11c7fe12874d6a9d6accda03..a9ee4c8622ce68c3766357fb9b9e199fbca7e295 100644 (file)
                        <classname>wcf\system\bbcode\WoltLabSuitePageBBCode</classname>
                        <attributes>
                                <attribute name="0">
-                                       <validationpattern><![CDATA[^\d+$]]></validationpattern>
+                                       <validationpattern><![CDATA[^\d+(?:#.+)$]]></validationpattern>
                                        <required>1</required>
                                </attribute>
                                <attribute name="1">
index 0285719e6f0a152f16f6c56205062091103ffb9f..e996240df981f5c2319e485490612c6128717a78 100644 (file)
@@ -47,7 +47,10 @@ define(['Ajax', 'EventKey', 'Language', 'StringUtil', 'Dom/Util', 'Ui/Dialog'],
                _click: function (event) {
                        event.preventDefault();
                        
-                       _callbackSelect(elData(event.currentTarget, 'page-id'));
+                       var page = event.currentTarget;
+                       var pageTitle = elBySel('h3', page).textContent.replace(/['"]/g, '');
+                       
+                       _callbackSelect(elData(page, 'page-id') + '#' + pageTitle);
                        
                        UiDialog.close(this);
                },