-
-
Save abner/d5216d38803a8ff840801ce29dfbb54f to your computer and use it in GitHub Desktop.
Simple Markdown Editor with Angular2
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
<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css"> | |
<textarea #simplemde></textarea> |
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
// Angular Imports | |
import { Component, ElementRef, ViewChild } from '@angular/core'; | |
// Declare Global Variable | |
var SimpleMDE : any = require('simplemde'); | |
// Define Editor Component | |
@Component({ | |
selector: 'mdeditor', | |
templateUrl: '/client/imports/ui/components/mdeditor/mdeditor.html', | |
}) | |
// Export Editor Class | |
export class MDEditor { | |
@ViewChild('simplemde') textarea : ElementRef; | |
constructor(private elementRef:ElementRef) { | |
super(); | |
} | |
ngAfterViewInit(){ | |
var mde = new SimpleMDE({ element: this.elementRef.nativeElement.value }); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment