popup: right-click / ctrl-click on a name opens editor
This commit is contained in:
parent
01d59192a3
commit
0d6f7e0a4b
12
popup.js
12
popup.js
|
@ -201,8 +201,7 @@ function createStyleElement({
|
||||||
id: 'style-' + style.id,
|
id: 'style-' + style.id,
|
||||||
styleId: style.id,
|
styleId: style.id,
|
||||||
className: entry.className + ' ' + (style.enabled ? 'enabled' : 'disabled'),
|
className: entry.className + ' ' + (style.enabled ? 'enabled' : 'disabled'),
|
||||||
onmousedown: handleEvent.middleClick,
|
onmousedown: handleEvent.maybeEdit,
|
||||||
onauxclick: handleEvent.middleClick,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const checkbox = $('.checker', entry);
|
const checkbox = $('.checker', entry);
|
||||||
|
@ -324,13 +323,16 @@ Object.assign(handleEvent, {
|
||||||
close();
|
close();
|
||||||
},
|
},
|
||||||
|
|
||||||
middleClick(event) {
|
maybeEdit(event) {
|
||||||
if (event.button != 1) {
|
if (!(
|
||||||
|
event.button == 0 && event.ctrlKey ||
|
||||||
|
event.button == 1 ||
|
||||||
|
event.button == 2)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// open an editor on middleclick
|
// open an editor on middleclick
|
||||||
if (event.target.matches('.entry, .style-name, .style-edit-link')) {
|
if (event.target.matches('.entry, .style-name, .style-edit-link')) {
|
||||||
$('.style-edit-link', this).click();
|
this.onmouseup = () => $('.style-edit-link', this).click();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user