Merge pull request #179 from NicolasConstant/fix_nav-issues
Fix nav issues
This commit is contained in:
commit
f8e1a49218
|
@ -29,6 +29,7 @@ export class AutosuggestComponent implements OnInit, OnDestroy {
|
|||
this._pattern = value;
|
||||
this.analysePattern(value);
|
||||
} else {
|
||||
this._pattern = null;
|
||||
this.accounts.length = 0;
|
||||
this.hashtags.length = 0;
|
||||
}
|
||||
|
|
|
@ -200,7 +200,8 @@ $counter-width: 90px;
|
|||
|
||||
.scheduler {
|
||||
display: block;
|
||||
margin: 0 5px;
|
||||
margin: 0 5px;
|
||||
border-bottom: 1px solid whitesmoke;
|
||||
}
|
||||
|
||||
@import '~@angular/cdk/overlay-prebuilt.css';
|
||||
|
|
|
@ -223,23 +223,50 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
|
|||
if (!this.statusLoaded) return;
|
||||
|
||||
const caretPosition = this.replyElement.nativeElement.selectionStart;
|
||||
const word = this.getWordByPos(status, caretPosition);
|
||||
if (word && word.length > 0 && (word.startsWith('@') || word.startsWith('#'))) {
|
||||
|
||||
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){
|
||||
currentSection = x;
|
||||
break;
|
||||
} else {
|
||||
offset += sectionLength;
|
||||
}
|
||||
};
|
||||
|
||||
const word = this.getWordByPos(currentSection, caretPosition - offset);
|
||||
if (!lastCharIsSpace && word && word.length > 0 && (word.startsWith('@') || word.startsWith('#'))) {
|
||||
this.autosuggestData = word;
|
||||
return;
|
||||
}
|
||||
this.autosuggestData = null;
|
||||
this.hasSuggestions = false;
|
||||
}
|
||||
|
||||
private getWordByPos(str, pos) {
|
||||
str = str.replace(/(\r\n|\n|\r)/gm, "");
|
||||
var left = str.substr(0, pos);
|
||||
var right = str.substr(pos);
|
||||
var preText = str.substring(0, pos);
|
||||
if (preText.indexOf(" ") > 0) {
|
||||
var words = preText.split(" ");
|
||||
return words[words.length - 1]; //return last word
|
||||
}
|
||||
else {
|
||||
return preText;
|
||||
}
|
||||
|
||||
left = left.replace(/^.+ /g, "");
|
||||
right = right.replace(/ .+$/g, "");
|
||||
// // str = str.replace(/(\r\n|\n|\r)/gm, "");
|
||||
// var left = str.substr(0, pos);
|
||||
// var right = str.substr(pos);
|
||||
|
||||
return left + right;
|
||||
// left = left.replace(/^.+ /g, "");
|
||||
// right = right.replace(/ .+$/g, "");
|
||||
|
||||
// return left + right;
|
||||
}
|
||||
|
||||
private focus(caretPos = null) {
|
||||
|
@ -477,7 +504,6 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
private sendStatus(account: AccountInfo, status: string, visibility: VisibilityEnum, title: string, previousStatus: Status, attachments: Attachment[], poll: PollParameters, scheduledAt: string): Promise<Status> {
|
||||
let parsedStatus = this.parseStatus(status);
|
||||
let resultPromise = Promise.resolve(previousStatus);
|
||||
|
@ -567,7 +593,6 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
|
|||
return status.split(' ').filter(x => x.indexOf('@') === 0 && x.length > 1);
|
||||
}
|
||||
|
||||
|
||||
suggestionSelected(selection: AutosuggestSelection) {
|
||||
if (this.status.includes(selection.pattern)) {
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
.scheduler {
|
||||
background-color: $scheduler-background;
|
||||
//margin: 0 5px;
|
||||
border-bottom: 1px solid whitesmoke;
|
||||
|
||||
&__input {
|
||||
color: whitesmoke;
|
||||
|
|
|
@ -1,38 +1,34 @@
|
|||
<div class="card" *ngIf="card.type === 'link' || card.type === 'video'">
|
||||
<a *ngIf="card.type === 'link'" class="card__link" href="{{ card.url }}" target="_blank" title="{{ card.title }}">
|
||||
<img *ngIf="card.image" class="card__link--image" src="{{ card.image }}" alt="" />
|
||||
<div *ngIf="!card.image" class="card__link--image">
|
||||
<fa-icon class="card__link--image--logo" [icon]="faFileAlt"></fa-icon>
|
||||
<div class="card-data" *ngIf="card.type === 'link' || card.type === 'video'">
|
||||
<a *ngIf="card.type === 'link'" class="card-data__link" href="{{ card.url }}" target="_blank" title="{{ card.title }}">
|
||||
<img *ngIf="card.image" class="card-data__link--image" src="{{ card.image }}" alt="" />
|
||||
<div *ngIf="!card.image" class="card-data__link--image">
|
||||
<fa-icon class="card-data__link--image--logo" [icon]="faFileAlt"></fa-icon>
|
||||
</div>
|
||||
|
||||
<h3 class="card__link--title">{{ card.title }}</h3>
|
||||
<span class="card__link--host">{{ host }}</span>
|
||||
<h3 class="card-data__link--title">{{ card.title }}</h3>
|
||||
<span class="card-data__link--host">{{ host }}</span>
|
||||
</a>
|
||||
<div *ngIf="card.type === 'photo'" class="card__photo">
|
||||
<div *ngIf="card.type === 'photo'" class="card-data__photo">
|
||||
|
||||
</div>
|
||||
<div *ngIf="card.type === 'video'" class="card__video">
|
||||
<div *ngIf="!showHtml" class="card__video--preview">
|
||||
<div class="card__video--preview--controls">
|
||||
<a href class="card__video--preview--link" (click)="play()" title="play">
|
||||
<div *ngIf="card.type === 'video'" class="card-data__video">
|
||||
<div *ngIf="!showHtml" class="card-data__video--preview">
|
||||
<div class="card-data__video--preview--controls">
|
||||
<a href class="card-data__video--preview--link" (click)="play()" title="play">
|
||||
<fa-icon [icon]="faPlay"></fa-icon>
|
||||
</a>
|
||||
<a href class="card__video--preview--link" (click)="expand()" title="open">
|
||||
<a href class="card-data__video--preview--link" (click)="expand()" title="open">
|
||||
<fa-icon [icon]="faExpand"></fa-icon>
|
||||
</a>
|
||||
<a href="{{ card.url }}" class="card__video--preview--link" target="_blank" title="browse">
|
||||
<a href="{{ card.url }}" class="card-data__video--preview--link" target="_blank" title="browse">
|
||||
<fa-icon [icon]="faExternalLinkAlt"></fa-icon>
|
||||
</a>
|
||||
</div>
|
||||
<img src="{{ card.image }}" class="card__video--preview--image" />
|
||||
<img src="{{ card.image }}" class="card-data__video--preview--image" />
|
||||
</div>
|
||||
<div #video *ngIf="showHtml" class="card__video--content" [innerHTML]="html">
|
||||
<div #video *ngIf="showHtml" class="card-data__video--content" [innerHTML]="html">
|
||||
|
||||
</div>
|
||||
<!-- {{ card.html }} -->
|
||||
<!-- <div [innerHTML]="html">
|
||||
|
||||
</div> -->
|
||||
</div>
|
||||
<div *ngIf="card.type === 'rich'" class="card__rich" [innerHTML]="html"></div>
|
||||
<div *ngIf="card.type === 'rich'" class="card-data__rich" [innerHTML]="html"></div>
|
||||
</div>
|
|
@ -1,13 +1,12 @@
|
|||
@import "variables";
|
||||
// @import "mixins";
|
||||
|
||||
.card {
|
||||
border: 1px solid $card-border-color;
|
||||
background-color: $column-background;
|
||||
.card-data {
|
||||
border-radius: 3px;
|
||||
border: 0px;
|
||||
|
||||
transition: all .2s;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
overflow: hidden;
|
||||
|
||||
&:hover {
|
||||
background-color: lighten($column-background, 5);
|
||||
|
@ -17,6 +16,9 @@
|
|||
display: block;
|
||||
text-decoration: none;
|
||||
color: whitesmoke;
|
||||
overflow: auto;
|
||||
|
||||
border: 1px solid $card-border-color;
|
||||
|
||||
&--image {
|
||||
width: 55px;
|
||||
|
|
|
@ -180,13 +180,7 @@ export class StreamStatusesComponent implements OnInit, OnDestroy {
|
|||
top: 0,
|
||||
behavior: 'smooth'
|
||||
});
|
||||
}, 0);
|
||||
setTimeout(() => {
|
||||
stream.scrollTo({
|
||||
top: 0,
|
||||
behavior: 'auto'
|
||||
});
|
||||
}, 250);
|
||||
}, 10);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import { NotificationService, NewReplyData } from '../../../services/notificatio
|
|||
import { AccountInfo } from '../../../states/accounts.state';
|
||||
import { StatusWrapper } from '../../../models/common.model';
|
||||
import { StatusComponent } from '../status/status.component';
|
||||
import scrollIntoView from 'scroll-into-view-if-needed';
|
||||
|
||||
@Component({
|
||||
selector: 'app-thread',
|
||||
|
@ -177,11 +178,11 @@ export class ThreadComponent implements OnInit, OnDestroy {
|
|||
setTimeout(() => {
|
||||
const el = this.statusChildren.toArray()[position];
|
||||
el.isSelected = true;
|
||||
// el.elem.nativeElement.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'start' });
|
||||
// el.elem.nativeElement.scrollIntoView({ behavior: 'auto', block: 'start', inline: 'nearest' });
|
||||
// el.elem.nativeElement.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'start' });
|
||||
el.elem.nativeElement.scrollIntoViewIfNeeded({ behavior: 'auto', block: 'start', inline: 'nearest' });
|
||||
}, 0);
|
||||
|
||||
//el.elem.nativeElement.scrollIntoViewIfNeeded({ behavior: 'auto', block: 'start', inline: 'nearest' });
|
||||
|
||||
scrollIntoView(el.elem.nativeElement, { behavior: 'smooth', block: 'nearest'});
|
||||
}, 250);
|
||||
})
|
||||
.catch((err: HttpErrorResponse) => {
|
||||
this.notificationService.notifyHttpError(err, currentAccount);
|
||||
|
@ -218,6 +219,11 @@ export class ThreadComponent implements OnInit, OnDestroy {
|
|||
const statuses = this.statusChildren.toArray();
|
||||
statuses.forEach(x => {
|
||||
x.removeContentWarning();
|
||||
if(x.isSelected){
|
||||
setTimeout(() => {
|
||||
scrollIntoView(x.elem.nativeElement, { behavior: 'auto', block: 'nearest'});
|
||||
}, 0);
|
||||
}
|
||||
});
|
||||
this.hasContentWarnings = false;
|
||||
return false;
|
||||
|
|
|
@ -48,7 +48,7 @@ $button-border-color: #303957;
|
|||
|
||||
$column-background: #0f111a;
|
||||
|
||||
$card-border-color: #1e2435;
|
||||
$card-border-color: #2b344d;
|
||||
|
||||
$context-menu-background: #d9e1e8;
|
||||
$context-menu-background-hover: #a9c9e6;
|
||||
|
|
Loading…
Reference in New Issue