diff --git a/README.md b/README.md index 3229553..98877c6 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ upstream repo is `git clone https://github.com/ericlink/electron-forge-webapp-te - [ ] zoom by window? ### tech +- [ ] auto updater using git releases - [ ] get electron-forge start working (not passing arg; detect mode and default arg to readme?) - [ ] installer - install command line script - [ ] load modules more efficiently? @@ -45,6 +46,7 @@ upstream repo is `git clone https://github.com/ericlink/electron-forge-webapp-te - [ ] mac code signing ## done +- [x] open url only add listener once, not every reload - [x] export menu (html, open in browser) - [x] open links in os browser - [x] expand cmd args to absolute path diff --git a/src/renderer/script.js b/src/renderer/script.js index 31c3970..afa64e3 100644 --- a/src/renderer/script.js +++ b/src/renderer/script.js @@ -8,7 +8,7 @@ const remote = require('electron').remote const shell = require('electron').shell; const readFile = (file) => { - log.info('readFile', file); + //log.info('readFile', file); fs.readFile(file, (err, data) => { if (err) log.error('readFile', err); if (!data || data.length == 0) log.error('readFile', 'no data'); @@ -22,13 +22,6 @@ const readFile = (file) => { Array.from(document.querySelectorAll('.lang-mermaid')).forEach( block => mermaid.init(undefined, block) ); - // open all links in external browser - document.addEventListener('click', function (event) { - if (event.target.tagName === 'A' && event.target.href.startsWith('http')) { - event.preventDefault(); - shell.openExternal(event.target.href); - } - }) }) } @@ -66,6 +59,13 @@ const watchFile = (file) => { }) } +// open all links in external browser +document.addEventListener('click', function (event) { + if (event.target.tagName === 'A' && event.target.href.startsWith('http')) { + event.preventDefault(); + shell.openExternal(event.target.href); + } +}) const file = getFileName(); initMermaid(); readFile(file);