diff --git a/src/CHANGES.md b/src/CHANGES.md
index fac3aceb..9b17e967 100644
--- a/src/CHANGES.md
+++ b/src/CHANGES.md
@@ -1,5 +1,8 @@
# Development Changes
+## 0.8.12 - 2023-11-20
+* added button `copy to clipboard` to `/serial`
+
## 0.8.11 - 2023-11-20
* improved communication, thx @rejoe2
* improved heuristics, thx @rejoe2, @Oberfritze
diff --git a/src/defines.h b/src/defines.h
index 367b0629..a85053d8 100644
--- a/src/defines.h
+++ b/src/defines.h
@@ -13,7 +13,7 @@
//-------------------------------------
#define VERSION_MAJOR 0
#define VERSION_MINOR 8
-#define VERSION_PATCH 11
+#define VERSION_PATCH 12
//-------------------------------------
typedef struct {
diff --git a/src/web/html/serial.html b/src/web/html/serial.html
index ff25477a..675ee668 100644
--- a/src/web/html/serial.html
+++ b/src/web/html/serial.html
@@ -17,7 +17,7 @@
-
+
@@ -64,12 +64,25 @@
mAutoScroll = !mAutoScroll;
this.value = (mAutoScroll) ? "autoscroll" : "manual scroll";
});
- /*document.getElementById("copy").addEventListener("click", function() {
- con.select();
- con.setSelectionRange(0, 9999999);
- navigator.clipboard.writeText(con.value);
- alert("Copied to clipboard");
- });*/
+ document.getElementById("copy").addEventListener("click", function() {
+ if (window.clipboardData && window.clipboardData.setData) {
+ return window.clipboardData.setData("Text", text);
+ } else if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
+ var ta = document.createElement("textarea");
+ ta.textContent = con.value;
+ ta.style.position = "fixed"; // Prevent scrolling to bottom of page in Microsoft Edge.
+ document.body.appendChild(ta);
+ ta.select();
+ try {
+ return document.execCommand("copy"); // Security exception may be thrown by some browsers.
+ } catch (ex) {
+ alert("Copy to clipboard failed" + ex);
+ } finally {
+ document.body.removeChild(ta);
+ alert("Copied to clipboard");
+ }
+ }
+ });
if (!!window.EventSource) {
var source = new EventSource('/events');