x4js 1.4.26 → 1.4.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/icon.js CHANGED
@@ -76,7 +76,8 @@ class Loader extends x4events_1.EventSource {
76
76
  if (r.ok) {
77
77
  const svg = await r.text();
78
78
  // check response, must be svg
79
- if (!svg.startsWith("<svg")) {
79
+ //TODO: find better
80
+ if (!svg.startsWith("<svg") && !svg.startsWith('<?xml')) {
80
81
  console.error("svg loading error: ", svg);
81
82
  this.signal('loaded', EvLoaded(url, ""));
82
83
  }
@@ -180,13 +181,10 @@ class Icon extends component_1.Component {
180
181
  let match_url = reUrl.exec(icon);
181
182
  if (match_url) {
182
183
  url = trimQuotes(match_url[1].trim());
183
- if (url.substring(0, 5) == 'data:') {
184
- this._setSVG(url);
185
- return;
186
- }
187
- else {
188
- name = url.replace(/[/\\\.\* ]/g, '_');
189
- }
184
+ // this value is escaped
185
+ url = url.replaceAll("\\", "");
186
+ this._setSVG(url);
187
+ return;
190
188
  }
191
189
  else {
192
190
  // todo: deprecated
package/lib/tools.js CHANGED
@@ -300,10 +300,9 @@ exports.escapeHtml = escapeHtml;
300
300
  * console.log( removeHtmlTags('<h1>sss</h1>') );
301
301
  */
302
302
  function removeHtmlTags(unsafe, nl_br = false) {
303
- if (!unsafe || unsafe.length == 0) {
304
- return unsafe;
303
+ if (unsafe === undefined || unsafe === null || !isString(unsafe) || unsafe.length == 0) {
304
+ return "";
305
305
  }
306
- debugger;
307
306
  let ret_val = '';
308
307
  for (let i = 0; i < unsafe.length; i++) {
309
308
  const ch = unsafe.codePointAt(i);
package/lib/treeview.js CHANGED
@@ -378,15 +378,13 @@ class TreeView extends layout_1.VLayout {
378
378
  return;
379
379
  }
380
380
  }
381
- this.m_selection = { id: nd.id, el: null };
382
- this.update();
381
+ this.selection = nd.id;
383
382
  this.emit('contextMenu', (0, x4events_1.EvContextMenu)(ev, nd));
384
383
  return;
385
384
  }
386
385
  dom = dom.parentElement;
387
386
  }
388
- this.m_selection = null;
389
- this.update();
387
+ this.selection = null;
390
388
  this.emit('contextMenu', (0, x4events_1.EvContextMenu)(ev, null));
391
389
  }
392
390
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x4js",
3
- "version": "1.4.26",
3
+ "version": "1.4.29",
4
4
  "description": "X4js core files",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
package/src/icon.ts CHANGED
@@ -101,7 +101,8 @@ class Loader extends EventSource<LoadingEventMap> {
101
101
  if( r.ok ) {
102
102
  const svg = await r.text();
103
103
  // check response, must be svg
104
- if( !svg.startsWith("<svg") ) {
104
+ //TODO: find better
105
+ if (!svg.startsWith("<svg") && !svg.startsWith('<?xml') ) {
105
106
  console.error( "svg loading error: ", svg );
106
107
  this.signal( 'loaded', EvLoaded(url,"") );
107
108
  }
@@ -225,13 +226,10 @@ export class Icon extends Component<IconProps>
225
226
  let match_url = reUrl.exec( icon );
226
227
  if( match_url ) {
227
228
  url = trimQuotes( match_url[1].trim( ) );
228
- if( url.substring(0,5)=='data:' ) {
229
- this._setSVG( url );
230
- return;
231
- }
232
- else {
233
- name = url.replace( /[/\\\.\* ]/g, '_' );
234
- }
229
+ // this value is escaped
230
+ url = url.replaceAll( "\\", "" );
231
+ this._setSVG( url );
232
+ return;
235
233
  }
236
234
  else {
237
235
  // todo: deprecated
package/src/tools.ts CHANGED
@@ -369,10 +369,11 @@ export function escapeHtml(unsafe: string, nl_br = false): string {
369
369
  */
370
370
 
371
371
  export function removeHtmlTags(unsafe: string, nl_br = false): string {
372
- if (!unsafe || unsafe.length == 0) {
373
- return unsafe;
374
- }
375
- debugger;
372
+
373
+ if ( unsafe===undefined || unsafe===null || !isString(unsafe) || unsafe.length == 0 ) {
374
+ return "";
375
+ }
376
+
376
377
  let ret_val = '';
377
378
  for (let i = 0; i < unsafe.length; i++) {
378
379
  const ch = unsafe.codePointAt(i);
package/src/treeview.ts CHANGED
@@ -521,19 +521,16 @@ export class TreeView extends VLayout<TreeViewProps, TreeViewEventMap> {
521
521
  }
522
522
  }
523
523
 
524
- this.m_selection = { id: nd.id, el: null };
525
- this.update( );
526
-
524
+ this.selection = nd.id;
527
525
  this.emit('contextMenu', EvContextMenu(ev, nd));
526
+
528
527
  return;
529
528
  }
530
529
 
531
530
  dom = dom.parentElement;
532
531
  }
533
532
 
534
- this.m_selection = null;
535
- this.update( );
536
-
533
+ this.selection = null;
537
534
  this.emit('contextMenu', EvContextMenu(ev, null));
538
535
  }
539
536