diff --git a/dom.js b/dom.js index 88aa258..9191218 100644 --- a/dom.js +++ b/dom.js @@ -193,10 +193,11 @@ class ASN1DOM extends ASN1 { }; // handler to copy the complete hex dump into the clipboard node.onclick = function (event) { - const pos = parseInt(this.getAttribute('pos')); - const end = parseInt(this.getAttribute('end')); - const hex = this.asn1.buf2hex(window.derBuffer.subarray(pos, end)); - navigator.clipboard.writeText(hex); + let contextMenu = document.getElementById('contextmenu'); + contextMenu.style.left = event.clientX + "px"; + contextMenu.style.top = event.clientY + "px"; + contextMenu.style.visibility = 'visible'; + document.getElementById('contextmenu').node = this; event.stopPropagation(); }; if (root == node) { diff --git a/index.css b/index.css index c57b12d..d858361 100644 --- a/index.css +++ b/index.css @@ -212,3 +212,23 @@ header { #dump .hexCurrent .dlen { color: #004040; } #file { display: none; } #area { width: 100%; } + +#contextmenu { + position: absolute; + top: 0; + left: 0; + padding: 2px; + background-color: var(--button-bg-color); + border: 1px solid var(--button-bg-color); + z-index: 2; +} + +#contextmenu > button { + width: 120px; + background-color: var(--button-bg-color); + color: var(--main-text-color); + border: 1px solid var(--button-border-color); +} +#contextmenu > button:hover { + background-color: var(--button-bghover-color); +} diff --git a/index.html b/index.html index 7b7a9f3..3691676 100644 --- a/index.html +++ b/index.html @@ -8,6 +8,7 @@
+