ngx-showdown
Version:
A Angular (>=2) integration for Showdown
2 lines • 5.34 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("showdown"),require("@angular/platform-browser"),require("@angular/common/http")):"function"==typeof define&&define.amd?define("ngx-showdown",["exports","@angular/core","showdown","@angular/platform-browser","@angular/common/http"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["ngx-showdown"]={},e.ng.core,e.showdown,e.ng.platformBrowser,e.ng.common.http)}(this,(function(e,t,n,o,r){"use strict";var i={}.hasOwnProperty,s=function(){function e(e){this.merge(e)}return e.prototype.merge=function(e){for(var t in e)i.call(e,t)&&(this[t]=e[t])},e}(),a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function p(e,t){function n(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}Object.create;function c(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}Object.create;var u,l,d={}.hasOwnProperty,f=function(e){function t(t){var n=e.call(this,t&&{extensions:t.extensions})||this;return n.setFlavor(t&&t.flavor||"vanilla"),n.setOptions(t),n}return p(t,e),t.prototype.setOptions=function(e){for(var t in e)d.call(e,t)&&this.setOption(t,e[t])},t}(n.Converter);f.decorators=[{type:t.Injectable}],f.ctorParameters=function(){return[{type:s,decorators:[{type:t.Optional}]}]};var h={"":!0,true:!0,false:!1},y=function(e){return h.hasOwnProperty(e)?h[e]:e},m=y,w=["backslashEscapesHTMLTags","completeHTMLDocument","disableForced4SpacesIndentedSublists","emoji","encodeEmails","ghCodeBlocks","ghCompatibleHeaderId","ghMentions","ghMentionsLink","headerLevelStart","literalMidWordAsterisks","literalMidWordUnderscores","metadata","noHeaderId","omitExtraWLInCodeBlocks","openLinksInNewWindow","parseImgDimensions","prefixHeaderId","rawHeaderId","rawPrefixHeaderId","requireSpaceBeforeHeadingText","simpleLineBreaks","simplifiedAutoLink","smartIndentationFix","smoothLivePreview","splitAdjacentBlockquotes","strikethrough","tables","tablesHeaderId","tasklists","underline"],g=function(e){function n(t,n,o){var r=e.call(this,o)||this;return r._elementRef=t,r._domSanitizer=n,r}return p(n,e),Object.defineProperty(n.prototype,"showdown",{set:function(e){this.value=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"options",{get:function(){return this.getOptions()},set:function(e){this.setOptions(e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"sanitize",{set:function(e){this._sanitize=y(e)},enumerable:!1,configurable:!0}),n.prototype.ngOnInit=function(){void 0===this.value&&""!==this._elementRef.nativeElement.innerHTML.trim()&&this.render(this._elementRef.nativeElement.innerHTML)},n.prototype.ngOnChanges=function(){this.render()},n.prototype.render=function(e){if("string"==typeof e&&(this.value=e),"string"==typeof this.value){var n=this.makeHtml(this.value);this._sanitize&&(n=this._domSanitizer.sanitize(t.SecurityContext.HTML,n)),this._elementRef.nativeElement.innerHTML=n}},n}(f);g.decorators=[{type:t.Component,args:[{selector:"showdown,[showdown]",template:"<ng-content></ng-content>",exportAs:"showdown",inputs:w}]}],g.ctorParameters=function(){return[{type:t.ElementRef},{type:o.DomSanitizer,decorators:[{type:t.Optional}]},{type:s,decorators:[{type:t.Optional}]}]},g.propDecorators={value:[{type:t.Input}],showdown:[{type:t.Input}],options:[{type:t.Input}],sanitize:[{type:t.Input}]};var v=function(e){Object.defineProperty(g.prototype,e,{set:function(t){this.setOption(e,y(t))},configurable:!0})};try{for(var b=c(w),O=b.next();!O.done;O=b.next()){v(O.value)}}catch(e){u={error:e}}finally{try{O&&!O.done&&(l=b.return)&&l.call(b)}finally{if(u)throw u.error}}var _=function(){function e(e,n){this._showdownComponent=e,this._http=n,this.error=new t.EventEmitter}return e.prototype.ngOnChanges=function(){this.load()},e.prototype.load=function(e){var t=this;e&&(this.src=e),this.src&&this._http.get(this.src,{responseType:"text"}).subscribe((function(e){t._showdownComponent.render(e)}),(function(e){t.error.emit(e)}))},e}();_.decorators=[{type:t.Directive,args:[{selector:"showdown[src],[showdown][src]",exportAs:"source"}]}],_.ctorParameters=function(){return[{type:g},{type:r.HttpClient}]},_.propDecorators={src:[{type:t.Input}],error:[{type:t.Output}]};var x=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t.prototype.transform=function(e,t){return this.setOptions(t),this.makeHtml(e)},t}(f);x.decorators=[{type:t.Pipe,args:[{name:"showdown",pure:!1}]}];var I=[g,x,_],P=function(){function e(){}return e.forRoot=function(t){return{ngModule:e,providers:[{provide:s,useValue:t}]}},e}();P.decorators=[{type:t.NgModule,args:[{declarations:I,providers:[f],exports:I}]}],e.ShowdownComponent=g,e.ShowdownConfig=s,e.ShowdownConverter=f,e.ShowdownModule=P,e.ShowdownPipe=x,e.SourceDirective=_,e.ɵ0=m,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=ngx-showdown.umd.min.js.map