Skip to content

Commit

Permalink
chore(): introducing covalent-code-editor in documentation
Browse files Browse the repository at this point in the history
* Covalent Code Editor Documentation

* chore(): remove CovalentCodeEditorModule from app.module

* fixing demo with switching to javascript language on code editor component

* chore(): update docs to be inline with other docs

* chore(): change code editor icon
  • Loading branch information
jeremysmartt authored and emoralesb05 committed Jun 30, 2017
1 parent f5d9f33 commit 5a20fa9
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 1 deletion.
1 change: 1 addition & 0 deletions .angular-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"outDir": "dist",
"assets": [
{ "glob": "**/*", "input": "../docs", "output": "./docs/" },
{ "glob": "**/*", "input": "../node_modules/@covalent/code-editor/assets/monaco", "output": "./assets/monaco/" },
"app/assets",
"platform",
"favicon.ico"
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"@angular/platform-browser-dynamic": "^4.2.0",
"@angular/platform-server": "^4.2.0",
"@angular/router": "^4.2.0",
"@covalent/code-editor": "^1.0.0-alpha.5",
"@ngx-translate/core": "7.0.0",
"@ngx-translate/http-loader": "0.1.0",
"@swimlane/ngx-charts": "5.3.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<md-card>
<md-card-title>Code Editor</md-card-title>
<md-card-subtitle>Multi-language code editor for Browser and Electron</md-card-subtitle>
<md-divider></md-divider>
<md-card-content>
<p>With this component you can utilize the Monaco Editor as an Angular Component in a Browser or Electron.</p>
</md-card-content>
<md-divider></md-divider>
<md-card-actions>
<a md-button color="accent" href="https://github.com/Teradata/covalent-code-editor" target="_blank" class="text-upper">Github Repo</a>
<a md-button color="accent" href="https://www.npmjs.com/package/@covalent/code-editor" target="_blank" class="text-upper">npm Module</a>
</md-card-actions>
</md-card>
<md-card>
<md-card-title>Basic example</md-card-title>
<md-card-subtitle>Editor running in browser <br>(change language, theme, right click context menu, syntax highlighting, and more)</md-card-subtitle>
<md-divider></md-divider>
<md-card-content>
<div layout="row" layout-align="start center">
<td-code-editor #editor class="editor" [theme]="editorTheme" flex [language]="editorLanguage" [value]="editorVal"></td-code-editor>
</div>
</md-card-content>
<md-divider></md-divider>
<md-card-actions>
<div class="pad-sm">
<span hide-xs class="md-body-1">Editor Language</span>
<md-select floatPlaceholder="never" [(ngModel)]="editorLanguage" (change)="changeLanguage()" placeholder="Editor Language">
<md-option value="sql">SQL</md-option>
<md-option value="javascript">JavaScript</md-option>
<md-option value="html">HTML</md-option>
</md-select>
</div>
<md-divider></md-divider>
<div class="pad-sm">
<span hide-xs class="md-body-1">Editor Theme</span>
<md-select floatPlaceholder="never" [(ngModel)]="editorTheme" (change)="changeTheme()" placeholder="Editor Theme">
<md-option value="vs">Light</md-option>
<md-option value="vs-dark">Dark</md-option>
<md-option value="hc-black">High Contrast</md-option>
</md-select>
</div>
<md-divider></md-divider>
</md-card-actions>
</md-card>

<td-readme-loader resourceUrl="https://raw.githubusercontent.com/Teradata/covalent-code-editor/master/docs/API.md">
</td-readme-loader>

<td-readme-loader resourceUrl="https://raw.githubusercontent.com/Teradata/covalent-code-editor/master/docs/SETUP.md">
</td-readme-loader>

<td-readme-loader resourceUrl="https://raw.githubusercontent.com/Teradata/covalent-code-editor/master/docs/ELECTRON.md">
</td-readme-loader>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.editor {
height: 200px;
}
39 changes: 39 additions & 0 deletions src/app/components/components/code-editor/code-editor.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Component, HostBinding, ViewChild } from '@angular/core';
import { slideInDownAnimation } from '../../../app.animations';
import { TdCodeEditorComponent } from '@covalent/code-editor';

@Component({
selector: 'code-editor-demo',
styleUrls: [ './code-editor.component.scss' ],
templateUrl: './code-editor.component.html',
animations: [slideInDownAnimation],
})
export class CodeEditorDemoComponent {

@ViewChild('editor') private _tdEditor: TdCodeEditorComponent;
@HostBinding('@routeAnimation') routeAnimation: boolean = true;
@HostBinding('class.td-route-animation') classAnimation: boolean = true;

editorTheme: string = 'hc-black';
editorLanguage: string = 'sql';
editorVal: string = `SELECT department_number, sampleid
FROM department
SAMPLE .25, .25, .50
ORDER BY sampleid;
SELECT department_number, sampleid
FROM department
SAMPLE 3, 5, 8
ORDER BY sampleid;
`;

// Theme
changeTheme(): void {
this._tdEditor.theme = this.editorTheme;
}

// Language
changeLanguage(): void {
this._tdEditor.language = this.editorLanguage;
}
}
5 changes: 5 additions & 0 deletions src/app/components/components/components.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ export class ComponentsComponent implements AfterViewInit {
icon: 'format_align_center',
route: 'dynamic-forms',
title: 'Dynamic Forms',
}, {
description: 'Multi-languge code editor for Browser and Electron',
icon: 'featured_play_list',
route: 'code-editor',
title: 'Code Editor',
}, {
description: 'Http wrappers and helpers',
icon: 'http',
Expand Down
4 changes: 4 additions & 0 deletions src/app/components/components/components.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { DataTableDemoComponent } from './data-table/data-table.component';
import { PagingDemoComponent } from './paging/paging.component';
import { SearchDemoComponent } from './search/search.component';
import { DynamicFormsDemoComponent } from './dynamic-forms/dynamic-forms.component';
import { CodeEditorDemoComponent } from './code-editor/code-editor.component';
import { NotificationsDemoComponent } from './notifications/notifications.component';
import { NgxChartsDemoComponent } from './ngx-charts/ngx-charts.component';
import { NgxTranslateDemoComponent } from './ngx-translate/ngx-translate.component';
Expand All @@ -44,6 +45,7 @@ import { CovalentCommonModule, CovalentLayoutModule, CovalentMediaModule, Covale
import { CovalentHighlightModule } from '../../../platform/highlight';
import { CovalentMarkdownModule } from '../../../platform/markdown';
import { CovalentDynamicFormsModule } from '../../../platform/dynamic-forms';
import { CovalentCodeEditorModule } from '../../../../node_modules/@covalent/code-editor';

import { DocumentationToolsModule } from '../../documentation-tools';

Expand Down Expand Up @@ -72,6 +74,7 @@ import { ToolbarModule } from '../../components/toolbar/toolbar.module';
PagingDemoComponent,
SearchDemoComponent,
DynamicFormsDemoComponent,
CodeEditorDemoComponent,
NotificationsDemoComponent,
// External Dependencies
NgxChartsDemoComponent,
Expand Down Expand Up @@ -117,6 +120,7 @@ import { ToolbarModule } from '../../components/toolbar/toolbar.module';
CovalentMarkdownModule,
CovalentDynamicFormsModule,
CovalentMessageModule,
CovalentCodeEditorModule,
DocumentationToolsModule,
NgxChartsModule,
TranslateModule,
Expand Down
4 changes: 4 additions & 0 deletions src/app/components/components/components.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { DataTableDemoComponent } from './data-table/data-table.component';
import { PagingDemoComponent } from './paging/paging.component';
import { SearchDemoComponent } from './search/search.component';
import { DynamicFormsDemoComponent } from './dynamic-forms/dynamic-forms.component';
import { CodeEditorDemoComponent } from './code-editor/code-editor.component';
import { NotificationsDemoComponent } from './notifications/notifications.component';
import { NgxChartsDemoComponent } from './ngx-charts/ngx-charts.component';
import { NgxTranslateDemoComponent } from './ngx-translate/ngx-translate.component';
Expand Down Expand Up @@ -89,6 +90,9 @@ const routes: Routes = [{
}, {
component: DynamicFormsDemoComponent,
path: 'dynamic-forms',
}, {
component: CodeEditorDemoComponent,
path: 'code-editor',
}, {
component: NgxChartsDemoComponent,
path: 'ngx-charts',
Expand Down
5 changes: 5 additions & 0 deletions src/app/components/components/overview/overview.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ export class ComponentsOverviewComponent {
icon: 'format_align_center',
route: 'dynamic-forms',
title: 'Dynamic Forms',
}, {
color: 'purple-A700',
icon: 'featured_play_list',
route: 'code-editor',
title: 'Code Editor',
}, {
color: 'indigo-A700',
icon: 'http',
Expand Down
6 changes: 5 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
"./node_modules/@types"
],
"paths": {
"@covalent/*": ["./platform/*"]
"@covalent/core": ["./platform/core"],
"@covalent/dynamic-forms": ["./platform/dynamic-forms"],
"@covalent/highlight": ["./platform/highlight"],
"@covalent/http": ["./platform/http"],
"@covalent/markdown": ["./platform/markdown"]
},
"noUnusedParameters": false,
"noUnusedLocals": false,
Expand Down

0 comments on commit 5a20fa9

Please sign in to comment.