forked from GitSquared/edex-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclipboardButtons.class.js
More file actions
28 lines (24 loc) · 968 Bytes
/
Copy pathclipboardButtons.class.js
File metadata and controls
28 lines (24 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class ClipboardButtons {
constructor(parentId) {
if (!parentId) throw "Missing parameters";
// Create DOM
this.parent = document.getElementById(parentId);
this._element = document.createElement("div");
this._element.setAttribute("id", "mod_clipboardButtons");
this._element.innerHTML = `<div id="mod_clipboardButtons_inner">
<h1>CLIPBOARD ACCESS</h1>
<div>COPY</div>
<div>PASTE</div>
</div>`;
this.parent.append(this._element);
document.querySelector("div#mod_clipboardButtons_inner > div:nth-child(2)").addEventListener("click", e => {
window.term[window.currentTerm].clipboard.copy();
});
document.querySelector("div#mod_clipboardButtons_inner > div:last-child").addEventListener("click", e => {
window.term[window.currentTerm].clipboard.paste();
});
}
}
module.exports = {
ClipboardButtons
};