-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed app info opening, experimental text input context menus
- Loading branch information
Ruslan Garifullin ruslan.g2002@gmail.com
committed
Nov 11, 2018
1 parent
8a952ff
commit aba699f
Showing
10 changed files
with
104 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
const wc = require("electron").remote.getCurrentWebContents(); | ||
let previousMenu; | ||
wc.on("context-menu", (e, params) => { | ||
let generate = true; | ||
if (previousMenu) if (document.querySelector("body>menu.dropdown-menu:not(#" + previousMenu.id + ")")) generate = false; | ||
if (!params.isEditable) generate = false; | ||
if (e.sender.dataset && e.sender.dataset.editMenu === "false") generate = false; | ||
if (generate) { | ||
console.log(params); | ||
previousMenu = new Menu(null, [{ | ||
label: "Undo", | ||
icon: "undo", | ||
enabled: params.editFlags.canUndo, | ||
click(item, win, elem) { | ||
elem.focus(); | ||
document.execCommand("undo"); | ||
} | ||
}, { | ||
label: "Redo", | ||
icon: "redo", | ||
enabled: params.editFlags.canRedo, | ||
click(item, win, elem) { | ||
elem.focus(); | ||
document.execCommand("redo"); | ||
} | ||
}, {type: "separator"}, { | ||
label: "Cut", | ||
icon: "content-cut", | ||
enabled: params.editFlags.canCut, | ||
click() { | ||
elem.focus(); | ||
document.execCommand('cut', false) | ||
} | ||
}, { | ||
label: "Copy", | ||
icon: "content-copy", | ||
enabled: params.editFlags.canCopy, | ||
click() { | ||
elem.focus(); | ||
document.execCommand('copy', false) | ||
} | ||
}, { | ||
label: "Paste", | ||
icon: "content-paste", | ||
enabled: params.editFlags.canPaste, | ||
click() { | ||
elem.focus(); | ||
document.execCommand('paste', false) | ||
} | ||
}, { | ||
type: "separator" | ||
}, { | ||
label: "Select All", | ||
icon: "select-all", | ||
enabled: params.editFlags.canSelectAll, | ||
click() { | ||
elem.focus(); | ||
document.execCommand('selectAll', false) | ||
} | ||
}]); | ||
previousMenu.popup(); | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.