Merge pull request #185 from NicolasConstant/develop

0.18.1 PR
This commit is contained in:
Nicolas Constant 2019-10-11 23:17:05 -04:00 committed by GitHub
commit a23db9b30e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 17 deletions

View File

@ -1,6 +1,6 @@
{
"name": "sengi",
"version": "0.18.0",
"version": "0.18.1",
"license": "AGPL-3.0-or-later",
"main": "main-electron.js",
"description": "A multi-account desktop client for Mastodon and Pleroma",

View File

@ -1,6 +1,6 @@
<form class="status-editor" (ngSubmit)="onSubmit()">
<input [(ngModel)]="title" type="text" class="form-control form-control-sm status-editor__title" name="title"
autocomplete="off" placeholder="Title, Content Warning (optional)" title="title, content warning (optional)" />
autocomplete="off" placeholder="Title, Content Warning (optional)" title="title, content warning (optional)" dir="auto" />
<a class="status-editor__emoji" title="Insert Emoji"
#emojiButton href (click)="openEmojiPicker($event)">
@ -9,7 +9,7 @@
<textarea #reply [(ngModel)]="status" name="status" class="form-control form-control-sm status-editor__content"
rows="5" required title="content" placeholder="What's in your mind?" (keydown.control.enter)="onCtrlEnter()"
(keydown)="handleKeyDown($event)" (blur)="statusTextEditorLostFocus()">
(keydown)="handleKeyDown($event)" (blur)="statusTextEditorLostFocus()" dir="auto">
</textarea>
<div class="status-editor__mention-error" *ngIf="mentionTooFarAwayError">Error: mentions must be placed closer to
@ -80,4 +80,4 @@
</ng-template>
</context-menu>
<app-media></app-media>
</form>
</form>

View File

@ -224,18 +224,24 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
private detectAutosuggestion(status: string) {
if (!this.statusLoaded) return;
if(!status.includes('@') && !status.includes('#')){
this.autosuggestData = null;
this.hasSuggestions = false;
return;
}
const caretPosition = this.replyElement.nativeElement.selectionStart;
const lastChar = status.substr(caretPosition - 1, 1);
const lastCharIsSpace = lastChar === ' ';
const splitedStatus = status.split(/(\r\n|\n|\r)/);
let offset = 0;
let currentSection = '';
for(let x of splitedStatus){
const sectionLength = [...x].length;
if(offset + sectionLength >= caretPosition){
let currentSection = '';
for (let x of splitedStatus) {
const sectionLength = x.length;
if (offset + sectionLength >= caretPosition) {
currentSection = x;
break;
} else {
@ -248,6 +254,7 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
this.autosuggestData = word;
return;
}
this.autosuggestData = null;
this.hasSuggestions = false;
}
@ -328,7 +335,7 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
this.toolsService.getInstanceInfo(this.selectedAccount)
.then((instance: InstanceInfo) => {
if(instance.type === InstanceType.Pixelfed){
if (instance.type === InstanceType.Pixelfed) {
this.instanceSupportsPoll = false;
this.instanceSupportsScheduling = false;
this.pollIsActive = false;
@ -337,7 +344,7 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
this.instanceSupportsPoll = true;
this.instanceSupportsScheduling = true;
}
});
});
}
}
@ -489,9 +496,9 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
}
let scheduledTime = null;
if(this.scheduleIsActive){
if (this.scheduleIsActive) {
scheduledTime = this.statusScheduler.getScheduledDate();
if(!scheduledTime || scheduledTime === '') {
if (!scheduledTime || scheduledTime === '') {
this.isSending = false;
return;
}
@ -506,7 +513,7 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
this.status = '';
this.onClose.emit();
if(this.scheduleIsActive){
if (this.scheduleIsActive) {
this.scheduledStatusService.statusAdded(acc);
}
})

View File

@ -170,17 +170,19 @@ export class StreamStatusesComponent implements OnInit, OnDestroy {
@ViewChild('statusstream') public statustream: ElementRef;
private applyGoToTop(): boolean {
this.loadBuffer();
// this.loadBuffer();
if (this.statuses.length > 2 * this.streamingService.nbStatusPerIteration) {
this.statuses.length = 2 * this.streamingService.nbStatusPerIteration;
}
const stream = this.statustream.nativeElement as HTMLElement;
setTimeout(() => {
stream.scrollTo({
top: 0,
behavior: 'smooth'
});
}, 10);
}, 0);
return false;
}