File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
dist/main/atom/components Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -4,13 +4,14 @@ var __extends = (this && this.__extends) || function (d, b) {
44 function __ ( ) { this . constructor = d ; }
55 d . prototype = b === null ? Object . create ( b ) : ( __ . prototype = b . prototype , new __ ( ) ) ;
66} ;
7+ var escapeHtml = require ( "escape-html" ) ;
78var TsView = ( function ( _super ) {
89 __extends ( TsView , _super ) ;
910 function TsView ( ) {
1011 _super . apply ( this , arguments ) ;
1112 }
1213 TsView . prototype . createdCallback = function ( ) {
13- var preview = this . innerText ;
14+ var preview = escapeHtml ( this . innerText ) ;
1415 this . innerText = "" ;
1516 var editorElement = this . editorElement = document . createElement ( 'atom-text-editor' ) ;
1617 editorElement . setAttributeNode ( document . createAttribute ( 'gutter-hidden' ) ) ;
@@ -24,7 +25,7 @@ var TsView = (function (_super) {
2425 this . appendChild ( editorElement ) ;
2526 } ;
2627 TsView . prototype . text = function ( text ) {
27- this . editor . setText ( text ) ;
28+ this . editor . setText ( escapeHtml ( text ) ) ;
2829 } ;
2930 return TsView ;
3031} ( HTMLElement ) ) ;
Original file line number Diff line number Diff line change 11// Some docs
22// http://www.html5rocks.com/en/tutorials/webcomponents/customelements/ (look at lifecycle callback methods)
33
4+ import escapeHtml = require( "escape-html" ) ;
5+
46export class TsView extends HTMLElement {
57 editorElement ;
68 editor ;
79 createdCallback ( ) {
8- var preview = this . innerText ;
10+ var preview = escapeHtml ( this . innerText ) ;
911 this . innerText = "" ;
1012
11- // Based on markdown editor
13+ // Based on markdown editor
1214 // https://github.com/atom/markdown-preview/blob/2bcbadac3980f1aeb455f7078bd1fdfb4e6fe6b1/lib/renderer.coffee#L111
1315 var editorElement = this . editorElement = document . createElement ( 'atom-text-editor' ) ;
1416 editorElement . setAttributeNode ( document . createAttribute ( 'gutter-hidden' ) ) ;
@@ -22,11 +24,11 @@ export class TsView extends HTMLElement {
2224
2325 this . appendChild ( editorElement ) ;
2426 }
25-
26- // API
27+
28+ // API
2729 text ( text : string ) {
28- this . editor . setText ( text ) ;
30+ this . editor . setText ( escapeHtml ( text ) ) ;
2931 }
3032}
3133
32- ( < any > document ) . registerElement ( 'ts-view' , TsView ) ;
34+ ( < any > document ) . registerElement ( 'ts-view' , TsView ) ;
You can’t perform that action at this time.
0 commit comments