Skip to content

Instantly share code, notes, and snippets.

@abner
Forked from DerekTBrown/mdeditor.html
Created May 18, 2017 16:02
Show Gist options
  • Save abner/d5216d38803a8ff840801ce29dfbb54f to your computer and use it in GitHub Desktop.
Save abner/d5216d38803a8ff840801ce29dfbb54f to your computer and use it in GitHub Desktop.
Simple Markdown Editor with Angular2
<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">
<textarea #simplemde></textarea>
// 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