mirror of
https://github.com/flarum/framework.git
synced 2025-02-18 12:33:22 +08:00
Extract a few changes from the Mithril 2 upgrade (#2262)
* Fix closing the composer with ESC key Regression from #2161. * Remove obsolete method Regression from #2162. * Mark method as protected * Fade in posts in post stream using CSS This also avoids a double-fade from the JavaScript code, which was probably introduced in #2160. * Fix fadeIn for post stream items Co-authored-by: Alexander Skvortsov <sasha.skvortsov109@gmail.com>
This commit is contained in:
parent
776af72c22
commit
22e813c742
|
@ -105,8 +105,6 @@ export default class Modal extends Component {
|
||||||
this.$('form').find('input, select, textarea').first().focus().select();
|
this.$('form').find('input, select, textarea').first().focus().select();
|
||||||
}
|
}
|
||||||
|
|
||||||
onhide() {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hide the modal.
|
* Hide the modal.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -82,7 +82,7 @@ export default class Composer extends Component {
|
||||||
});
|
});
|
||||||
|
|
||||||
// When the escape key is pressed on any inputs, close the composer.
|
// When the escape key is pressed on any inputs, close the composer.
|
||||||
this.$().on('keydown', ':input', 'esc', () => this.close());
|
this.$().on('keydown', ':input', 'esc', () => this.state.close());
|
||||||
|
|
||||||
const handlers = {};
|
const handlers = {};
|
||||||
|
|
||||||
|
|
|
@ -24,11 +24,6 @@ export default class PostStream extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
view() {
|
view() {
|
||||||
function fadeIn(element, isInitialized, context) {
|
|
||||||
if (!context.fadedIn) $(element).hide().fadeIn();
|
|
||||||
context.fadedIn = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
let lastTime;
|
let lastTime;
|
||||||
|
|
||||||
const viewingEnd = this.stream.viewingEnd();
|
const viewingEnd = this.stream.viewingEnd();
|
||||||
|
@ -45,7 +40,6 @@ export default class PostStream extends Component {
|
||||||
content = PostComponent ? PostComponent.component({ post }) : '';
|
content = PostComponent ? PostComponent.component({ post }) : '';
|
||||||
|
|
||||||
attrs.key = 'post' + post.id();
|
attrs.key = 'post' + post.id();
|
||||||
attrs.config = fadeIn;
|
|
||||||
attrs['data-time'] = time.toISOString();
|
attrs['data-time'] = time.toISOString();
|
||||||
attrs['data-number'] = post.number();
|
attrs['data-number'] = post.number();
|
||||||
attrs['data-id'] = post.id();
|
attrs['data-id'] = post.id();
|
||||||
|
|
|
@ -177,7 +177,7 @@ export default class SignUpModal extends Modal {
|
||||||
* Get the data that should be submitted in the sign-up request.
|
* Get the data that should be submitted in the sign-up request.
|
||||||
*
|
*
|
||||||
* @return {Object}
|
* @return {Object}
|
||||||
* @public
|
* @protected
|
||||||
*/
|
*/
|
||||||
submitData() {
|
submitData() {
|
||||||
const data = {
|
const data = {
|
||||||
|
|
|
@ -6,7 +6,18 @@
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes fadeIn {
|
||||||
|
0% {opacity: 0}
|
||||||
|
100% {opacity: 1}
|
||||||
|
}
|
||||||
|
@keyframes fadeIn {
|
||||||
|
0% {opacity: 0}
|
||||||
|
100% {opacity: 1}
|
||||||
|
}
|
||||||
.PostStream-item {
|
.PostStream-item {
|
||||||
|
.animation(fadeIn 0.6s ease-in-out);
|
||||||
|
|
||||||
&:not(:last-child) {
|
&:not(:last-child) {
|
||||||
border-bottom: 1px solid @control-bg;
|
border-bottom: 1px solid @control-bg;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user