@@ -6,6 +6,14 @@ Ext.define('Ext.ux.grid.plugin.LiveSearch', {
6
6
7
7
alias : [ 'plugin.gridlivesearch' , 'plugin.livesearch' ] ,
8
8
9
+ uses : [
10
+ 'Ext.Array' ,
11
+ 'Ext.String' ,
12
+ 'Ext.Function' ,
13
+ 'Ext.util.Format' ,
14
+ 'Ext.dom.Element'
15
+ ] ,
16
+
9
17
config : {
10
18
/**
11
19
* @cfg {String} searchValue
@@ -327,9 +335,13 @@ Ext.define('Ext.ux.grid.plugin.LiveSearch', {
327
335
328
336
if ( ! cellHTML ) return ;
329
337
330
- cellHTML = cellHTML . replace ( me . tagsRe , me . tagsProtect ) ;
338
+ if ( column . producesHTML ) {
339
+ cellHTML = cellHTML . replace ( me . tagsRe , me . tagsProtect ) ;
340
+ } else {
341
+ cellHTML = Ext . htmlDecode ( cellHTML ) ;
342
+ }
331
343
332
- if ( cell ) {
344
+ if ( cell && column . producesHTML ) {
333
345
matches = cellHTML . match ( me . tagsRe ) ;
334
346
}
335
347
@@ -345,7 +357,7 @@ Ext.define('Ext.ux.grid.plugin.LiveSearch', {
345
357
seen = true ;
346
358
}
347
359
348
- return cell ? '<span class="' + me . matchCls + '">' + m + '</span>' : null ;
360
+ return cell ? '<span class="' + me . matchCls + '">' + Ext . htmlEncode ( m ) + '</span>' : null ;
349
361
} ) ;
350
362
351
363
if ( ! cell ) return ;
@@ -355,6 +367,10 @@ Ext.define('Ext.ux.grid.plugin.LiveSearch', {
355
367
cellHTML = cellHTML . replace ( me . tagsProtect , match ) ;
356
368
} ) ;
357
369
370
+ if ( ! ( seen || column . producesHTML ) ) {
371
+ cellHTML = Ext . htmlEncode ( cellHTML ) ;
372
+ }
373
+
358
374
// update cell html
359
375
cell . innerHTML = cellHTML ;
360
376
} ) ;
@@ -407,12 +423,16 @@ Ext.define('Ext.ux.grid.plugin.LiveSearch', {
407
423
408
424
if ( ! cell ) return ;
409
425
410
- matches = cell . innerHTML . match ( this . tagsRe ) ;
411
- cellHTML = cell . innerHTML . replace ( this . tagsRe , this . tagsProtect ) ;
426
+ if ( column . producesHTML ) {
427
+ matches = cell . innerHTML . match ( this . tagsRe ) ;
428
+ cellHTML = cell . innerHTML . replace ( this . tagsRe , this . tagsProtect ) ;
429
+ } else {
430
+ cellHTML = Ext . htmlDecode ( cell . innerHTML ) ;
431
+ }
412
432
413
433
// populate indexes array, set currentIndex, and replace wrap matched string in a span
414
434
cellHTML = cellHTML . replace ( this . searchRegExp , function ( m ) {
415
- return '<span class="' + matchCls + '">' + m + '</span>' ;
435
+ return '<span class="' + matchCls + '">' + Ext . htmlEncode ( m ) + '</span>' ;
416
436
} ) ;
417
437
418
438
// restore protected tags
0 commit comments