fix click-to-edit in popup on slider and iframe badge

This commit is contained in:
tophf 2020-11-21 17:32:17 +03:00
parent d6b591e4ab
commit adb2b1004d
3 changed files with 8 additions and 2 deletions

View File

@ -80,6 +80,7 @@
bottom: 0; bottom: 0;
margin: 0; margin: 0;
padding: 0 4px 0 18px; padding: 0 4px 0 18px;
pointer-events: none;
} }
.entry .onoffswitch span { .entry .onoffswitch span {
position: absolute; position: absolute;

View File

@ -239,6 +239,9 @@ html[style] .entry-content {
.entry .onoffswitch { .entry .onoffswitch {
padding: 0 0 0 6px; padding: 0 0 0 6px;
} }
.entry .onoffswitch input {
pointer-events: none;
}
.entry:nth-child(even) { .entry:nth-child(even) {
background-color: rgba(0, 0, 0, 0.05); background-color: rgba(0, 0, 0, 0.05);

View File

@ -439,6 +439,7 @@ function createStyleElement(style) {
const sel = 'span.frame-url'; const sel = 'span.frame-url';
const frameEl = $(sel, entry) || styleName.insertBefore($create(sel), styleName.lastChild); const frameEl = $(sel, entry) || styleName.insertBefore($create(sel), styleName.lastChild);
frameEl.title = frameUrl; frameEl.title = frameUrl;
frameEl.onmousedown = handleEvent.maybeEdit;
} }
entry.classList.toggle('frame', Boolean(frameUrl)); entry.classList.toggle('frame', Boolean(frameUrl));
@ -626,7 +627,8 @@ Object.assign(handleEvent, {
return; return;
} }
// open an editor on middleclick // open an editor on middleclick
if (event.target.matches('.entry, .style-name, .style-edit-link')) { const el = event.target;
if (el.matches('.entry, .style-edit-link') || el.closest('.style-name')) {
this.onmouseup = () => $('.style-edit-link', this).click(); this.onmouseup = () => $('.style-edit-link', this).click();
this.oncontextmenu = event => event.preventDefault(); this.oncontextmenu = event => event.preventDefault();
event.preventDefault(); event.preventDefault();
@ -634,7 +636,7 @@ Object.assign(handleEvent, {
} }
// prevent the popup being opened in a background tab // prevent the popup being opened in a background tab
// when an irrelevant link was accidentally clicked // when an irrelevant link was accidentally clicked
if (event.target.closest('a')) { if (el.closest('a')) {
event.preventDefault(); event.preventDefault();
return; return;
} }