From d566856504676b23975953dfa2996d6406cb6ef7 Mon Sep 17 00:00:00 2001 From: Bryan Rumsey Date: Tue, 27 Jul 2021 17:22:31 -0400 Subject: [PATCH 1/2] Updates to presentation links. Fixed notebook presentations. --- client/app.js | 28 ++++++++++++++++++++++++- client/modals.js | 15 +++---------- client/pages/file-browser.js | 6 +++++- client/pages/loading-page.js | 9 ++++++-- client/templates/pages/loadingPage.pug | 6 +++++- client/views/file-browser-view.js | 6 +++++- client/views/model-state-buttons.js | 6 +++++- stochss/handlers/util/stochss_folder.py | 1 + 8 files changed, 58 insertions(+), 19 deletions(-) diff --git a/client/app.js b/client/app.js index c4db96216a..f2ef090d74 100644 --- a/client/app.js +++ b/client/app.js @@ -212,6 +212,31 @@ documentSetup = () => { }); } +copyToClipboard = (text) => { + if (window.clipboardData && window.clipboardData.setData) { + // Internet Explorer-specific code path to prevent textarea being shown while dialog is visible. + return window.clipboardData.setData("Text", text); + + } + else if (document.queryCommandSupported && document.queryCommandSupported("copy")) { + var textarea = document.createElement("textarea"); + textarea.textContent = text; + textarea.style.display = 'none'; // Prevent scrolling to bottom of page in Microsoft Edge. + document.body.appendChild(textarea); + textarea.select(); + try { + return document.execCommand("copy"); // Security exception may be thrown by some browsers. + } + catch (ex) { + console.warn("Copy to clipboard failed.", ex); + return false; + } + finally { + document.body.removeChild(textarea); + } + } +} + module.exports = { routePrefix: routePrefix, getApiPath: getApiPath, @@ -223,7 +248,8 @@ module.exports = { getXHR: getXHR, postXHR: postXHR, tooltipSetup: tooltipSetup, - documentSetup: documentSetup + documentSetup: documentSetup, + copyToClipboard: copyToClipboard }; diff --git a/client/modals.js b/client/modals.js index b9ccd2ff77..dcc8da5eac 100644 --- a/client/modals.js +++ b/client/modals.js @@ -236,19 +236,10 @@ let templates = {