Fix live preview

This commit is contained in:
Toby Zerner 2018-09-21 11:41:32 +09:30
parent 78050e8c4e
commit 8d67e6dcf5
3 changed files with 4 additions and 2 deletions

View File

@ -70,3 +70,5 @@ app.initializers.add('flarum-mentions', function() {
// Remove post mentions when rendering post previews.
getPlainContent.removeSelectors.push('a.PostMention');
});
export * from './utils/textFormatter';

View File

@ -65,7 +65,7 @@ class FormatPostMentions
$tag->filterChain
->prepend([static::class, 'addId'])
->setJS('function(tag) { return System.get("flarum/mentions/utils/textFormatter").filterPostMentions(tag); }');
->setJS('function(tag) { return flarum.extensions["flarum-mentions"].filterPostMentions(tag); }');
$configurator->Preg->match('/\B@(?<username>[a-z0-9_-]+)#(?<id>\d+)/i', $tagName);
}

View File

@ -60,7 +60,7 @@ class FormatUserMentions
$tag->template = '<a href="{$PROFILE_URL}{@username}" class="UserMention">@<xsl:value-of select="@displayname"/></a>';
$tag->filterChain->prepend([static::class, 'addId'])
->setJS('function(tag) { return System.get("flarum/mentions/utils/textFormatter").filterUserMentions(tag); }');
->setJS('function(tag) { return flarum.extensions["flarum-mentions"].filterUserMentions(tag); }');
$configurator->Preg->match('/\B@(?<username>[a-z0-9_-]+)(?!#)/i', $tagName);
}