Fix outer CSS being incorrectly injected (#1075)

This commit is contained in:
toasted-nutbread 2020-11-29 12:00:41 -05:00 committed by GitHub
parent 008ffdb6bf
commit a8cd03cbec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -105,8 +105,8 @@ class PopupPreviewFrame {
return options;
}
_onCustomOuterCssChanged({node}) {
if (node === null) { return; }
_onCustomOuterCssChanged({node, inShadow}) {
if (node === null || inShadow) { return; }
const node2 = document.querySelector('#popup-outer-css');
if (node2 === null) { return; }

View File

@ -195,12 +195,13 @@ class Popup extends EventDispatcher {
async setCustomOuterCss(css, useWebExtensionApi) {
let parentNode = null;
if (this._shadow !== null) {
const inShadow = (this._shadow !== null);
if (inShadow) {
useWebExtensionApi = false;
parentNode = this._shadow;
}
const node = await dynamicLoader.loadStyle('yomichan-popup-outer-user-stylesheet', 'code', css, useWebExtensionApi, parentNode);
this.trigger('customOuterCssChanged', {node, useWebExtensionApi});
this.trigger('customOuterCssChanged', {node, useWebExtensionApi, inShadow});
}
getFrameRect() {