MOBILE-2501 course: Retrieve section number from hash in course links

main
Dani Palou 2018-07-31 09:48:13 +02:00
parent e6c5607463
commit fc9835b035
1 changed files with 8 additions and 0 deletions

View File

@ -58,6 +58,14 @@ export class CoreCoursesCourseLinkHandler extends CoreContentLinksHandlerBase {
sectionId: sectionId || null
};
if (!sectionId && !sectionNumber) {
// Check if the URL has a hash to navigate to the section.
const matches = url.match(/#section-(\d+)/);
if (matches && matches[1]) {
sectionNumber = parseInt(matches[1], 10);
}
}
if (!isNaN(sectionNumber)) {
pageParams.sectionNumber = sectionNumber;
}