Add open new page when configuring the menu
This commit is contained in:
8
app.js
8
app.js
@ -36,14 +36,20 @@ function loadMenuItems() {
|
||||
const menuItems = [];
|
||||
const titleRegex = /<!--\s*title:\s*(.*?)\s*-->/g;
|
||||
const urlRegex = /<!--\s*url:\s*(.*?)\s*-->/g;
|
||||
const openNewPageRegex = /<!--\s*openNewPage\s*-->/g;
|
||||
|
||||
let titleMatch;
|
||||
let urlMatch;
|
||||
let openNewPageMatch;
|
||||
|
||||
// Use a loop to find and process each menu item
|
||||
while ((titleMatch = titleRegex.exec(content)) && (urlMatch = urlRegex.exec(content))) {
|
||||
openNewPageMatch = openNewPageRegex.exec(content);
|
||||
|
||||
menuItems.push({
|
||||
title: titleMatch[1],
|
||||
url: urlMatch[1]
|
||||
url: urlMatch[1],
|
||||
openNewPage: openNewPageMatch !== null // If openNewPage exists, set it to true
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user