Commit 62a91280 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

fix #82: "Select all" shortcut (cmd+A) doesn’t work (on OSX)

parent baaec1b4
......@@ -1080,6 +1080,11 @@ function nw_create_patch_window_menus(gui, w, name) {
click: function (evt) {
if (canvas_events.get_state() === "normal") {
pdgui.pdsend(name, "selectall");
} else if (process.os === "darwin") {
// big kluge for OSX to select all inside a
// contenteditable element (needed because
// the stupid MacBuiltin is buggy-- see pd_menus.js)
document.execCommand("selectAll", false, null);
......@@ -152,7 +152,18 @@ function create_menu(gui, type) {
// There's no "Delete" item for GNU/Linux or Windows--
// not sure yet what to do with it.
m.edit.delete = window_menu.items[1].submenu.items[6];
// The MacBuiltin "Select All" doesn't propagate down to the DOM
//on OSX, so we have to remove it
m.edit.selectall= window_menu.items[1].submenu.items[7];
// Now we replace it with a custom "Select All" which will
// propagate to the DOM...
edit_menu.append(m.edit.selectall = new gui.MenuItem({
label: l("menu.selectall"),
tooltip: l("menu.selectall_tt"),
key: "a",
modifiers: cmd_or_ctrl
} else {
edit_menu = new gui.Menu();
// Edit sub-entries
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment