DEV: removes legacy modal code (#28047)

This commit is contained in:
Joffrey JAFFEUX 2024-07-24 18:07:17 +02:00 committed by GitHub
parent ff7892a3f8
commit 7a7cc815be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
34 changed files with 4 additions and 511 deletions

View File

@ -34,7 +34,7 @@ export default class AdminPenaltyPostAction extends Component {
@afterRender
_focusEditTextarea() {
const elem = this.element;
const body = elem.closest(".modal-body");
const body = elem.closest(".d-modal__body");
body.scrollTo(0, body.clientHeight);
elem.querySelector(".post-editor").focus();
}

View File

@ -207,10 +207,6 @@ export default Component.extend({
},
keyDown(e) {
if (document.body.classList.contains("modal-open")) {
return;
}
if (e.key === "Escape") {
e.preventDefault();
this.cancelled();

View File

@ -1,7 +0,0 @@
<div class="modal-footer">
<DButton
@action={{route-action "closeModal"}}
@label="close"
class="btn-primary"
/>
</div>

View File

@ -1,3 +0,0 @@
import Component from "@ember/component";
export default Component.extend({});

View File

@ -83,7 +83,6 @@ export default Component.extend({
!$parents.is(".widget-button") &&
!$parents.is("#discourse-modal") &&
!$target.is("#discourse-modal") &&
!$parents.is(".modal-footer") &&
($target.is(".topic-timeline") ||
!$parents.is("#topic-progress-wrapper")) &&
!$parents.is(".timeline-open-jump-to-post-prompt-btn") &&

View File

@ -35,10 +35,6 @@ export default class TopicTitle extends Component {
@action
keyDown(e) {
if (document.body.classList.contains("modal-open")) {
return;
}
if (e.key === "Escape") {
e.preventDefault();
this.args.cancelled();

View File

@ -17,7 +17,7 @@ export default class TrapTabModifier extends Modifier {
autofocus ??= true;
this.preventScroll = preventScroll ?? true;
this.originalElement = element;
this.element = element.querySelector(".modal-inner-container") || element;
this.element = element.querySelector(".d-modal__container") || element;
this.originalElement.addEventListener("keydown", this.trapTab);
// on first trap we don't allow to focus modal-close
@ -36,7 +36,7 @@ export default class TrapTabModifier extends Modifier {
this.element.querySelector(
FOCUSABLE_ELEMENTS + ", button:not(.modal-close)"
) ||
this.element.querySelector(".modal-body")
this.element.querySelector(".d-modal__body")
)?.focus({
preventScroll: this.preventScroll,
});

View File

@ -317,10 +317,6 @@ export default function setupTests(config) {
resetPretender();
clearPresenceState();
// Clean up the DOM. Some tests might leave extra classes or elements behind.
Array.from(document.getElementsByClassName("modal-backdrop")).forEach((e) =>
e.remove()
);
document.body.removeAttribute("class");
let html = document.documentElement;
html.removeAttribute("class");

View File

@ -1,9 +1,3 @@
.admin-install-theme-modal {
.modal-inner-container {
width: 100%;
}
}
.install-theme {
display: flex;
@include breakpoint(mobile-extra-large) {

View File

@ -775,19 +775,6 @@
width: 100%;
}
.modal-body .inputs .branch {
margin-top: 10px;
}
.modal-body .inputs .check-private {
margin-top: 10px;
label {
padding-left: 0;
}
label input {
width: auto;
}
}
.public-key {
margin-top: 1em;
textarea {

View File

@ -132,9 +132,6 @@
//specific email admin modal styling
.admin-incoming-email-modal {
.modal-inner-container {
width: var(--modal-max-width);
}
.incoming-emails {
label {
float: none;

View File

@ -108,11 +108,6 @@
}
}
.desktop-view & .modal-inner-container {
--modal-max-width: 75vw;
min-width: 55vw;
}
.card-title.level-1,
.card-title.je-object__title {
> .json-editor-btn-collapse {

View File

@ -1,8 +1,5 @@
.silence-user-modal,
.suspend-user-modal {
.modal-body {
padding-bottom: 0em;
}
.penalty-duration,
.penalty-suspend-forever,
.suspend-reason-title,

View File

@ -75,10 +75,6 @@
}
}
.edit-user-directory-columns-modal .modal-inner-container {
min-width: 450px;
}
@container (min-width: 47em) {
.users-directory {
.directory-table {

View File

@ -2,23 +2,6 @@
.select-kit.combo-box {
width: 100%;
}
.modal-inner-container {
box-sizing: border-box;
min-width: 310px;
}
.modal-body {
max-height: none;
width: 375px;
box-sizing: border-box;
@media (max-width: 600px) {
width: 100%;
}
.control-label {
font-weight: 700;
}
}
.radios {
margin-bottom: 10px;
}

View File

@ -1,20 +1,6 @@
// styles that apply to the popup that appears when you show the edit history of a post
.modal.history-modal {
.modal-inner-container {
max-width: var(--d-max-width);
width: 100dvw;
}
&.--mode-inline {
.modal-inner-container {
width: auto;
}
}
.modal-body:not(.theme-change-modal-body) {
min-height: 65dvh;
}
.d-modal__footer {
justify-content: space-between;
}

View File

@ -107,50 +107,6 @@
//legacy
.fixed-modal:not(#discourse-modal) {
// new <DModal /> only, not <DModalLegacy />
pointer-events: none; // Allow clicks through wrappers so they hit the adjacent backdrop element
}
.modal-outer-container {
width: 100%;
height: 100%;
}
.modal-middle-container {
display: flex;
height: 100%;
align-items: center;
}
.modal-inner-container {
pointer-events: auto;
--modal-max-width: 47em; // set in ems to scale with user font-size
box-sizing: border-box;
flex: 0 1 auto;
margin: 0 auto;
max-width: var(--modal-max-width);
background-color: var(--secondary);
box-shadow: var(--shadow-modal);
.select-kit {
width: 220px;
&.tag-chooser {
width: 100%;
}
}
}
.modal-open {
.popover {
z-index: z("modal", "popover");
}
.tooltip {
z-index: z("modal", "tooltip");
}
}
.input-hint-text {
margin-left: 0.5em;
color: var(--secondary-high);
@ -190,40 +146,6 @@
}
}
.inline-modal {
.modal-inner-container {
border: 1px solid var(--secondary-medium);
}
}
.fixed-modal {
position: fixed;
top: 0;
width: 100%;
height: 100%;
z-index: z("modal", "content");
overflow: auto;
html.keyboard-visible body.ios-safari-composer-hacks & {
height: calc(var(--composer-vh, 1vh) * 100);
.modal-inner-container {
max-height: 100%;
margin-bottom: 0px;
}
}
&:not(.bookmark-reminder-modal):not(.history-modal) {
.modal-body:not(.reorder-categories):not(.poll-ui-builder):not(
.poll-breakdown
) {
max-height: 80vh !important;
@media screen and (max-height: 500px) {
max-height: 65vh !important;
}
}
}
}
.modal-form {
margin-bottom: 0;
}
@ -242,98 +164,6 @@
display: none;
}
.modal-body {
overflow-y: auto;
max-height: 400px;
padding: 1em;
&.full-height-modal {
max-height: calc(100vh - 150px);
}
&.insert-link {
overflow-y: visible;
input {
min-width: 300px;
}
.inputs {
position: relative;
.spinner {
position: absolute;
right: 8px;
top: -15px;
width: 10px;
height: 10px;
}
.internal-link-results {
position: absolute;
top: 70%;
padding: 5px 10px;
box-shadow: var(--shadow-card);
z-index: 5;
background-color: var(--secondary);
max-height: 150px;
width: 90%;
overflow-y: auto;
> .search-link {
padding: 6px;
border-bottom: 1px solid var(--primary-low);
cursor: pointer;
display: block;
&:hover,
&:focus {
background-color: var(--highlight-bg);
}
.search-category {
display: flex;
align-items: center;
}
.discourse-tags {
font-size: var(--font-down-1);
}
}
}
}
}
textarea {
width: 100%;
height: 80px;
box-sizing: border-box;
}
p {
font-size: var(--font-0);
}
.archetype-option {
margin-bottom: 20px;
}
.warning {
color: var(--danger) !important;
}
}
.password-confirmation {
display: none;
}
section.field {
padding: 0.25em 0;
margin-bottom: 5px;
&.with-items {
display: flex;
align-items: flex-start;
}
.field-item {
display: inline-block;
margin-right: 10px;
}
}
// password reset modal
.modal-body.forgot-password-modal p {
font-size: var(--font-0);
}
pre code {
white-space: pre-wrap;
max-width: var(--modal-max-width);
@ -493,41 +323,6 @@
}
}
.modal .modal-body.change-timestamp {
#date-container {
.pika-single {
width: 100%;
box-sizing: border-box;
display: flex;
justify-content: center;
}
}
form {
display: flex;
.date-picker-wrapper,
input[type="time"] {
width: 50%;
}
.date-picker-wrapper {
display: flex;
flex: 1;
.date-picker {
flex: 1;
}
}
input.date-picker,
input[type="time"] {
text-align: left;
margin: 0;
}
}
}
.change-timestamp {
width: 28em; // scales with user font-size
max-width: 90vw; // prevents overflow due to extra large user font-size
@ -641,14 +436,6 @@
}
}
.modal-body .codeblock-buttons {
margin: 0;
button {
top: 21px;
}
}
.json-editor-btn-delete {
@extend .btn-danger;
@extend .no-text;

View File

@ -591,7 +591,3 @@
margin-bottom: 0.5em;
}
}
.flag-modal .modal-inner-container .select-kit.reviewable-action-dropdown {
width: initial;
}

View File

@ -1,21 +1,4 @@
.modal.revise-and-reject-reviewable {
.modal-inner-container {
max-width: 30em;
}
.modal-body {
.control-label {
font-weight: 700;
}
.select-kit {
width: 100%;
summary {
height: 100%;
}
}
}
.revise-and-reject-reviewable__optional {
margin-left: 0.5em;
color: var(--primary-low-mid);

View File

@ -144,14 +144,10 @@
margin-right: auto;
cursor: move;
-webkit-user-drag: element;
user-drag: element;
}
.dragging {
opacity: 0.4;
}
.modal-inner-container {
width: var(--modal-max-width);
}
form {
margin-bottom: 0;
}
@ -263,13 +259,6 @@
.select-kit.multi-select .multi-select-header .formatted-selection {
display: none;
}
.modal-inner-container .select-kit {
width: 100%;
height: 100%;
.select-kit-header {
height: 100%;
}
}
.select-kit.is-expanded .select-kit-body {
min-width: 220px;
}

View File

@ -1509,33 +1509,6 @@ iframe {
position: relative;
}
.fullscreen-table-modal .modal-inner-container,
.fullscreen-code-modal .modal-inner-container {
width: max-content;
max-width: 90%;
margin: 0 auto;
padding: 10px;
.modal-body {
padding-top: 0;
}
thead {
position: sticky;
top: 0;
z-index: 1;
background-color: var(--secondary);
}
tbody {
overflow-x: hidden;
}
td {
padding: 0.5rem;
}
}
.fullscreen-code-modal {
pre code {
max-width: none;

View File

@ -820,12 +820,6 @@
}
}
.d-modal[class*="second-factor-"] {
.modal-inner-container {
max-width: 24em;
}
}
.backup-codes {
margin: 1em 0;

View File

@ -1,4 +1,3 @@
.modal-inner-container .d-time-input,
.d-time-input {
display: inline-flex;

View File

@ -55,7 +55,6 @@
}
.jump-to-post-modal {
.modal-body,
.d-modal__body {
overflow-y: visible;
#post-jump {

View File

@ -23,8 +23,7 @@
flex-direction: column;
align-items: flex-start;
.d-modal__container,
.modal-inner-container {
.d-modal__container {
--modal-max-width: $reply-area-max-width;
width: 100%;
height: 100%;
@ -34,11 +33,6 @@
grid-template-rows: auto 1fr auto;
}
.modal-body {
padding: 0;
margin: 0;
}
.d-modal__footer {
justify-content: space-between;

View File

@ -37,20 +37,9 @@
.category-chooser {
width: 50%;
}
.modal-body.insert-link {
input {
min-width: 450px;
}
}
}
.choose-topic-modal {
.modal-body {
position: relative;
min-height: 350px;
}
#choosing-topic {
// prevents content from moving when user selects different move options 525px
// is the same width we set on category edit modal
@ -92,12 +81,6 @@
}
}
.change-post-notice-modal {
.modal-body {
min-width: 450px;
}
}
.create-invite-modal,
.create-invite-bulk-modal,
.share-topic-modal {
@ -109,14 +92,4 @@
margin-left: 0.5em;
}
}
&.modal .modal-body {
margin: 1em;
padding: unset;
}
.modal-inner-container {
width: 40em; // scale with user font-size
max-width: 100vw; // prevent overflow if user font-size is enormous
}
}

View File

@ -63,14 +63,6 @@ html:not(.keyboard-visible.mobile-view) {
}
//legacy
.modal-open #main {
overflow: hidden;
}
.modal-middle-container {
max-width: 100%;
margin-bottom: 30px; // For iOS Safari issues
}
.modal {
&.fade {
@ -80,15 +72,6 @@ html:not(.keyboard-visible.mobile-view) {
&.fade.in {
top: 50%;
}
.modal-body {
padding: 0.667em;
overflow-y: scroll;
> * {
// adding box-sizing: border-box; to .modal-body causes iOS dropdown issues
box-sizing: border-box;
}
}
}
.close {
@ -100,27 +83,3 @@ html:not(.keyboard-visible.mobile-view) {
height: 3em;
}
}
/* fix for tall modals */
.fixed-modal {
.modal-middle-container {
margin-bottom: 0;
}
.modal-inner-container {
max-height: 90vh;
overflow: auto;
}
&.insert-hyperlink-modal .modal-inner-container {
overflow: visible;
}
html.keyboard-visible:not(.ios-device) & {
height: calc(100% - env(keyboard-inset-height));
.modal-inner-container {
margin: auto;
}
}
}

View File

@ -1,8 +1,4 @@
.chat-modal-create-channel {
.modal-inner-container {
width: 500px;
}
.choose-topic-results-list {
max-height: 200px;
overflow-y: scroll;

View File

@ -4,30 +4,6 @@
background: transparent;
}
.modal-body {
padding: 0;
}
.modal-inner-container {
width: var(--modal-max-width);
box-shadow: var(--shadow-dropdown);
overflow: hidden;
}
.mobile-device & {
.modal-inner-container {
border-radius: 0;
margin: 0 auto auto auto;
box-shadow: var(--shadow-modal);
}
}
.not-mobile-device & {
.modal-inner-container {
margin: 10px auto auto auto;
}
}
.chat-message-creator__search,
.chat-message-creator__new-group {
display: flex;

View File

@ -58,12 +58,6 @@ html.has-full-page-chat {
padding: 0.5em;
}
.create-channel-modal {
.modal-inner-container {
width: 95%;
}
}
.chat-message-separator {
margin-left: 0;
}

View File

@ -1,9 +0,0 @@
.chat-modal-new-message {
.modal-inner-container {
max-height: 100vh;
}
.modal-body {
max-height: inherit;
}
}

View File

@ -17,7 +17,6 @@
@import "chat-channel-members";
@import "chat-channel-settings";
@import "chat-form";
@import "chat-modal-new-message";
@import "chat-modal-thread-settings";
@import "chat-navbar";
@import "chat-thread-list-header";

View File

@ -1,19 +1,7 @@
.poll-breakdown.modal {
.modal-inner-container {
max-width: unset;
width: 90vw;
}
.modal-tabs {
justify-content: flex-end;
}
.modal-body {
display: grid;
height: 80vh;
grid: auto-flow / 2fr 5fr;
padding: 0;
}
}
.poll-breakdown-sidebar {

View File

@ -1,13 +1,4 @@
.poll-ui-builder.modal {
.modal-inner-container {
width: 40em; // scale with user font-size
max-width: 100vw; // prevent overflow if user font-size is enormous
}
.modal-body {
max-height: unset;
}
.poll-number {
margin-right: 10px;