Provide mechanism to get tab click (Fixes #4)
This commit is contained in:
parent
67c857bbed
commit
93800c2706
71
public/assets/scaffolding-min.js
vendored
71
public/assets/scaffolding-min.js
vendored
@ -30,7 +30,7 @@ String.prototype.toPath = function () {
|
|||||||
var font = {
|
var font = {
|
||||||
size: 0
|
size: 0
|
||||||
};
|
};
|
||||||
var copyColourFallback = function copyColourFallback(copyInfo, attr) {
|
var copyFallback = function copyFallback(copyInfo, attr) {
|
||||||
console.log("fallback");
|
console.log("fallback");
|
||||||
var textArea = document.createElement('textarea');
|
var textArea = document.createElement('textarea');
|
||||||
textArea.value = copyInfo;
|
textArea.value = copyInfo;
|
||||||
@ -135,7 +135,6 @@ module.exports = {
|
|||||||
oneClickSelect: function oneClickSelect(e) {
|
oneClickSelect: function oneClickSelect(e) {
|
||||||
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : e.currentTarget;
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : e.currentTarget;
|
||||||
// In here, "this" is the element
|
// In here, "this" is the element
|
||||||
alert("here");
|
|
||||||
var range, selection;
|
var range, selection;
|
||||||
if (window.getSelection) {
|
if (window.getSelection) {
|
||||||
selection = window.getSelection();
|
selection = window.getSelection();
|
||||||
@ -157,10 +156,10 @@ module.exports = {
|
|||||||
navigator.clipboard.writeText(c).then(function () {
|
navigator.clipboard.writeText(c).then(function () {
|
||||||
showMessage("Copied ".concat(w, "."));
|
showMessage("Copied ".concat(w, "."));
|
||||||
}, function (e) {
|
}, function (e) {
|
||||||
copyColourFallback(c, w);
|
copyFallback(c, w);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
copyColourFallback(c, w);
|
copyFallback(c, w);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
positionTooltip: function positionTooltip() {
|
positionTooltip: function positionTooltip() {
|
||||||
@ -179,6 +178,21 @@ module.exports = {
|
|||||||
var b = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
var b = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||||||
return window.getComputedStyle(el, null).getPropertyValue(prop);
|
return window.getComputedStyle(el, null).getPropertyValue(prop);
|
||||||
},
|
},
|
||||||
|
getTabPath: function getTabPath(t) {
|
||||||
|
var url = window.location.toString();
|
||||||
|
url = url.indexOf("?") > 0 ? url.substring(0, url.indexOf("?")) : url;
|
||||||
|
url = "".concat(url, "?p=").concat(t.closest("article").getAttribute("data-path"), "#").concat(t.getAttribute("id"));
|
||||||
|
var type = "URL";
|
||||||
|
if (navigator.clipboard) {
|
||||||
|
navigator.clipboard.writeText(url).then(function () {
|
||||||
|
showMessage("Copied ".concat(type, "."));
|
||||||
|
}, function (e) {
|
||||||
|
copyFallback(url, type);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
copyFallback(url, type);
|
||||||
|
}
|
||||||
|
},
|
||||||
init: function init() {
|
init: function init() {
|
||||||
var args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
var args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||||
var url = getURLVars();
|
var url = getURLVars();
|
||||||
@ -3193,10 +3207,30 @@ var click = new MouseEvent('click', {
|
|||||||
bubbles: false,
|
bubbles: false,
|
||||||
cancelable: true
|
cancelable: true
|
||||||
});
|
});
|
||||||
|
var waitForElement = function waitForElement(selector) {
|
||||||
|
return new Promise(function (resolve) {
|
||||||
|
if (document.querySelector(selector)) {
|
||||||
|
return resolve(document.querySelector(selector));
|
||||||
|
}
|
||||||
|
var observer = new MutationObserver(function (mutations) {
|
||||||
|
if (document.querySelector(selector)) {
|
||||||
|
observer.disconnect();
|
||||||
|
resolve(document.querySelector(selector));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// If you get "parameter 1 is not of type 'Node'" error, see https://stackoverflow.com/a/77855838/492336
|
||||||
|
observer.observe(document.body, {
|
||||||
|
childList: true,
|
||||||
|
subtree: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
function init() {
|
function init() {
|
||||||
var p = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
var container = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
||||||
var s = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
var spacer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
||||||
p.querySelectorAll(".tab-group, tabset").forEach(function (tabGroup) {
|
var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||||
|
container.querySelectorAll(".tab-group, tabset").forEach(function (tabGroup) {
|
||||||
if (tabGroup.querySelector("[role=tablist]") === null) {
|
if (tabGroup.querySelector("[role=tablist]") === null) {
|
||||||
var tabgroup = tabGroup.getAttribute("id");
|
var tabgroup = tabGroup.getAttribute("id");
|
||||||
var tablist = "";
|
var tablist = "";
|
||||||
@ -3219,10 +3253,17 @@ function init() {
|
|||||||
});
|
});
|
||||||
var ul = document.createElement('ul');
|
var ul = document.createElement('ul');
|
||||||
ul.setAttribute("role", "tablist");
|
ul.setAttribute("role", "tablist");
|
||||||
ul.innerHTML = s != true ? "".concat(tablist) : "".concat(tablist, "<li role=\"separator\" class=\"separator\"></li>");
|
ul.innerHTML = spacer != true ? "".concat(tablist) : "".concat(tablist, "<li role=\"separator\" class=\"separator\"></li>");
|
||||||
tabGroup.insertBefore(ul, tabGroup.firstChild);
|
tabGroup.insertBefore(ul, tabGroup.firstChild);
|
||||||
tabGroup.querySelectorAll('[role="tab"]').forEach(function (tab) {
|
tabGroup.querySelectorAll('[role="tab"]').forEach(function (tab) {
|
||||||
tab.addEventListener("click", function () {
|
tab.addEventListener("click", function (e) {
|
||||||
|
if (e.altKey && typeof args.altModifier == "function") {
|
||||||
|
args.altModifier(tab);
|
||||||
|
} else if (e.shiftKey && typeof args.shiftModifier == "function") {
|
||||||
|
args.shiftModifier(tab);
|
||||||
|
} else if (e.metaKey && typeof args.metaModifier == "function") {
|
||||||
|
args.metaModifier(tab);
|
||||||
|
} else {
|
||||||
var siblings = Array.from(tab.parentNode.children);
|
var siblings = Array.from(tab.parentNode.children);
|
||||||
siblings.forEach(function (sibling) {
|
siblings.forEach(function (sibling) {
|
||||||
return sibling.classList.remove("selected");
|
return sibling.classList.remove("selected");
|
||||||
@ -3236,6 +3277,7 @@ function init() {
|
|||||||
});
|
});
|
||||||
var tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel");
|
var tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel");
|
||||||
document.getElementById(tabPanelId).classList.add("open");
|
document.getElementById(tabPanelId).classList.add("open");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
tab.addEventListener("keypress", function (e) {
|
tab.addEventListener("keypress", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@ -3246,7 +3288,10 @@ function init() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (document.location.hash != "" && document.location.hash.substring(0, 5) == "#tab-") {
|
if (document.location.hash != "" && document.location.hash.substring(0, 5) == "#tab-") {
|
||||||
document.querySelector(document.location.hash).dispatchEvent(click);
|
waitForElement(document.location.hash).then(function (el) {
|
||||||
|
el.scrollIntoView();
|
||||||
|
el.dispatchEvent(click);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -3369,10 +3414,12 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// init core
|
// init c
|
||||||
_core_core_js__WEBPACK_IMPORTED_MODULE_0__.init({
|
_core_core_js__WEBPACK_IMPORTED_MODULE_0__.init({
|
||||||
success: function success(a) {
|
success: function success(a) {
|
||||||
_pg_patterns_core_tabs_tabs_js__WEBPACK_IMPORTED_MODULE_9__.init(a);
|
_pg_patterns_core_tabs_tabs_js__WEBPACK_IMPORTED_MODULE_9__.init(a, true, {
|
||||||
|
shiftModifier: _core_core_js__WEBPACK_IMPORTED_MODULE_0__.getTabPath
|
||||||
|
});
|
||||||
_pg_patterns_core_switch_switch_js__WEBPACK_IMPORTED_MODULE_8__.init(a);
|
_pg_patterns_core_switch_switch_js__WEBPACK_IMPORTED_MODULE_8__.init(a);
|
||||||
_pg_patterns_core_sticky_note_sticky_note_js__WEBPACK_IMPORTED_MODULE_7__.init(a);
|
_pg_patterns_core_sticky_note_sticky_note_js__WEBPACK_IMPORTED_MODULE_7__.init(a);
|
||||||
},
|
},
|
||||||
|
@ -24,6 +24,14 @@
|
|||||||
<p>Users should not need to see content of multiple tabs simultaneously and the user should be able to easily recognise where they are within the content. </p>
|
<p>Users should not need to see content of multiple tabs simultaneously and the user should be able to easily recognise where they are within the content. </p>
|
||||||
<h2>How to use it</h2>
|
<h2>How to use it</h2>
|
||||||
<p>The structure of the tab set is defined in html. There are two forms supported. Adding a class of <code class="inline">.tab-group</code> to the container element will work in place of the <code class="inline">tabset</code> tag, and the tab panels can be defined using either <code class="inline">tab=""</code> or <code class="inline">data-tab=""</code>. Passing an optional element to the init function will initialise tabs within that element. </p>
|
<p>The structure of the tab set is defined in html. There are two forms supported. Adding a class of <code class="inline">.tab-group</code> to the container element will work in place of the <code class="inline">tabset</code> tag, and the tab panels can be defined using either <code class="inline">tab=""</code> or <code class="inline">data-tab=""</code>. Passing an optional element to the init function will initialise tabs within that element. </p>
|
||||||
|
<p>The tab initalize function now takes a new function parameter in the form of an third argument is an object that can take the following callbacks: </p>
|
||||||
|
<ul>
|
||||||
|
<li>altModifer (When the altKey is used)</li>
|
||||||
|
<li>shiftModifier (When the shift key is used)</li>
|
||||||
|
<li>metaModifier (When the Windows key or Apple key is used)</li>
|
||||||
|
</ul>
|
||||||
|
<p>You can use these callbacks to create a custom event to get the tab information. </p>
|
||||||
|
<p>Note: There is a new core function (core.getTabPath) that will generate the query string and url hash for use in DS2 Core. You may wish to update your scaffolding.js file to make use of this functionality. </p>
|
||||||
<tabset id="tabs">
|
<tabset id="tabs">
|
||||||
<pre class="language-html" tab="html">
|
<pre class="language-html" tab="html">
|
||||||
<tabset id="uniqueID">
|
<tabset id="uniqueID">
|
||||||
@ -176,9 +184,31 @@ const click = new MouseEvent('click', {
|
|||||||
cancelable: true
|
cancelable: true
|
||||||
});
|
});
|
||||||
|
|
||||||
export function init(p = document, s = true) {
|
const waitForElement = (selector) => {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
if (document.querySelector(selector)) {
|
||||||
|
return resolve(document.querySelector(selector));
|
||||||
|
}
|
||||||
|
|
||||||
p.querySelectorAll(".tab-group, tabset").forEach(tabGroup => {
|
const observer = new MutationObserver(mutations => {
|
||||||
|
if (document.querySelector(selector)) {
|
||||||
|
observer.disconnect();
|
||||||
|
resolve(document.querySelector(selector));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// If you get "parameter 1 is not of type 'Node'" error, see https://stackoverflow.com/a/77855838/492336
|
||||||
|
observer.observe(document.body, {
|
||||||
|
childList: true,
|
||||||
|
subtree: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function init(container = document, spacer = true, args = {}) {
|
||||||
|
|
||||||
|
container.querySelectorAll(".tab-group, tabset").forEach(tabGroup => {
|
||||||
|
|
||||||
if (tabGroup.querySelector("[role=tablist]") === null) {
|
if (tabGroup.querySelector("[role=tablist]") === null) {
|
||||||
const tabgroup = tabGroup.getAttribute("id");
|
const tabgroup = tabGroup.getAttribute("id");
|
||||||
@ -204,11 +234,18 @@ export function init(p = document, s = true) {
|
|||||||
|
|
||||||
const ul = document.createElement('ul');
|
const ul = document.createElement('ul');
|
||||||
ul.setAttribute("role", "tablist");
|
ul.setAttribute("role", "tablist");
|
||||||
ul.innerHTML = s != true ? `${tablist}` : `${tablist}<li role="separator" class="separator"></li>`;
|
ul.innerHTML = spacer != true ? `${tablist}` : `${tablist}<li role="separator" class="separator"></li>`;
|
||||||
tabGroup.insertBefore(ul, tabGroup.firstChild);
|
tabGroup.insertBefore(ul, tabGroup.firstChild);
|
||||||
|
|
||||||
tabGroup.querySelectorAll('[role="tab"]').forEach(tab => {
|
tabGroup.querySelectorAll('[role="tab"]').forEach(tab => {
|
||||||
tab.addEventListener("click", () => {
|
tab.addEventListener("click", (e) => {
|
||||||
|
if (e.altKey && typeof args.altModifier == "function") {
|
||||||
|
args.altModifier(tab);
|
||||||
|
} else if (e.shiftKey && typeof args.shiftModifier == "function") {
|
||||||
|
args.shiftModifier(tab);
|
||||||
|
} else if (e.metaKey && typeof args.metaModifier == "function") {
|
||||||
|
args.metaModifier(tab);
|
||||||
|
} else {
|
||||||
const siblings = Array.from(tab.parentNode.children);
|
const siblings = Array.from(tab.parentNode.children);
|
||||||
siblings.forEach(sibling => sibling.classList.remove("selected"));
|
siblings.forEach(sibling => sibling.classList.remove("selected"));
|
||||||
tab.classList.add("selected");
|
tab.classList.add("selected");
|
||||||
@ -219,6 +256,7 @@ export function init(p = document, s = true) {
|
|||||||
|
|
||||||
const tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel");
|
const tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel");
|
||||||
document.getElementById(tabPanelId).classList.add("open");
|
document.getElementById(tabPanelId).classList.add("open");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -232,7 +270,11 @@ export function init(p = document, s = true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (document.location.hash != "" && document.location.hash.substring(0,5) == "#tab-") {
|
if (document.location.hash != "" && document.location.hash.substring(0,5) == "#tab-") {
|
||||||
document.querySelector(document.location.hash).dispatchEvent(click);
|
waitForElement(document.location.hash).then((el) => {
|
||||||
|
el.scrollIntoView();
|
||||||
|
el.dispatchEvent(click);
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ const font = {
|
|||||||
size: 0
|
size: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
const copyColourFallback = (copyInfo, attr) => {
|
const copyFallback = (copyInfo, attr) => {
|
||||||
console.log("fallback")
|
console.log("fallback")
|
||||||
var textArea = document.createElement('textarea');
|
var textArea = document.createElement('textarea');
|
||||||
textArea.value = copyInfo;
|
textArea.value = copyInfo;
|
||||||
@ -157,10 +157,10 @@ module.exports = {
|
|||||||
navigator.clipboard.writeText(c).then(function() {
|
navigator.clipboard.writeText(c).then(function() {
|
||||||
showMessage(`Copied ${w}.`);
|
showMessage(`Copied ${w}.`);
|
||||||
}, function(e) {
|
}, function(e) {
|
||||||
copyColourFallback(c,w);
|
copyFallback(c,w);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
copyColourFallback(c, w);
|
copyFallback(c, w);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -178,6 +178,23 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
getCSS: (el, prop, b = false) => {
|
getCSS: (el, prop, b = false) => {
|
||||||
return window.getComputedStyle(el, null).getPropertyValue(prop);
|
return window.getComputedStyle(el, null).getPropertyValue(prop);
|
||||||
|
},
|
||||||
|
getTabPath: (t) => {
|
||||||
|
let url = window.location.toString();
|
||||||
|
url = url.indexOf("?") > 0 ? url.substring(0,url.indexOf("?")) : url;
|
||||||
|
url = `${url}?p=${t.closest("article").getAttribute("data-path")}#${t.getAttribute("id")}`
|
||||||
|
let type = "URL";
|
||||||
|
if (navigator.clipboard) {
|
||||||
|
navigator.clipboard.writeText(url).then(function() {
|
||||||
|
showMessage(`Copied ${type}.`);
|
||||||
|
}, function(e) {
|
||||||
|
copyFallback(url,type);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
copyFallback(url, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
init: (args = {}) => {
|
init: (args = {}) => {
|
||||||
const url = getURLVars();
|
const url = getURLVars();
|
||||||
|
@ -12,10 +12,12 @@ import * as stickynote from "../pg/patterns/core/sticky-note/_sticky-note.js";
|
|||||||
import * as swtch from "../pg/patterns/core/switch/_switch.js";
|
import * as swtch from "../pg/patterns/core/switch/_switch.js";
|
||||||
import * as tabs from "../pg/patterns/core/tabs/_tabs.js";
|
import * as tabs from "../pg/patterns/core/tabs/_tabs.js";
|
||||||
|
|
||||||
// init core
|
// init c
|
||||||
core.init({
|
core.init({
|
||||||
success: (a) => {
|
success: (a) => {
|
||||||
tabs.init(a);
|
tabs.init(a, true, {
|
||||||
|
shiftModifier: core.getTabPath,
|
||||||
|
});
|
||||||
swtch.init(a);
|
swtch.init(a);
|
||||||
stickynote.init(a);
|
stickynote.init(a);
|
||||||
},
|
},
|
||||||
|
@ -9,9 +9,31 @@ const click = new MouseEvent('click', {
|
|||||||
cancelable: true
|
cancelable: true
|
||||||
});
|
});
|
||||||
|
|
||||||
export function init(p = document, s = true) {
|
const waitForElement = (selector) => {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
if (document.querySelector(selector)) {
|
||||||
|
return resolve(document.querySelector(selector));
|
||||||
|
}
|
||||||
|
|
||||||
p.querySelectorAll(".tab-group, tabset").forEach(tabGroup => {
|
const observer = new MutationObserver(mutations => {
|
||||||
|
if (document.querySelector(selector)) {
|
||||||
|
observer.disconnect();
|
||||||
|
resolve(document.querySelector(selector));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// If you get "parameter 1 is not of type 'Node'" error, see https://stackoverflow.com/a/77855838/492336
|
||||||
|
observer.observe(document.body, {
|
||||||
|
childList: true,
|
||||||
|
subtree: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function init(container = document, spacer = true, args = {}) {
|
||||||
|
|
||||||
|
container.querySelectorAll(".tab-group, tabset").forEach(tabGroup => {
|
||||||
|
|
||||||
if (tabGroup.querySelector("[role=tablist]") === null) {
|
if (tabGroup.querySelector("[role=tablist]") === null) {
|
||||||
const tabgroup = tabGroup.getAttribute("id");
|
const tabgroup = tabGroup.getAttribute("id");
|
||||||
@ -37,11 +59,18 @@ export function init(p = document, s = true) {
|
|||||||
|
|
||||||
const ul = document.createElement('ul');
|
const ul = document.createElement('ul');
|
||||||
ul.setAttribute("role", "tablist");
|
ul.setAttribute("role", "tablist");
|
||||||
ul.innerHTML = s != true ? `${tablist}` : `${tablist}<li role="separator" class="separator"></li>`;
|
ul.innerHTML = spacer != true ? `${tablist}` : `${tablist}<li role="separator" class="separator"></li>`;
|
||||||
tabGroup.insertBefore(ul, tabGroup.firstChild);
|
tabGroup.insertBefore(ul, tabGroup.firstChild);
|
||||||
|
|
||||||
tabGroup.querySelectorAll('[role="tab"]').forEach(tab => {
|
tabGroup.querySelectorAll('[role="tab"]').forEach(tab => {
|
||||||
tab.addEventListener("click", () => {
|
tab.addEventListener("click", (e) => {
|
||||||
|
if (e.altKey && typeof args.altModifier == "function") {
|
||||||
|
args.altModifier(tab);
|
||||||
|
} else if (e.shiftKey && typeof args.shiftModifier == "function") {
|
||||||
|
args.shiftModifier(tab);
|
||||||
|
} else if (e.metaKey && typeof args.metaModifier == "function") {
|
||||||
|
args.metaModifier(tab);
|
||||||
|
} else {
|
||||||
const siblings = Array.from(tab.parentNode.children);
|
const siblings = Array.from(tab.parentNode.children);
|
||||||
siblings.forEach(sibling => sibling.classList.remove("selected"));
|
siblings.forEach(sibling => sibling.classList.remove("selected"));
|
||||||
tab.classList.add("selected");
|
tab.classList.add("selected");
|
||||||
@ -52,6 +81,7 @@ export function init(p = document, s = true) {
|
|||||||
|
|
||||||
const tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel");
|
const tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel");
|
||||||
document.getElementById(tabPanelId).classList.add("open");
|
document.getElementById(tabPanelId).classList.add("open");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -65,7 +95,11 @@ export function init(p = document, s = true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (document.location.hash != "" && document.location.hash.substring(0,5) == "#tab-") {
|
if (document.location.hash != "" && document.location.hash.substring(0,5) == "#tab-") {
|
||||||
document.querySelector(document.location.hash).dispatchEvent(click);
|
waitForElement(document.location.hash).then((el) => {
|
||||||
|
el.scrollIntoView();
|
||||||
|
el.dispatchEvent(click);
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,15 @@ block content
|
|||||||
+h(2)
|
+h(2)
|
||||||
p The structure of the tab set is defined in html. There are two forms supported. Adding a class of #[code.inline .tab-group] to the container element will work in place of the #[code.inline tabset] tag, and the tab panels can be defined using either #[code.inline tab=""] or #[code.inline data-tab=""]. Passing an optional element to the init function will initialise tabs within that element.
|
p The structure of the tab set is defined in html. There are two forms supported. Adding a class of #[code.inline .tab-group] to the container element will work in place of the #[code.inline tabset] tag, and the tab panels can be defined using either #[code.inline tab=""] or #[code.inline data-tab=""]. Passing an optional element to the init function will initialise tabs within that element.
|
||||||
|
|
||||||
|
p The tab initalize function now takes a new function parameter in the form of an third argument is an object that can take the following callbacks:
|
||||||
|
ul
|
||||||
|
li altModifer (When the altKey is used)
|
||||||
|
li shiftModifier (When the shift key is used)
|
||||||
|
li metaModifier (When the Windows key or Apple key is used)
|
||||||
|
p You can use these callbacks to create a custom event to get the tab information.
|
||||||
|
|
||||||
|
p Note: There is a new core function (core.getTabPath) that will generate the query string and url hash for use in DS2 Core. You may wish to update your scaffolding.js file to make use of this functionality.
|
||||||
|
|
||||||
|
|
||||||
tabset#tabs
|
tabset#tabs
|
||||||
pre.language-html(tab="html")
|
pre.language-html(tab="html")
|
||||||
|
Loading…
Reference in New Issue
Block a user