@@ -58,7 +58,7 @@ let Markdown = {
58
58
59
59
// 将html字符串解析成jQuery对象
60
60
function parseHtml ( html_str : string ) {
61
- let nodes = $ . parseHTML ( html_str , null , true ) ;
61
+ let nodes = $ . parseHTML ( html_str . trim ( ) , null , true ) ;
62
62
let elem ;
63
63
if ( nodes . length != 1 )
64
64
elem = $ ( document . createElement ( 'div' ) ) . append ( nodes ) ;
@@ -172,8 +172,7 @@ let Table = {
172
172
173
173
let header : itemType [ ] , data : itemType [ ] [ ] ;
174
174
[ header , ...data ] = table_data ;
175
- let html = render_tpl ( table_tpl , { header : header , tdata : data } ) ;
176
- return $ ( html ) ;
175
+ return render_tpl ( table_tpl , { header : header , tdata : data } ) ;
177
176
}
178
177
} ;
179
178
@@ -242,15 +241,15 @@ const SCOPE_TPL = `<div>
242
241
</div>` ;
243
242
let ScopeWidget = {
244
243
handle_type : 'scope' ,
245
- get_element : function ( spec : { dom_id :string , contents : any [ ] } ) {
244
+ get_element : function ( spec : { dom_id : string , contents : any [ ] } ) {
246
245
let elem = render_tpl ( SCOPE_TPL , spec ) ;
247
246
// need to check the duplicate id after current output widget shown.
248
247
// because the current widget may have multiple sub-widget which have same dom id.
249
- AfterCurrentOutputWidgetShow ( ( ) => {
250
- if ( $ ( `#${ spec . dom_id } ` ) . length !== 0 ) {
248
+ AfterCurrentOutputWidgetShow ( ( ) => {
249
+ if ( $ ( `#${ spec . dom_id } ` ) . length !== 0 ) {
251
250
let tip = `<p style="color: grey; border:1px solid #ced4da; padding: .375rem .75rem;">${ t ( "duplicated_scope_name" ) } </p>` ;
252
251
elem . empty ( ) . html ( tip ) ;
253
- } else {
252
+ } else {
254
253
elem . attr ( 'id' , spec . dom_id ) ;
255
254
}
256
255
} )
0 commit comments