Fixing flag user modal (#11221)
This commit is contained in:
parent
7047b01671
commit
d80f918efa
3 changed files with 14 additions and 23 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import { toggleFlagUserModal } from '../packs/flagUserModal';
|
||||
import { request } from '@utilities/http';
|
||||
|
||||
export function addCloseListener() {
|
||||
|
|
@ -403,6 +404,10 @@ export function addBottomActionsListeners() {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
document
|
||||
.getElementById('open-flag-user-modal')
|
||||
.addEventListener('click', toggleFlagUserModal);
|
||||
}
|
||||
|
||||
export function initializeActionsPanel() {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
|
||||
import PropTypes from 'prop-types';
|
||||
import { h, Component, Fragment } from 'preact';
|
||||
import { createPortal } from 'preact/compat';
|
||||
import { toggleFlagUserModal, FlagUserModal } from '../../packs/flagUserModal';
|
||||
import { FlagUserModal } from '../../packs/flagUserModal';
|
||||
import { formatDate } from './util';
|
||||
|
||||
export default class SingleArticle extends Component {
|
||||
|
|
@ -44,15 +43,6 @@ export default class SingleArticle extends Component {
|
|||
? document.getElementById(`mod-iframe-${id}`)
|
||||
: document.getElementById('mod-container');
|
||||
|
||||
// Check whether context is ModCenter or Friday-Night-Mode
|
||||
if (modContainer) {
|
||||
modContainer.addEventListener('load', () => {
|
||||
modContainer.contentWindow.document
|
||||
.getElementById('open-flag-user-modal')
|
||||
.addEventListener('click', toggleFlagUserModal);
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
{modContainer &&
|
||||
|
|
|
|||
|
|
@ -50,16 +50,18 @@ async function confirmFlagUser({ reactableType, category, reactableId }) {
|
|||
* Shows or hides the flag user modal.
|
||||
*/
|
||||
export function toggleFlagUserModal() {
|
||||
const modalContainer = document.querySelector('.flag-user-modal-container');
|
||||
const modalContainer = top.document.querySelector(
|
||||
'.flag-user-modal-container',
|
||||
);
|
||||
modalContainer.classList.toggle('hidden');
|
||||
|
||||
if (!modalContainer.classList.contains('hidden')) {
|
||||
window.scrollTo(0, 0);
|
||||
document.body.style.height = '100vh';
|
||||
document.body.style.overflowY = 'hidden';
|
||||
top.window.scrollTo(0, 0);
|
||||
top.document.body.style.height = '100vh';
|
||||
top.document.body.style.overflowY = 'hidden';
|
||||
} else {
|
||||
document.body.style.height = 'inherit';
|
||||
document.body.style.overflowY = 'inherit';
|
||||
top.document.body.style.height = 'inherit';
|
||||
top.document.body.style.overflowY = 'inherit';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -80,12 +82,6 @@ export function initializeFlagUserModal(authorId) {
|
|||
<FlagUserModal authorId={authorId} />,
|
||||
document.querySelector('.flag-user-modal-container'),
|
||||
);
|
||||
|
||||
modContainer.addEventListener('load', () => {
|
||||
modContainer.contentWindow.document
|
||||
.getElementById('open-flag-user-modal')
|
||||
.addEventListener('click', toggleFlagUserModal);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue