diff --git a/app/js/platform/end.js b/app/js/platform/end.js index 56ef9756..765abec7 100644 --- a/app/js/platform/end.js +++ b/app/js/platform/end.js @@ -81,11 +81,8 @@ $(document).on('click', 'a', e => { //コピー function execCopy(string) { - var temp = $("#copy"); - temp.val(string); - temp.select(); - var result = document.execCommand('copy'); - return result; + postMessage(["copy", string], "*") + return true; } function progshow(e) { if (e.lengthComputable) { diff --git a/app/js/platform/preload.js b/app/js/platform/preload.js index 1b277dd5..21270cef 100644 --- a/app/js/platform/preload.js +++ b/app/js/platform/preload.js @@ -59,6 +59,8 @@ onmessage = function (e) { ipc.send('nano', null); } else if (e.data[0] == "asReadComp") { ipc.send('sendMarkersComplete', null); + } else if (e.data[0] == "copy") { + ipc.send('copy', e.data[1]); } } //version.js diff --git a/app/main/system.js b/app/main/system.js index 739d6423..927c7b74 100644 --- a/app/main/system.js +++ b/app/main/system.js @@ -6,6 +6,7 @@ function system(mainWindow, dir, lang, dirname) { const fs = require("fs"); var JSON5 = require('json5'); var ipc = electron.ipcMain; + const clipboard = electron.clipboard; var tmp_img = join(app.getPath("userData"), "tmp.png"); var ha_path = join(app.getPath("userData"), "hardwareAcceleration"); var lang_path = join(app.getPath("userData"), "language"); @@ -209,5 +210,9 @@ function system(mainWindow, dir, lang, dirname) { e.sender.webContents.send('font-list', fonts_sorted); }); }); + //コピー + ipc.on('copy', (e, arg) => { + clipboard.writeText(arg) + }); } exports.system = system; \ No newline at end of file