Add copy to clipboard for debug text and some bug fixes

This commit is contained in:
John R. Supplee 2021-12-20 14:33:42 +02:00
parent 94525a4d3d
commit 49214747cd
4 changed files with 45 additions and 9 deletions

View file

@ -46,11 +46,19 @@ template(name="globalSearch")
h1 Debug
if debug.get.showSelector
h2 Selector
pre
button.js-copy-debug-selector
= 'Copy'
pre(
id="debug-selector"
)
= sessionData.selector
if debug.get.showProjection
h2 Projection
pre
button.js-copy-debug-projection
= 'Copy'
pre(
id="debug-projection"
)
= sessionData.projection
if searching.get
+spinner

View file

@ -222,6 +222,30 @@ class GlobalSearchComponent extends CardSearchPagedComponent {
);
document.getElementById('global-search-input').focus();
},
'click .js-copy-debug-selector'(evt) {
/* Get the text field */
const selector = document.getElementById("debug-selector");
try {
navigator.clipboard.writeText(selector.textContent);
alert("Selector copied to clipboard");
} catch(err) {
alert("Error copying text: " + err);
}
},
'click .js-copy-debug-projection'(evt) {
/* Get the text field */
const projection = document.getElementById("debug-projection");
try {
navigator.clipboard.writeText(projection.textContent);
alert("Projection copied to clipboard");
} catch(err) {
alert("Error copying text: " + err);
}
},
'click .js-board-title'(evt) {
evt.preventDefault();
const input = document.getElementById('global-search-input');