Merge pull request #38899 from iamejaaz/create-new-shortcut

feat: add crtl+b to create new doc
This commit is contained in:
Ejaaz Khan 2026-04-26 08:31:21 +05:30 committed by GitHub
commit dcdc2eeae9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -297,12 +297,31 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
}, },
"add" "add"
); );
frappe.ui.keys.add_shortcut({
shortcut: "ctrl+b",
action: () => {
if (this.settings.primary_action) {
this.settings.primary_action();
} else {
this.make_new_doc();
}
return true;
},
description: __(
"Create a new document",
null,
"Description of a list view shortcut"
),
page: this.page,
});
if (frappe.is_mobile()) { if (frappe.is_mobile()) {
create_button.append(__("Add")); create_button.append(__("Add"));
} else { } else {
this._trim_primary_action_if_overflow(create_button, add_button_label); this._trim_primary_action_if_overflow(create_button, add_button_label);
} }
} else { } else {
frappe.ui.keys.off("ctrl+b", this.page);
this.page.clear_primary_action(); this.page.clear_primary_action();
} }
} }