Browse Source

Remove electron-context-menu, replace with our own

electron-contextmenu-wrapper.

This fixes our context menus. Yay!
pull/3202/head
TheGoddessInari 7 years ago
parent
commit
4456ca89b8
No known key found for this signature in database
GPG Key ID: 1209B1B7632D69A
  1. 2
      app.js
  2. 109
      app/package-lock.json
  3. 2
      app/package.json
  4. 2
      app/ux/WebView.js
  5. 10
      resources/js/rambox-service-api.js

2
app.js

@ -11,8 +11,6 @@ Ext.application({
// auto update logic
const ipc = require('electron').ipcRenderer;
require('electron-context-menu')();
ipc.on('showAbout', function(event, message) {
if(!Ext.cq1('about')) {
Ext.create('Rambox.view.main.About');

109
app/package-lock.json generated

@ -33,6 +33,14 @@
"write-file-atomic": "^2.3.0"
}
},
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"requires": {
"ms": "2.0.0"
}
},
"dot-prop": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz",
@ -41,23 +49,14 @@
"is-obj": "^1.0.0"
}
},
"electron-context-menu": {
"version": "0.10.0",
"resolved": "https://registry.npmjs.org/electron-context-menu/-/electron-context-menu-0.10.0.tgz",
"integrity": "sha512-8dv+cOIpGuSmxAje3qdydd7kzfUTHBiEq6V80CqW76P5M92sEl0WpHHhNKxKFZ2L+mNr5Lp4R9qGjyfDiYI8yg==",
"requires": {
"electron-dl": "^1.2.0",
"electron-is-dev": "^0.3.0"
}
},
"electron-dl": {
"version": "1.12.0",
"resolved": "https://registry.npmjs.org/electron-dl/-/electron-dl-1.12.0.tgz",
"integrity": "sha512-UMc2CL45Ybpvu66LDPYzwmDRmYK4Ivz+wdnTM0eXcNMztvQwhixAk2UPme1c7McqG8bAlKEkQpZn3epmQy4EWg==",
"electron-contextmenu-wrapper": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/electron-contextmenu-wrapper/-/electron-contextmenu-wrapper-0.0.1.tgz",
"integrity": "sha512-Fh/WDeLKS4ieTp5l2gTv5ZBHGorhnI1HI+YOX29TgYk1tQ6Ao7R9Efd+4FFm73DoSpzeh4Nx66y5hDdbvBO/RA==",
"requires": {
"ext-name": "^5.0.0",
"pupa": "^1.0.0",
"unused-filename": "^1.0.0"
"debug": "^2.6.9",
"mkdirp": "^0.5.1",
"pify": "^4.0.0"
}
},
"electron-is-dev": {
@ -78,23 +77,6 @@
"resolved": "https://registry.npmjs.org/env-paths/-/env-paths-1.0.0.tgz",
"integrity": "sha1-QWgTO0K7BcOKNbGuQ5fIKYqzaeA="
},
"ext-list": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/ext-list/-/ext-list-2.2.2.tgz",
"integrity": "sha512-u+SQgsubraE6zItfVA0tBuCBhfU9ogSRnsvygI7wht9TS510oLkBRXBsqopeUG/GBOIQyKZO9wjTqIu/sf5zFA==",
"requires": {
"mime-db": "^1.28.0"
}
},
"ext-name": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/ext-name/-/ext-name-5.0.0.tgz",
"integrity": "sha512-yblEwXAbGv1VQDmow7s38W77hzAgJAO50ztBLMcUyUBfxv1HC+LGwtiEN+Co6LtlqT/5uwVOxsD4TNIilWhwdQ==",
"requires": {
"ext-list": "^2.0.0",
"sort-keys-length": "^1.0.0"
}
},
"find-up": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz",
@ -118,11 +100,6 @@
"resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz",
"integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8="
},
"is-plain-obj": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz",
"integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4="
},
"locate-path": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz",
@ -138,6 +115,13 @@
"integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==",
"requires": {
"pify": "^3.0.0"
},
"dependencies": {
"pify": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY="
}
}
},
"mime": {
@ -145,11 +129,6 @@
"resolved": "https://registry.npmjs.org/mime/-/mime-2.3.1.tgz",
"integrity": "sha512-OEUllcVoydBHGN1z84yfQDimn58pZNNNXgZlHXSboxMlFvgI6MXSWpWKpFRra7H1HxpVhHTkrghfRW49k6yjeg=="
},
"mime-db": {
"version": "1.35.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz",
"integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg=="
},
"minimist": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
@ -163,10 +142,10 @@
"minimist": "0.0.8"
}
},
"modify-filename": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/modify-filename/-/modify-filename-1.1.0.tgz",
"integrity": "sha1-mi3sg4Bvuy2XXyK+7IWcoms5OqE="
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"os-tmpdir": {
"version": "1.0.2",
@ -205,9 +184,9 @@
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
},
"pify": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY="
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-4.0.0.tgz",
"integrity": "sha512-zrSP/KDf9DH3K3VePONoCstgPiYJy9z0SCatZuTpOc7YdnWIqwkWdXOuwlr4uDc7em8QZRsFWsT/685x5InjYg=="
},
"pkg-up": {
"version": "2.0.0",
@ -217,32 +196,11 @@
"find-up": "^2.1.0"
}
},
"pupa": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/pupa/-/pupa-1.0.0.tgz",
"integrity": "sha1-mpVopa9+ZXuEYqbp1TKHQ1YM7/Y="
},
"signal-exit": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0="
},
"sort-keys": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz",
"integrity": "sha1-RBttTTRnmPG05J6JIK37oOVD+a0=",
"requires": {
"is-plain-obj": "^1.0.0"
}
},
"sort-keys-length": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/sort-keys-length/-/sort-keys-length-1.0.1.tgz",
"integrity": "sha1-nLb09OnkgVWmqgZx7dM2/xR5oYg=",
"requires": {
"sort-keys": "^1.0.0"
}
},
"tmp": {
"version": "0.0.33",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
@ -256,15 +214,6 @@
"resolved": "https://registry.npmjs.org/untildify/-/untildify-3.0.3.tgz",
"integrity": "sha512-iSk/J8efr8uPT/Z4eSUywnqyrQU7DSdMfdqK4iWEaUVVmcP5JcnpRqmVMwcwcnmI1ATFNgC5V90u09tBynNFKA=="
},
"unused-filename": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unused-filename/-/unused-filename-1.0.0.tgz",
"integrity": "sha1-00CID3GuIRXrqhMlvvBcxmhEacY=",
"requires": {
"modify-filename": "^1.1.0",
"path-exists": "^3.0.0"
}
},
"winreg": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/winreg/-/winreg-1.2.2.tgz",

2
app/package.json

@ -31,8 +31,8 @@
"dependencies": {
"auto-launch-patched": "5.0.2",
"electron-store": "^2.0.0",
"electron-context-menu": "^0.10.0",
"electron-is-dev": "^0.3.0",
"electron-contextmenu-wrapper": "^0.0.1",
"mime": "^2.3.1",
"tmp": "^0.0.33"
}

2
app/ux/WebView.js

@ -223,8 +223,6 @@ Ext.define('Rambox.ux.WebView',{
var webview = me.down('component').el.dom;
require('electron-context-menu')({window: webview});
// Notifications in Webview
me.setNotifications(localStorage.getItem('locked') || JSON.parse(localStorage.getItem('dontDisturb')) ? false : me.record.get('notifications'));

10
resources/js/rambox-service-api.js

@ -3,6 +3,8 @@
*/
const { ipcRenderer } = require('electron');
const { MenuItem } = require('electron').remote;
const { ContextMenuBuilder, ContextMenuListener } = require('electron-contextmenu-wrapper');
/**
* Make the Rambox API available via a global "rambox" variable.
@ -11,6 +13,8 @@ const { ipcRenderer } = require('electron');
*/
window.rambox = {};
window.rambox.locale = ipcRenderer.sendSync('getConfig').locale;
/**
* Sets the unread count of the tab.
*
@ -36,6 +40,12 @@ window.rambox.clearUnreadCount = function() {
ipcRenderer.sendToHost('rambox.clearUnreadCount');
}
window.rambox.contextMenuBuilder = new ContextMenuBuilder();
window.rambox.contextMenuListener = new ContextMenuListener(function(event, info) {
window.rambox.contextMenuBuilder.showPopupMenu(info);
});
/**
* Override to add notification click event to display Rambox window and activate service tab
*/

Loading…
Cancel
Save