mirror of
https://github.com/flarum/core.git
synced 2025-08-13 03:44:32 +02:00
chore: simplify checking of current composer
This commit is contained in:
@@ -21,10 +21,7 @@ export default class PostMention extends MentionableModel<Post, AtMentionFormat>
|
||||
* match any username characters that have been typed.
|
||||
*/
|
||||
initialResults(): Post[] {
|
||||
const EditPostComposer = flarum.reg.checkModule('core', 'forum/components/EditPostComposer');
|
||||
const ReplyComposer = flarum.reg.checkModule('core', 'forum/components/ReplyComposer');
|
||||
|
||||
if ((!ReplyComposer || !app.composer.bodyMatches(ReplyComposer)) && (!EditPostComposer || !app.composer.bodyMatches(EditPostComposer))) {
|
||||
if (!app.composer.bodyMatches('flarum/forum/components/ReplyComposer') && !app.composer.bodyMatches('flarum/forum/components/EditPostComposer')) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
@@ -26,9 +26,7 @@ export function insertMention(post, composer, quote) {
|
||||
}
|
||||
|
||||
export default function reply(post, quote) {
|
||||
const EditPostComposer = flarum.reg.checkModule('core', 'forum/components/EditPostComposer');
|
||||
|
||||
if (EditPostComposer && app.composer.bodyMatches(EditPostComposer) && app.composer.body.attrs.post.discussion() === post.discussion()) {
|
||||
if (app.composer.bodyMatches('flarum/forum/components/EditPostComposer') && app.composer.body.attrs.post.discussion() === post.discussion()) {
|
||||
// If we're already editing a post in the discussion of post we're quoting,
|
||||
// insert the mention directly.
|
||||
return insertMention(post, app.composer, quote);
|
||||
|
Reference in New Issue
Block a user