From 900652e5e8a2c4f1e374961a0f8b809c3a059513 Mon Sep 17 00:00:00 2001 From: Mostafa Ahangarha Date: Wed, 9 Oct 2019 19:07:11 +0330 Subject: [PATCH 1/4] WIP - add bidi support for creating status Added `dir="auto"` attribution to make the input fields automatically detect the direction of text and render it properly specially for RTL texts. --- .../components/create-status/create-status.component.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/components/create-status/create-status.component.html b/src/app/components/create-status/create-status.component.html index 21b858f4..02b32efa 100644 --- a/src/app/components/create-status/create-status.component.html +++ b/src/app/components/create-status/create-status.component.html @@ -1,6 +1,6 @@
+ autocomplete="off" placeholder="Title, Content Warning (optional)" title="title, content warning (optional)" dir="auto" /> @@ -9,7 +9,7 @@
Error: mentions must be placed closer to @@ -80,4 +80,4 @@ - \ No newline at end of file + From 24324ddccb8943d40d375a604a9643cc1b37e132 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Fri, 11 Oct 2019 19:59:53 -0400 Subject: [PATCH 2/4] fix autosuggest not opening with emoji --- .../create-status/create-status.component.ts | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/app/components/create-status/create-status.component.ts b/src/app/components/create-status/create-status.component.ts index 6a996ca1..83d29114 100644 --- a/src/app/components/create-status/create-status.component.ts +++ b/src/app/components/create-status/create-status.component.ts @@ -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); } }) From 85cc61df8a72d943ac7ce3bafe35786b12d48507 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Fri, 11 Oct 2019 22:42:08 -0400 Subject: [PATCH 3/4] fix firefox gototop --- .../stream/stream-statuses/stream-statuses.component.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/components/stream/stream-statuses/stream-statuses.component.ts b/src/app/components/stream/stream-statuses/stream-statuses.component.ts index bbe771a2..ddf7dc48 100644 --- a/src/app/components/stream/stream-statuses/stream-statuses.component.ts +++ b/src/app/components/stream/stream-statuses/stream-statuses.component.ts @@ -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; } From ce0e7f09cd13d68b3071ae5d0991851eca2ed8f1 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Fri, 11 Oct 2019 23:02:10 -0400 Subject: [PATCH 4/4] road to 0.18.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 95068f20..4f6b6d3b 100644 --- a/package.json +++ b/package.json @@ -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",