diff --git a/package-lock.json b/package-lock.json index e0c3ea07..c3946822 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,6 @@ "@sentry/electron": "4.18.0", "@webref/css": "6.12.0", "electron-extension-installer": "1.2.0", - "electron-log": "^5.1.1", "electron-updater": "6.1.8", "electron-window-state": "5.0.3", "font-scanner": "0.2.1", @@ -45,6 +44,8 @@ "create-react-class": "15.7.0", "electron": "29.0.1", "electron-builder": "24.12.0", + "electron-log": "5.1.1", + "electron-reloader": "^1.2.3", "element-to-path": "1.2.1", "highlight.js": "11.9.0", "js-beautify": "1.15.1", @@ -4051,6 +4052,18 @@ "node": ">=4.0" } }, + "node_modules/date-time": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/date-time/-/date-time-3.1.0.tgz", + "integrity": "sha512-uqCUKXE5q1PNBXjPqvwhwJf9SwMoAHBgWJ6DcrnS5o+W2JOiIILl0JEdVD8SGujrNS02GGxgwAg2PN2zONgtjg==", + "dev": true, + "dependencies": { + "time-zone": "^1.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -4631,10 +4644,17 @@ "rimraf": "^5.0.0" } }, + "node_modules/electron-is-dev": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/electron-is-dev/-/electron-is-dev-1.2.0.tgz", + "integrity": "sha512-R1oD5gMBPS7PVU8gJwH6CtT0e6VSoD0+SzSnYpNm+dBkcijgA+K7VAMHDfnRq/lkKPZArpzplTW6jfiMYosdzw==", + "dev": true + }, "node_modules/electron-log": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/electron-log/-/electron-log-5.1.1.tgz", "integrity": "sha512-If7HU4Slbh2xfjOXOLxifkbgu6HmWDNJyXPLW+XNTOHMfFKisg0trA3d/7syyu25S+lHosfsd0VMfDSjGn1+Pw==", + "dev": true, "engines": { "node": ">= 14" } @@ -4689,6 +4709,22 @@ "node": ">= 10.0.0" } }, + "node_modules/electron-reloader": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/electron-reloader/-/electron-reloader-1.2.3.tgz", + "integrity": "sha512-aDnACAzNg0QvQhzw7LYOx/nVS10mEtbuG6M0QQvNQcLnJEwFs6is+EGRCnM+KQlQ4KcTbdwnt07nd7ZjHpY4iw==", + "dev": true, + "dependencies": { + "chalk": "^4.1.0", + "chokidar": "^3.5.0", + "date-time": "^3.1.0", + "electron-is-dev": "^1.2.0", + "find-up": "^5.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/electron-to-chromium": { "version": "1.4.656", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.656.tgz", @@ -5125,6 +5161,22 @@ "node": ">= 0.8" } }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/flatted": { "version": "3.2.9", "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz", @@ -6379,6 +6431,21 @@ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", @@ -6909,6 +6976,36 @@ "node": ">=8" } }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/pako": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", @@ -6963,6 +7060,15 @@ "integrity": "sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ==", "dev": true }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -8930,6 +9036,15 @@ "node": ">=0.8" } }, + "node_modules/time-zone": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/time-zone/-/time-zone-1.0.0.tgz", + "integrity": "sha512-TIsDdtKo6+XrPtiTm1ssmMngN1sAhyKnTO2kunQWqNPWIVvCm15Wmw4SWInwTVgJ5u/Tr04+8Ei9TNcw4x4ONA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/timers-browserify": { "version": "2.0.12", "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.12.tgz", @@ -9527,6 +9642,18 @@ "buffer-crc32": "~0.2.3", "fd-slicer": "~1.1.0" } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } } } } diff --git a/package.json b/package.json index 690810d9..b8ed8d39 100644 --- a/package.json +++ b/package.json @@ -84,6 +84,8 @@ "create-react-class": "15.7.0", "electron": "29.0.1", "electron-builder": "24.12.0", + "electron-log": "5.1.1", + "electron-reloader": "1.2.3", "element-to-path": "1.2.1", "highlight.js": "11.9.0", "js-beautify": "1.15.1", @@ -119,7 +121,6 @@ "@sentry/electron": "4.18.0", "@webref/css": "6.12.0", "electron-extension-installer": "1.2.0", - "electron-log": "5.1.1", "electron-updater": "6.1.8", "electron-window-state": "5.0.3", "font-scanner": "0.2.1", diff --git a/src/main.cljs b/src/main.cljs index 2d057fe9..c80f823d 100644 --- a/src/main.cljs +++ b/src/main.cljs @@ -4,6 +4,7 @@ ["electron-extension-installer" :refer [REACT_DEVELOPER_TOOLS]] ["electron-extension-installer$default" :as installExtension] ["electron-log/main" :as log] + ["electron-reloader"] #_["electron-updater" :as updater] ["electron-window-state" :as window-state-keeper] ["electron" :refer [app shell ipcMain BrowserWindow clipboard nativeTheme]] @@ -11,8 +12,8 @@ [config] [file])) -(def main-window (atom nil)) -(def loading-window (atom nil)) +(defonce main-window (atom nil)) +(defonce loading-window (atom nil)) (defn send-to-renderer ([action] @@ -20,7 +21,7 @@ ([action data] (.send (.-webContents ^js @main-window) "fromMain" (clj->js {:action action :data data})))) -(defn load-file +(defn load [data] (send-to-renderer "loadDocument" data)) @@ -38,7 +39,7 @@ "openRemoteUrl" (.openExternal shell (.-data args)) ;; https://www.electronjs.org/docs/api/clipboard#clipboardwritedata-type "writeToClipboard" (.write clipboard (.-data args)) - "openDocument" (file/open load-file) + "openDocument" (file/open load) "saveDocument" (file/save (.-data args)) "export" (file/export (.-data args))))