diff --git a/README.md b/README.md
index 245dd1c0d..3c79addfd 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# electron-boilerplate
-A minimalistic boilerplate for [Electron runtime](https://www.electronjs.org/). Tested on Windows, macOS and Linux.
+Minimalistic, very easy to understand boilerplate for [Electron runtime](https://www.electronjs.org/). Tested on Windows, macOS and Linux.
This project contains only bare minimum of tooling and dependencies to provide you with simple to understand and extensible base (but still, this is fully functional Electron environment). The boilerplate doesn't impose on you any frontend technologies, so feel free to pick your favourite.
diff --git a/app/app.html b/app/app.html
index 3611f9280..4d00b830f 100644
--- a/app/app.html
+++ b/app/app.html
@@ -1,27 +1,24 @@
-
+
-
-
- Electron Boilerplate
-
-
+
+
+ Electron Boilerplate
+
+
+
+
+
+ Welcome to
+
+ Electron
+
+ app running on this machine.
+
+
App author:
+
Environment:
+
Electron version:
+
-
-
-
- Welcome to Electron app running on this machine.
-
-
- App author:
-
-
- Environment:
-
-
- Electron version:
-
-
-
-
-
+
+
diff --git a/package.json b/package.json
index f4aff27da..7119a34fc 100644
--- a/package.json
+++ b/package.json
@@ -31,7 +31,6 @@
"release": "npm test && webpack --config=build/webpack.app.config.js --env=production && electron-builder"
},
"dependencies": {
- "electron-context-menu": "^2.5.0",
"fs-jetpack": "^4.1.0"
},
"devDependencies": {
diff --git a/src/app.js b/src/app.js
index caf92232f..f80f47ffa 100644
--- a/src/app.js
+++ b/src/app.js
@@ -1,11 +1,6 @@
import "./stylesheets/main.css";
-// Small helper you might want to keep
-import "./helpers/external_links_renderer.js";
-
-// ----------------------------------------------------------------------------
// Everything below is just a demo. You can delete all of it.
-// ----------------------------------------------------------------------------
import { ipcRenderer } from "electron";
import jetpack from "fs-jetpack";
@@ -34,3 +29,12 @@ ipcRenderer.on("app-path", (event, appDirPath) => {
document.querySelector("#author").innerHTML = manifest.author;
});
ipcRenderer.send("need-app-path");
+
+document.querySelector(".electron-website-link").addEventListener(
+ "click",
+ event => {
+ ipcRenderer.send("open-external-link", event.target.href);
+ event.preventDefault();
+ },
+ false
+);
diff --git a/src/helpers/external_links.js b/src/helpers/external_links.js
deleted file mode 100644
index 0f4778a05..000000000
--- a/src/helpers/external_links.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import { ipcMain, shell } from "electron";
-
-export default () => {
- ipcMain.on("open-external-link", (event, href) => {
- shell.openExternal(href);
- });
-};
diff --git a/src/helpers/external_links_renderer.js b/src/helpers/external_links_renderer.js
deleted file mode 100644
index c99aed0a6..000000000
--- a/src/helpers/external_links_renderer.js
+++ /dev/null
@@ -1,40 +0,0 @@
-// Convenient way for opening links in external browser, not in the app.
-// Useful especially if you have a lot of links to deal with.
-//
-// Usage:
-//
-// Every link with class ".js-external-link" will be opened in external browser.
-// google
-//
-// The same behaviour for many links can be achieved by adding
-// this class to any parent tag of an anchor tag.
-//
-// google
-// bing
-//
-
-import { ipcRenderer } from "electron";
-
-const externalLinksSupport = event => {
- let href;
- let isExternal = false;
-
- const checkDomElement = element => {
- if (element.nodeName === "A") {
- href = element.getAttribute("href");
- }
- if (element.classList.contains("js-external-link")) {
- isExternal = true;
- }
- if (href && isExternal) {
- ipcRenderer.send("open-external-link", href);
- event.preventDefault();
- } else if (element.parentElement) {
- checkDomElement(element.parentElement);
- }
- };
-
- checkDomElement(event.target);
-};
-
-document.addEventListener("click", externalLinksSupport, false);
diff --git a/src/main.js b/src/main.js
index 522e92e15..027ef200a 100644
--- a/src/main.js
+++ b/src/main.js
@@ -5,12 +5,10 @@
import path from "path";
import url from "url";
-import contextMenu from "electron-context-menu";
-import { app, Menu, ipcMain } from "electron";
+import { app, Menu, ipcMain, shell } from "electron";
import appMenuTemplate from "./menu/app_menu_template";
import editMenuTemplate from "./menu/edit_menu_template";
import devMenuTemplate from "./menu/dev_menu_template";
-import externalLinks from "./helpers/external_links";
import createWindow from "./helpers/window";
// Special module holding environment variables which you declared
@@ -38,11 +36,11 @@ const initIpc = () => {
ipcMain.on("need-app-path", (event, arg) => {
event.reply("app-path", app.getAppPath());
});
+ ipcMain.on("open-external-link", (event, href) => {
+ shell.openExternal(href);
+ });
};
-contextMenu();
-externalLinks();
-
app.on("ready", () => {
setApplicationMenu();
initIpc();