8000 fix: (ctrl/cmd)+click for clickable divs by shariquerik · Pull Request #18910 · frappe/frappe · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: (ctrl/cmd)+click for clickable divs #18910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions frappe/public/js/frappe/router.js
< 8000 td id="diff-41ec86207ea33702252b49c71fc33d547932b4f238fe6d66b85524f11f95ce4bR351" data-line-number="351" class="blob-num blob-num-addition js-linkable-line-number js-blob-rnum">
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ frappe.route_history = [];
frappe.view_factory = {};
frappe.view_factories = [];
frappe.route_options = null;
frappe.open_in_new_tab = false;
frappe.route_hooks = {};

$(window).on("hashchange", function (e) {
Expand Down Expand Up @@ -347,8 +348,12 @@ frappe.router = {
let sub_path = this.make_url(route);
// replace each # occurrences in the URL with encoded character except for last
// sub_path = sub_path.replace(/[#](?=.*[#])/g, "%23");
this.push_state(sub_path);

if (frappe.open_in_new_tab) {
window.open(sub_path, "_blank");
frappe.open_in_new_tab = false;
} else {
this.push_state(sub_path);
}
setTimeout(() => {
frappe.after_ajax &&
frappe.after_ajax(() => {
Expand Down
7 changes: 6 additions & 1 deletion frappe/public/js/frappe/ui/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,12 @@ frappe.ui.Page = class Page {
`);
}

$link = $li.find("a").on("click", click);
$link = $li.find("a").on("click", (e) => {
if (e.ctrlKey || e.metaKey) {
frappe.open_in_new_tab = true;
}
return click();
});

if (standard) {
$li.appendTo(parent);
Expand Down
4 changes: 4 additions & 0 deletions frappe/public/js/frappe/ui/toolbar/awesome_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ frappe.search.AwesomeBar = class AwesomeBar {
if (item.onclick) {
item.onclick(item.match);
} else {
let event = o.originalEvent;
if (event.ctrlKey || event.metaKey) {
frappe.open_in_new_tab = true;
}
frappe.set_route(item.route);
}
$input.val("");
Expand Down
14 changes: 12 additions & 2 deletions frappe/public/js/frappe/widgets/quick_list_widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,10 @@ export default class QuickListWidget extends Widget {
$quick_list_item
);

$quick_list_item.click(() => {
$quick_list_item.click((e) => {
if (e.ctrlKey || e.metaKey) {
frappe.open_in_new_tab = true;
}
frappe.set_route(`${frappe.utils.get_form_link(this.document_type, doc.name)}`);
});

Expand Down Expand Up @@ -243,7 +246,14 @@ export default class QuickListWidget extends Widget {
}
let route = frappe.utils.generate_route({ type: "doctype", name: this.document_type });
this.see_all_button = $(`
<a href="${route}"class="see-all btn btn-xs">${__("View List")}</a>
<div class="see-all btn btn-xs">${__("View List")}</div>
`).appendTo(this.footer);

this.see_all_button.click((e) => {
if (e.ctrlKey || e.metaKey) {
frappe.open_in_new_tab = true;
}
frappe.set_route(route);
});
}
}
7 changes: 6 additions & 1 deletion frappe/public/js/frappe/widgets/shortcut_widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default class ShortcutWidget extends Widget {
}

setup_events() {
this.widget.click(() => {
this.widget.click((e) => {
if (this.in_customize_mode) return;

let route = frappe.utils.generate_route({
Expand All @@ -40,6 +40,11 @@ export default class ShortcutWidget extends Widget {
if (this.type == "DocType" && filters) {
frappe.route_options = filters;
}

if (e.ctrlKey || e.metaKey) {
frappe.open_in_new_tab = true;
}

frappe.set_route(route);
});
}
Expand Down
0