File tree 2 files changed +11
-8
lines changed
dist/main/atom/components
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) {
4
4
function __ ( ) { this . constructor = d ; }
5
5
d . prototype = b === null ? Object . create ( b ) : ( __ . prototype = b . prototype , new __ ( ) ) ;
6
6
} ;
7
+ var escapeHtml = require ( "escape-html" ) ;
7
8
var TsView = ( function ( _super ) {
8
9
__extends ( TsView , _super ) ;
9
10
function TsView ( ) {
10
11
_super . apply ( this , arguments ) ;
11
12
}
12
13
TsView . prototype . createdCallback = function ( ) {
13
- var preview = this . innerText ;
14
+ var preview = escapeHtml ( this . innerText ) ;
14
15
this . innerText = "" ;
15
16
var editorElement = this . editorElement = document . createElement ( 'atom-text-editor' ) ;
16
17
editorElement . setAttributeNode ( document . createAttribute ( 'gutter-hidden' ) ) ;
@@ -24,7 +25,7 @@ var TsView = (function (_super) {
24
25
this . appendChild ( editorElement ) ;
25
26
} ;
26
27
TsView . prototype . text = function ( text ) {
27
- this . editor . setText ( text ) ;
28
+ this . editor . setText ( escapeHtml ( text ) ) ;
28
29
} ;
29
30
return TsView ;
30
31
} ( HTMLElement ) ) ;
Original file line number Diff line number Diff line change 1
1
// Some docs
2
2
// http://www.html5rocks.com/en/tutorials/webcomponents/customelements/ (look at lifecycle callback methods)
3
3
4
+ import escapeHtml = require( "escape-html" ) ;
5
+
4
6
export class TsView extends HTMLElement {
5
7
editorElement ;
6
8
editor ;
7
9
createdCallback ( ) {
8
- var preview = this . innerText ;
10
+ var preview = escapeHtml ( this . innerText ) ;
9
11
this . innerText = "" ;
10
12
11
- // Based on markdown editor
13
+ // Based on markdown editor
12
14
// https://github.com/atom/markdown-preview/blob/2bcbadac3980f1aeb455f7078bd1fdfb4e6fe6b1/lib/renderer.coffee#L111
13
15
var editorElement = this . editorElement = document . createElement ( 'atom-text-editor' ) ;
14
16
editorElement . setAttributeNode ( document . createAttribute ( 'gutter-hidden' ) ) ;
@@ -22,11 +24,11 @@ export class TsView extends HTMLElement {
22
24
23
25
this . appendChild ( editorElement ) ;
24
26
}
25
-
26
- // API
27
+
28
+ // API
27
29
text ( text : string ) {
28
- this . editor . setText ( text ) ;
30
+ this . editor . setText ( escapeHtml ( text ) ) ;
29
31
}
30
32
}
31
33
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