diff --git a/.gitignore b/.gitignore index 5ae2184..4669fb2 100644 --- a/.gitignore +++ b/.gitignore @@ -37,5 +37,4 @@ jspm_packages .node_repl_history .idea -lib build \ No newline at end of file diff --git a/lib/ngx-gist.component.d.ts b/lib/ngx-gist.component.d.ts new file mode 100644 index 0000000..9da3ca0 --- /dev/null +++ b/lib/ngx-gist.component.d.ts @@ -0,0 +1,7 @@ +import { ElementRef, AfterViewInit } from '@angular/core'; +export declare class ngxGist implements AfterViewInit { + iframe: ElementRef; + gistId: any; + constructor(); + ngAfterViewInit(): void; +} diff --git a/lib/ngx-gist.component.js b/lib/ngx-gist.component.js new file mode 100644 index 0000000..9d57aa9 --- /dev/null +++ b/lib/ngx-gist.component.js @@ -0,0 +1,41 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +import { Component, Input, ViewChild, ElementRef } from '@angular/core'; +var ngxGist = (function () { + function ngxGist() { + } + ngxGist.prototype.ngAfterViewInit = function () { + this.iframe.nativeElement.id = 'gist-' + this.gistId; + var doc = this.iframe.nativeElement.contentDocument || this.iframe.nativeElement.contentElement.contentWindow; + var content = "\n \n
\n