added some translation cleanup
This commit is contained in:
parent
92a3ac6ae3
commit
4a2b408c1b
@ -205,6 +205,10 @@ export class DatabindedTextComponent implements OnInit {
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.processEventBindings();
|
||||
}
|
||||
|
||||
processEventBindings(){
|
||||
for (const hashtag of this.hashtags) {
|
||||
let classname = this.getClassNameForHastag(hashtag);
|
||||
let els = <Element[]>this.contentElement.nativeElement.querySelectorAll(`.${classname}`);
|
||||
|
@ -109,7 +109,7 @@
|
||||
<span class="status__content-warning--title">sensitive content</span>
|
||||
<span innerHTML="{{ contentWarningText }}"></span>
|
||||
</a>
|
||||
<app-databinded-text class="status__content" *ngIf="!isContentWarned" [text]="statusContent" [selected]="isSelected"
|
||||
<app-databinded-text #databindedtext class="status__content" *ngIf="!isContentWarned" [text]="statusContent" [selected]="isSelected"
|
||||
(accountSelected)="accountSelected($event)" (hashtagSelected)="hashtagSelected($event)"
|
||||
(textSelected)="textSelected()"></app-databinded-text>
|
||||
|
||||
|
@ -9,7 +9,7 @@ import { StatusWrapper } from '../../../models/common.model';
|
||||
import { EmojiConverter, EmojiTypeEnum } from '../../../tools/emoji.tools';
|
||||
import { ContentWarningPolicyEnum } from '../../../states/settings.state';
|
||||
import { StatusesStateService, StatusState } from "../../../services/statuses-state.service";
|
||||
|
||||
import { DatabindedTextComponent } from "./databinded-text/databinded-text.component";
|
||||
|
||||
@Component({
|
||||
selector: "app-status",
|
||||
@ -158,8 +158,29 @@ export class StatusComponent implements OnInit {
|
||||
this.isContentWarned = cwIsActive;
|
||||
}
|
||||
|
||||
|
||||
@ViewChild('databindedtext') public databindedText: DatabindedTextComponent;
|
||||
|
||||
onTranslation(translation: Translation) {
|
||||
this.statusContent = translation.content;
|
||||
let statusContent = translation.content;
|
||||
|
||||
// clean up a bit some issues (not reliable)
|
||||
while (statusContent.includes('<span>@')) {
|
||||
statusContent = statusContent.replace('<span>@', '@<span>');
|
||||
}
|
||||
while (statusContent.includes('h<span class="invisible">')){
|
||||
statusContent = statusContent.replace('h<span class="invisible">', '<span class="invisible">h');
|
||||
}
|
||||
while (statusContent.includes('<span>#')){
|
||||
statusContent = statusContent.replace('<span>#', '#<span>');
|
||||
}
|
||||
|
||||
statusContent = this.emojiConverter.applyEmojis(this.displayedStatus.emojis, statusContent, EmojiTypeEnum.medium);
|
||||
this.statusContent = this.ensureMentionAreDisplayed(statusContent);
|
||||
|
||||
setTimeout(x => {
|
||||
this.databindedText.processEventBindings();
|
||||
}, 500);
|
||||
}
|
||||
|
||||
private checkLabels(status: Status) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user