Fix new copy driver on pages without a copy button

This commit is contained in:
Starbeamrainbowlabs 2017-12-13 09:48:29 +00:00
parent 0d6e9d4c57
commit 582eda24d7
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
3 changed files with 3 additions and 2 deletions

View File

@ -5375,8 +5375,8 @@ register_module([
// Add the snippet that copies the embed markdown code to the clipboard
page_renderer::AddJSSnippet('window.addEventListener("load", function(event) {
console.log("initialising copy driver");
let button = document.querySelector(".short-embed-markdown-button");
if(button == null) return;
button.addEventListener("click", function(inner_event) {
let input = document.querySelector(".short-embed-markdown-code");
input.select();

View File

@ -122,7 +122,7 @@
"author": "Starbeamrainbowlabs",
"description": "Adds the ability to upload files to Pepperminty Wiki. Uploaded files act as pages and have the special 'File\/' prefix.",
"id": "feature-upload",
"lastupdate": 1513119449,
"lastupdate": 1513158485,
"optional": false
},
{

View File

@ -532,6 +532,7 @@ register_module([
// Add the snippet that copies the embed markdown code to the clipboard
page_renderer::AddJSSnippet('window.addEventListener("load", function(event) {
let button = document.querySelector(".short-embed-markdown-button");
if(button == null) return;
button.addEventListener("click", function(inner_event) {
let input = document.querySelector(".short-embed-markdown-code");
input.select();