Skip to content
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

Modified printing preferences, #1122 #1133

Merged
merged 2 commits into from
Sep 10, 2023
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
6 changes: 4 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -504,16 +504,17 @@
<a href=#title>Title</a>
<a href=#pmenu>Menu</a>
<a href=#wins>Trace/Edit</a>
<button id=prf_print class=tb_btn><span class="fal fa-print"></span></button>
</div>
<div id=prf_content>

<!--Layout-->
<div id=lyt>
<div id=lyt_ctrls>
<button id=lyt_rst title="Restore defaults for selected locale"><u>R</u>eset</button>
<button id=lyt_prnt title="Print"><u>P</u>rint</button>
<label id=lyt_pfx_lbl><u>P</u>refix: <input id=lyt_pfx size=1></label>
<label id=lyt_lc_lbl>Choose <u>l</u>ayout: <select id=lyt_lc></select></label>
<label id=lyt_lc_lbl for lyt_lc>Choose <u>l</u>ayout:</label>
<select id=lyt_lc></select>
</div>
<div id=lyt_kbd>
<b id=lyt_1 class=lyt_k><b class=lyt_g2></b><input class=lyt_g3><br><b class=lyt_g0></b><input class=lyt_g1></b>
Expand Down Expand Up @@ -588,6 +589,7 @@
<div id=shc hidden>
<div id=shc_ctrls>
<button id=shc_rst_all title="Reset all to their defaults"><u>R</u>eset</button>
<button id=shc_prnt title="Print"><u>P</u>rint</button>
<input id=shc_sc placeholder=Search><a id=shc_sc_clr href=# hidden title="Clear search">×</a>
<input type=checkbox id=shc_defined>
<label id=shc_defined_lb for=shc_defined>Only show defined shortcuts</label>
Expand Down
8 changes: 4 additions & 4 deletions src/prf_lyt.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
name: 'Keyboard',
init() {
q = J.lyt;
q.prnt.onclick = () => {
q.pfx.blur();
D.el.getCurrentWindow().webContents.print({ printBackground: true });
};
q.lc.innerHTML = `<option>${Object.keys(layouts).sort().join('<option>')}`;
const inputs = q.kbd.querySelectorAll('input');
const onBlurInput = (x) => {
Expand Down Expand Up @@ -102,10 +106,6 @@
if (q.pfx.value.length !== 1) return { msg: 'Invalid prefix key', el: q.pfx };
return null;
},
print() {
q.pfx.blur();
D.el.getCurrentWindow().webContents.print({ printBackground: true });
},
save() {
D.prf.prefixKey(q.pfx.value);
D.prf.kbdLocale(q.lc.value);
Expand Down
6 changes: 3 additions & 3 deletions src/prf_shc.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@
name: 'Shortcuts',
init(t) {
q = J.shc;
q.prnt.onclick = () => {
D.el.getCurrentWindow().webContents.print({ printBackground: true });
};
t.onmouseover = (e) => {
const u = e.target.closest('.shc_del');
if (u) u.parentNode.className += ' shc_del_hvr';
Expand Down Expand Up @@ -198,9 +201,6 @@
}
return null;
},
print() {
D.el.getCurrentWindow().webContents.print({ printBackground: true });
},
save() {
const h = {};
const { cmds } = D;
Expand Down
4 changes: 0 additions & 4 deletions src/prf_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,9 @@
activeTab = tabs[a.href.replace(/.*#/, '')];
activeTab.resize && activeTab.resize();
activeTab.activate && activeTab.activate();
I.prf_print.disabled = !activeTab.print;
x.preventDefault();
return !1;
};
I.prf_print.onclick = () => {
activeTab.print && activeTab.print();
};
for (let i = 0; i < hdrs.length; i++) {
const id = hdrs[i].href.replace(/.*#/, '');
const e = document.getElementById(id);
Expand Down
Loading