-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(): introducing covalent-code-editor in documentation
* 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
1 parent
f5d9f33
commit 5a20fa9
Showing
10 changed files
with
120 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/app/components/components/code-editor/code-editor.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
3 changes: 3 additions & 0 deletions
3
src/app/components/components/code-editor/code-editor.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.editor { | ||
height: 200px; | ||
} |
39 changes: 39 additions & 0 deletions
39
src/app/components/components/code-editor/code-editor.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters