mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 16:46:12 +08:00
DEV: Replace modal 'maxHeight' calculation with css
This commit is contained in:
parent
ad431ab03a
commit
f2482b5daa
|
@ -1,5 +1,4 @@
|
|||
import Component from "@glimmer/component";
|
||||
import { scheduleOnce } from "@ember/runloop";
|
||||
import { disableImplicitInjections } from "discourse/lib/implicit-injections";
|
||||
import { action } from "@ember/object";
|
||||
import { tracked } from "@glimmer/tracking";
|
||||
|
@ -31,25 +30,6 @@ export default class DModalBody extends Component {
|
|||
$(fixedParent).modal("show");
|
||||
}
|
||||
|
||||
scheduleOnce("afterRender", () => this._afterFirstRender(element));
|
||||
}
|
||||
|
||||
@action
|
||||
willDestroy() {
|
||||
this.appEvents.trigger("modal:body-dismissed");
|
||||
}
|
||||
|
||||
_afterFirstRender(element) {
|
||||
const maxHeight = this.args.maxHeight;
|
||||
if (maxHeight) {
|
||||
const maxHeightFloat = parseFloat(maxHeight) / 100.0;
|
||||
if (maxHeightFloat > 0) {
|
||||
const viewPortHeight = $(window).height();
|
||||
element.style.maxHeight =
|
||||
Math.floor(maxHeightFloat * viewPortHeight) + "px";
|
||||
}
|
||||
}
|
||||
|
||||
this.appEvents.trigger(
|
||||
"modal:body-shown",
|
||||
pick(this.args, [
|
||||
|
@ -64,4 +44,9 @@ export default class DModalBody extends Component {
|
|||
])
|
||||
);
|
||||
}
|
||||
|
||||
@action
|
||||
willDestroy() {
|
||||
this.appEvents.trigger("modal:body-dismissed");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<DModalBody @title={{this.modalTitleKey}} @maxHeight="70%">
|
||||
<DModalBody @title={{this.modalTitleKey}}>
|
||||
<div id="revision">
|
||||
<div id="revision-details">
|
||||
{{d-icon "pencil-alt"}}
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
<DModalBody
|
||||
@title="raw_email.title"
|
||||
@class="incoming-email-modal"
|
||||
@maxHeight="80%"
|
||||
>
|
||||
<DModalBody @title="raw_email.title" @class="incoming-email-modal">
|
||||
<div class="incoming-email-tabs">
|
||||
<DButton
|
||||
@action={{action "displayRaw"}}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
// styles that apply to the popup that appears when you show the edit history of a post
|
||||
|
||||
.modal.history-modal {
|
||||
.modal-body {
|
||||
max-height: 70vh;
|
||||
}
|
||||
|
||||
#revision-numbers {
|
||||
display: inline-block;
|
||||
min-width: 96px;
|
||||
|
|
|
@ -392,6 +392,8 @@
|
|||
}
|
||||
|
||||
.incoming-email-modal {
|
||||
max-height: 80vh;
|
||||
|
||||
.btn {
|
||||
transition: none;
|
||||
background-color: transparent;
|
||||
|
|
Loading…
Reference in New Issue
Block a user