1
0
mirror of https://github.com/flarum/core.git synced 2025-08-02 14:37:49 +02:00

Fix post mention preview behaviour on mobile

This commit is contained in:
Toby Zerner
2015-07-28 17:59:00 +09:30
parent 30d17308ea
commit 7f05f8ab22

View File

@@ -13,7 +13,7 @@ export default function addPostMentionPreviews() {
const discussion = this.props.post.discussion(); const discussion = this.props.post.discussion();
this.$('.UserMention').each(function() { this.$('.UserMention, .PostMention').each(function() {
m.route.call(this, this, false, {}, {attrs: {href: this.getAttribute('href')}}); m.route.call(this, this, false, {}, {attrs: {href: this.getAttribute('href')}});
}); });
@@ -51,7 +51,7 @@ export default function addPostMentionPreviews() {
// hasn't yet been loaded, we will need to do that. // hasn't yet been loaded, we will need to do that.
if (!visible) { if (!visible) {
// Position the preview so that it appears above the mention. // Position the preview so that it appears above the mention.
// (The offsetParent should be .post-body.) // (The offsetParent should be .Post-body.)
const positionPreview = () => { const positionPreview = () => {
$preview.show().css('top', $this.offset().top - $this.offsetParent().offset().top - $preview.outerHeight(true)); $preview.show().css('top', $this.offset().top - $this.offsetParent().offset().top - $preview.outerHeight(true));
}; };
@@ -94,7 +94,7 @@ export default function addPostMentionPreviews() {
timeout = setTimeout(hidePreview, 250); timeout = setTimeout(hidePreview, 250);
} }
) )
.on('click', e => e.preventDefault()) .on('touchstart', e => e.preventDefault())
.on('touchend', e => { .on('touchend', e => {
showPreview(); showPreview();
e.stopPropagation(); e.stopPropagation();