refactor(app): rename components, move tinymce to separate file

This commit is contained in:
KostyaDanovsky 2017-05-06 14:52:41 +03:00
parent 923e56c3d2
commit 3ac268a096
40 changed files with 199 additions and 136 deletions

View file

@ -1,7 +1,7 @@
import { Component } from '@angular/core';
@Component({
selector: 'footer',
selector: 'ngx-footer',
styleUrls: ['./footer.component.scss'],
template: `
<span class="created-by">Created with by <b><a href="https://akveo.com" target="_blank">Akveo</a></b> 2017</span>

View file

@ -4,7 +4,7 @@ import { NgaSidebarService, NgaMenuService } from '@nga/theme';
import { NgaThemeService } from '@nga/theme/services/theme.service';
@Component({
selector: 'header',
selector: 'ngx-header',
styleUrls: ['./header.component.scss'],
template: `
<div class="left">
@ -14,7 +14,7 @@ import { NgaThemeService } from '@nga/theme/services/theme.service';
</div>
<nga-actions size="medium" inverse class="right">
<nga-action><search-input></search-input></nga-action>
<nga-action><ngx-search-input></ngx-search-input></nga-action>
<nga-action icon="ion-ios-email-outline"></nga-action>
<nga-action disabled icon="ion-ios-bell-outline"></nga-action>
<nga-action>

View file

@ -1,3 +1,4 @@
export * from './header/header.component';
export * from './footer/footer.component';
export * from '../components/search-input/search-input.component';
export * from './search-input/search-input.component';
export * from './tiny-mce/time-mce.component';

View file

@ -1,7 +1,7 @@
import { Component, ElementRef, EventEmitter, Output, ViewChild } from '@angular/core';
@Component({
selector: 'search-input',
selector: 'ngx-search-input',
styleUrls: ['./search-input.component.scss'],
template: `
<i class="control-icon ion ion-ios-search"

View file

@ -0,0 +1,33 @@
import {Component, OnDestroy, AfterViewInit, Output, EventEmitter, ElementRef} from '@angular/core';
@Component({
selector: 'ngx-tiny-mce',
template: '',
})
export class TinyMCEComponent implements OnDestroy, AfterViewInit {
@Output() editorKeyup = new EventEmitter<any>();
editor: any;
constructor(private host: ElementRef) { }
ngAfterViewInit() {
tinymce.init({
target: this.host.nativeElement,
plugins: ['link', 'paste', 'table'],
skin_url: 'assets/skins/lightgray',
setup: editor => {
this.editor = editor;
editor.on('keyup', () => {
let content = editor.getContent();
this.editorKeyup.emit(content);
});
},
});
}
ngOnDestroy() {
tinymce.remove(this.editor);
}
}