Skip to content

Commit

Permalink
FIX COPY-PASTE
Browse files Browse the repository at this point in the history
  • Loading branch information
optozorax committed Sep 29, 2024
1 parent d351eaf commit f71f4fa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gl.js
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,10 @@ var importObject = {
emscripten_shaders_hack = flag;
},
sapp_set_clipboard: function(ptr, len) {
clipboard = UTF8ToString(ptr, len);
let string_copy = (' ' + UTF8ToString(ptr, len)).slice(1);
if (string_copy != "") {
clipboard = string_copy;
}
},
dpi_scale,
rand: function () {
Expand Down Expand Up @@ -1220,7 +1223,7 @@ var importObject = {
window.onresize = function () {
resize(canvas, wasm_exports.resize);
};
window.addEventListener("copy", function(e) {
window.addEventListener("copy", function(event) {
if (clipboard != null) {
event.clipboardData.setData('text/plain', clipboard);
event.preventDefault();
Expand Down

0 comments on commit f71f4fa

Please sign in to comment.