Browse Source

Fix mentions.

pull/1139/head
Sebastian Stehle 2 years ago
parent
commit
fbd7931d1f
  1. 4
      frontend/src/app/shared/components/comments/comment.component.ts
  2. 2
      frontend/src/app/shared/components/comments/comments.component.html
  3. 1
      frontend/src/app/shared/components/comments/comments.component.scss
  4. 7
      frontend/src/app/shared/components/comments/comments.component.ts

4
frontend/src/app/shared/components/comments/comment.component.ts

@ -70,7 +70,7 @@ export class CommentComponent extends StatefulComponent<State> {
public userToken = ''; public userToken = '';
@Input() @Input()
public currenUrl = ''; public currentUrl = '';
@Input({ required: true }) @Input({ required: true })
public mentionUsers?: ReadonlyArray<ContributorDto>; public mentionUsers?: ReadonlyArray<ContributorDto>;
@ -133,7 +133,7 @@ export class CommentComponent extends StatefulComponent<State> {
if (text && text.length > 0 && this.commentItem.comment.id) { if (text && text.length > 0 && this.commentItem.comment.id) {
const replyTo = this.commentItem.comment.id!; const replyTo = this.commentItem.comment.id!;
this.comments.create(this.userToken, text, this.currenUrl, { replyTo }); this.comments.create(this.userToken, text, this.currentUrl, { replyTo });
} }
this.replyForm.submitCompleted(); this.replyForm.submitCompleted();

2
frontend/src/app/shared/components/comments/comments.component.html

@ -23,7 +23,7 @@
canFollow="false" canFollow="false"
[commentItem]="comment" [commentItem]="comment"
[comments]="commentsState" [comments]="commentsState"
[currenUrl]="router.url" [currentUrl]="router.url"
[mentionConfig]="mentionConfig" [mentionConfig]="mentionConfig"
[mentionUsers]="users" [mentionUsers]="users"
[scrollContainer]="'.comments-list'" [scrollContainer]="'.comments-list'"

1
frontend/src/app/shared/components/comments/comments.component.scss

@ -4,6 +4,7 @@
:host ::ng-deep { :host ::ng-deep {
.mention-menu { .mention-menu {
border-color: $color-border !important; border-color: $color-border !important;
max-width: 290px;
} }
.mention-active > a { .mention-active > a {

7
frontend/src/app/shared/components/comments/comments.component.ts

@ -11,7 +11,7 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { MentionConfig, MentionModule } from 'angular-mentions'; import { MentionConfig, MentionModule } from 'angular-mentions';
import { BehaviorSubject } from 'rxjs'; import { BehaviorSubject } from 'rxjs';
import { MessageBus, ResizedDirective, Subscriptions, TranslatePipe } from '@app/framework'; import { MessageBus, Subscriptions, TranslatePipe } from '@app/framework';
import { AnnotationCreateAfterNavigate, AnnotationsSelectAfterNavigate, AuthService, CommentsState, ContributorsState, UpsertCommentForm } from '@app/shared/internal'; import { AnnotationCreateAfterNavigate, AnnotationsSelectAfterNavigate, AuthService, CommentsState, ContributorsState, UpsertCommentForm } from '@app/shared/internal';
import { CommentComponent } from './comment.component'; import { CommentComponent } from './comment.component';
@ -26,7 +26,6 @@ import { CommentComponent } from './comment.component';
FormsModule, FormsModule,
MentionModule, MentionModule,
ReactiveFormsModule, ReactiveFormsModule,
ResizedDirective,
TranslatePipe, TranslatePipe,
], ],
}) })
@ -42,7 +41,7 @@ export class CommentsComponent implements OnInit {
public commentsId = ''; public commentsId = '';
public mentionUsers = this.contributorsState.contributors; public mentionUsers = this.contributorsState.contributors;
public mentionConfig: MentionConfig = { dropUp: true, labelKey: 'contributorEmail' }; public mentionConfig: MentionConfig = { dropUp: false, labelKey: 'contributorEmail' };
public commentForm = new UpsertCommentForm(); public commentForm = new UpsertCommentForm();
public commentsItems = this.commentsState.getGroupedComments(this.selection); public commentsItems = this.commentsState.getGroupedComments(this.selection);
@ -58,6 +57,8 @@ export class CommentsComponent implements OnInit {
} }
public ngOnInit() { public ngOnInit() {
this.contributorsState.loadIfNotLoaded();
this.subscriptions.add( this.subscriptions.add(
this.messageBus.of(AnnotationsSelectAfterNavigate) this.messageBus.of(AnnotationsSelectAfterNavigate)
.subscribe(message => { .subscribe(message => {

Loading…
Cancel
Save