codehighlighter.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. "use strict";
  2. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  3. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  4. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  5. 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;
  6. return c > 3 && r && Object.defineProperty(target, key, r), r;
  7. };
  8. var __metadata = (this && this.__metadata) || function (k, v) {
  9. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  10. };
  11. Object.defineProperty(exports, "__esModule", { value: true });
  12. var core_1 = require("@angular/core");
  13. var common_1 = require("@angular/common");
  14. var CodeHighlighter = /** @class */ (function () {
  15. function CodeHighlighter(el) {
  16. this.el = el;
  17. }
  18. CodeHighlighter.prototype.ngAfterViewInit = function () {
  19. if (window['Prism']) {
  20. window['Prism'].highlightElement(this.el.nativeElement);
  21. }
  22. };
  23. CodeHighlighter = __decorate([
  24. core_1.Directive({
  25. selector: '[pCode]'
  26. }),
  27. __metadata("design:paramtypes", [core_1.ElementRef])
  28. ], CodeHighlighter);
  29. return CodeHighlighter;
  30. }());
  31. exports.CodeHighlighter = CodeHighlighter;
  32. var CodeHighlighterModule = /** @class */ (function () {
  33. function CodeHighlighterModule() {
  34. }
  35. CodeHighlighterModule = __decorate([
  36. core_1.NgModule({
  37. imports: [common_1.CommonModule],
  38. exports: [CodeHighlighter],
  39. declarations: [CodeHighlighter]
  40. })
  41. ], CodeHighlighterModule);
  42. return CodeHighlighterModule;
  43. }());
  44. exports.CodeHighlighterModule = CodeHighlighterModule;
  45. //# sourceMappingURL=codehighlighter.js.map