Skip to content

Commit 2ff6cf5

Browse files
authored
Merge pull request #3542 from giabaio/main
Open external links in navbar in a new tab
2 parents 63847e2 + 31b2b85 commit 2ff6cf5

9 files changed

Lines changed: 39 additions & 11 deletions

File tree

‎src/resources/editor/tools/vs-code.mjs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8339,6 +8339,11 @@ var require_yaml_intelligence_resources = __commonJS({
83398339
string: {
83408340
description: "Value for rel attribute. Multiple space-separated values are permitted.\nSee <https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel>\nfor a details.\n"
83418341
}
8342+
},
8343+
target: {
8344+
string: {
8345+
description: "Value for the target attribute.\n\nSee <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-target>\nfor details.\n"
8346+
}
83428347
}
83438348
}
83448349
}

‎src/resources/editor/tools/yaml/web-worker.js‎

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/resources/editor/tools/yaml/yaml-intelligence-resources.json‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,12 @@
13131313
},
13141314
"rel": {
13151315
"string": {
1316-
"description": "Value for rel attribute. Multiple space-separated values are permitted.\nSee <https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel>\nfor a details.\n"
1316+
"description": "Value for rel attribute. Multiple space-separated values are permitted.\nSee <https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel>\nfor details.\n"
1317+
}
1318+
},
1319+
"target": {
1320+
"string": {
1321+
"description": "Value for target attribute.\nSee <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-target>\nfor details.\n"
13171322
}
13181323
}
13191324
}
@@ -10761,6 +10766,7 @@
1076110766
"Text to display for item (defaults to the document title if not\nprovided)",
1076210767
"Alias for href",
1076310768
"Value for rel attribute. Multiple space-separated values are\npermitted. See <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel\" class=\"uri\">https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel</a>\nfor a details.",
10769+
"Value for target attribute.\n See <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-target\" class=\"uri\">https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel</a>\nfor details.",
1076410770
"The Github repo that will be used to store comments.",
1076510771
"The label that will be assigned to issues created by Utterances.",
1076610772
{
@@ -13802,4 +13808,4 @@
1380213808
"description": "Information about the funding of the research reported in the article \n(for example, grants, contracts, sponsors) and any open access fees for the article itself\n"
1380313809
}
1380413810
]
13805-
}
13811+
}

‎src/resources/formats/html/templates/quarto-html.ejs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
386386
return filterRegex.test(href) || localhostRegex.test(href);
387387
}
388388
// Inspect non-navigation links and adorn them if external
389-
var links = window.document.querySelectorAll('a:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item)');
389+
var links = window.document.querySelectorAll('a:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item)');
390390
for (var i=0; i<links.length; i++) {
391391
const link = links[i];
392392
if (!isInternal(link.href)) {
@@ -412,4 +412,4 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
412412
});
413413
414414
</script>
415-
<% } %>
415+
<% } %>

‎src/resources/projects/website/about/_links.ejs.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<% if (about.links) { %>
22
<div class="about-links">
33
<% for (const link of about.links) { %>
4-
<a href="<%= link.href %>" class="about-link" rel="<%= link.rel %>">
4+
<a href="<%= link.href %>" class="about-link" rel="<%= link.rel %>" target="<%= link.target %>">
55
<% if (link.icon) { %>
66
<i class="bi <%= link.icon %>"></i>
77
<% } %> <span class="about-link-text"><%= link.text %></span>

‎src/resources/projects/website/templates/navitem-dropdown.ejs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
<% if (item.href) { %>
44
<li>
5-
<a class="dropdown-item" href="<%- item.href %>" rel="<%- item.rel %>"><% partial('navicon.ejs', { item }) %> <span class="dropdown-text"><%- item.text %></span></a>
5+
<a class="dropdown-item" href="<%- item.href %>" rel="<%- item.rel %>" target="<%- item.target %>"><% partial('navicon.ejs', { item }) %> <span class="dropdown-text"><%- item.text %></span></a>
66
</li>
77
<% } else if (item.menu) { %>
88
<li class="dropdown">
9-
<a class="dropdown-toggle" href="#" id="<%- item.id %>" role="button" data-bs-toggle="dropdown" aria-expanded="false" rel="<%= item.rel %>">
9+
<a class="dropdown-toggle" href="#" id="<%- item.id %>" role="button" data-bs-toggle="dropdown" aria-expanded="false" rel="<%= item.rel %>" target="<% item.target %>">
1010
<% partial('navicon.ejs', { item }) %> <%- item.text %>
1111
</a>
1212
<ul class="dropdown-menu" aria-labelledby="<%- item.id %>">

‎src/resources/projects/website/templates/navitem.ejs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
<% if (item.href) { %>
44
<li class="nav-item<%- item.text === undefined ? ' compact' : '' %>">
5-
<a class="nav-link" href="<%- item.href %>" rel="<%- item.rel %>"><% partial('navicon.ejs', { item }) %> <span class="menu-text"><%- item.text %></span></a>
5+
<a class="nav-link" href="<%- item.href %>" rel="<%- item.rel %>" target="<%- item.target %>"><% partial('navicon.ejs', { item }) %> <span class="menu-text"><%- item.text %></span></a>
66
</li>
77
<% } else if (item.menu) { %>
88
<li class="nav-item dropdown <%- item.text === undefined ? ' compact' : '' %>">
9-
<a class="nav-link dropdown-toggle" href="#" id="<%- item.id %>" role="button" data-bs-toggle="dropdown" aria-expanded="false" rel="<%= item.rel %>">
9+
<a class="nav-link dropdown-toggle" href="#" id="<%- item.id %>" role="button" data-bs-toggle="dropdown" aria-expanded="false" rel="<%= item.rel %>" target="<%= item.target %>">
1010
<% partial('navicon.ejs', { item }) %> <span class="menu-text"><%- item.text %></span>
1111
</a>
1212
<ul class="dropdown-menu<%- align === 'end' ? ' dropdown-menu-end' : ''%>" aria-labelledby="<%- item.id %>">

‎src/resources/schema/definitions.yml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,13 @@
132132
Value for rel attribute. Multiple space-separated values are permitted.
133133
See <https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel>
134134
for a details.
135-
135+
target:
136+
string:
137+
description: |
138+
Value for target attribute.
139+
See <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-target>
140+
for details.
141+
136142
- id: comments
137143
anyOf:
138144
- enum: [false]

‎src/resources/types/schema-types.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ See <https://icons.getbootstrap.com/> for a list of available icons */;
7575
string /* Value for rel attribute. Multiple space-separated values are permitted.
7676
See <https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel>
7777
for a details. */;
78-
text?: string /* Text to display for item (defaults to the
78+
target?:
79+
string /* Value for target attribute.
80+
See <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-target>
81+
for a details. */;
82+
text?: string /* Text to display for item (defaults to the
7983
document title if not provided) */;
8084
url?: string; /* Alias for href */
8185
};

0 commit comments

Comments
 (0)