created component to host text to parse and databind
This commit is contained in:
parent
af4966abca
commit
667e843b07
@ -39,6 +39,7 @@ import { UserProfileComponent } from './components/stream/user-profile/user-prof
|
|||||||
import { ThreadComponent } from './components/stream/thread/thread.component';
|
import { ThreadComponent } from './components/stream/thread/thread.component';
|
||||||
import { HashtagComponent } from './components/stream/hashtag/hashtag.component';
|
import { HashtagComponent } from './components/stream/hashtag/hashtag.component';
|
||||||
import { StreamOverlayComponent } from './components/stream/stream-overlay/stream-overlay.component';
|
import { StreamOverlayComponent } from './components/stream/stream-overlay/stream-overlay.component';
|
||||||
|
import { DatabindedTextComponent } from './components/stream/status/databinded-text/databinded-text.component';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{ path: "", redirectTo: "home", pathMatch: "full" },
|
{ path: "", redirectTo: "home", pathMatch: "full" },
|
||||||
@ -70,7 +71,8 @@ const routes: Routes = [
|
|||||||
UserProfileComponent,
|
UserProfileComponent,
|
||||||
ThreadComponent,
|
ThreadComponent,
|
||||||
HashtagComponent,
|
HashtagComponent,
|
||||||
StreamOverlayComponent
|
StreamOverlayComponent,
|
||||||
|
DatabindedTextComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
<div #content class="content" innerHTML="{{processedText}}"></div>
|
||||||
|
|
@ -0,0 +1,20 @@
|
|||||||
|
@import "variables";
|
||||||
|
|
||||||
|
//Mastodon styling
|
||||||
|
:host ::ng-deep .content {
|
||||||
|
// font-size: 14px;
|
||||||
|
color: $status-primary-color;
|
||||||
|
& a,
|
||||||
|
.mention,
|
||||||
|
.ellipsis {
|
||||||
|
color: $status-links-color;
|
||||||
|
}
|
||||||
|
& .invisible {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
& p {
|
||||||
|
margin: 0px;
|
||||||
|
//font-size: .9em;
|
||||||
|
// font-size: 14px;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { DatabindedTextComponent } from './databinded-text.component';
|
||||||
|
|
||||||
|
describe('DatabindedTextComponent', () => {
|
||||||
|
let component: DatabindedTextComponent;
|
||||||
|
let fixture: ComponentFixture<DatabindedTextComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ DatabindedTextComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(DatabindedTextComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,28 @@
|
|||||||
|
import { Component, OnInit, Input, EventEmitter, Output } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-databinded-text',
|
||||||
|
templateUrl: './databinded-text.component.html',
|
||||||
|
styleUrls: ['./databinded-text.component.scss']
|
||||||
|
})
|
||||||
|
export class DatabindedTextComponent implements OnInit {
|
||||||
|
private accounts: string[] = [];
|
||||||
|
private hastags: string[] = [];
|
||||||
|
|
||||||
|
processedText: string;
|
||||||
|
|
||||||
|
@Output() accountSelected = new EventEmitter<string>();
|
||||||
|
@Output() hashtagSelected = new EventEmitter<string>();
|
||||||
|
@Output() textSelected = new EventEmitter();
|
||||||
|
|
||||||
|
@Input('text')
|
||||||
|
set text(value: string){
|
||||||
|
this.processedText = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -14,7 +14,10 @@
|
|||||||
</a>
|
</a>
|
||||||
<div class="status__created-at" title="{{ displayedStatus.created_at | date: 'full' }}">{{
|
<div class="status__created-at" title="{{ displayedStatus.created_at | date: 'full' }}">{{
|
||||||
getCompactRelativeTime(status.created_at) }}</div>
|
getCompactRelativeTime(status.created_at) }}</div>
|
||||||
<div #content class="status__content" innerHTML="{{displayedStatus.content}}"></div>
|
<!-- <div #content class="status__content" innerHTML="{{displayedStatus.content}}"></div> -->
|
||||||
|
|
||||||
|
<app-databinded-text class="status__content" [text]="displayedStatus.content"></app-databinded-text>
|
||||||
|
|
||||||
|
|
||||||
<app-attachements *ngIf="hasAttachments" class="attachments" [attachments]="displayedStatus.media_attachments"></app-attachements>
|
<app-attachements *ngIf="hasAttachments" class="attachments" [attachments]="displayedStatus.media_attachments"></app-attachements>
|
||||||
|
|
||||||
|
@ -77,6 +77,7 @@
|
|||||||
/*width: calc(100% - 50px);*/
|
/*width: calc(100% - 50px);*/
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
margin: 0 10px 0 $avatar-column-space;
|
margin: 0 10px 0 $avatar-column-space;
|
||||||
|
display: block;
|
||||||
}
|
}
|
||||||
// &__content p {
|
// &__content p {
|
||||||
// margin: 0 !important;
|
// margin: 0 !important;
|
||||||
@ -90,28 +91,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// .attachments {
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
//Mastodon styling
|
|
||||||
:host ::ng-deep .status__content {
|
|
||||||
color: $status-primary-color;
|
|
||||||
& a,
|
|
||||||
.mention,
|
|
||||||
.ellipsis {
|
|
||||||
color: $status-links-color;
|
|
||||||
}
|
|
||||||
& .invisible {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
& p {
|
|
||||||
margin: 0px;
|
|
||||||
//font-size: .9em;
|
|
||||||
// font-size: 14px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.attachments {
|
.attachments {
|
||||||
display: block;
|
display: block;
|
||||||
// width: calc(100% - 80px);
|
// width: calc(100% - 80px);
|
||||||
|
@ -31,7 +31,7 @@ export class StatusComponent implements OnInit {
|
|||||||
this.status = value.status;
|
this.status = value.status;
|
||||||
|
|
||||||
//TEST
|
//TEST
|
||||||
this.status.content += '<br/><br/><a href class="test">TEST</a>';
|
//this.status.content += '<br/><br/><a href class="test">TEST</a>';
|
||||||
|
|
||||||
|
|
||||||
if (this.status.reblog) {
|
if (this.status.reblog) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user