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", "name": "sengi",
"version": "0.18.0", "version": "0.18.1",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"main": "main-electron.js", "main": "main-electron.js",
"description": "A multi-account desktop client for Mastodon and Pleroma", "description": "A multi-account desktop client for Mastodon and Pleroma",

View File

@ -1,6 +1,6 @@
<form class="status-editor" (ngSubmit)="onSubmit()"> <form class="status-editor" (ngSubmit)="onSubmit()">
<input [(ngModel)]="title" type="text" class="form-control form-control-sm status-editor__title" name="title" <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" <a class="status-editor__emoji" title="Insert Emoji"
#emojiButton href (click)="openEmojiPicker($event)"> #emojiButton href (click)="openEmojiPicker($event)">
@ -9,7 +9,7 @@
<textarea #reply [(ngModel)]="status" name="status" class="form-control form-control-sm status-editor__content" <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()" 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> </textarea>
<div class="status-editor__mention-error" *ngIf="mentionTooFarAwayError">Error: mentions must be placed closer to <div class="status-editor__mention-error" *ngIf="mentionTooFarAwayError">Error: mentions must be placed closer to
@ -80,4 +80,4 @@
</ng-template> </ng-template>
</context-menu> </context-menu>
<app-media></app-media> <app-media></app-media>
</form> </form>

View File

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

View File

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