@@ -38,19 +38,28 @@ qx.Class.define("osparc.widget.JsonFormatterWidget", {
3838 this . __root . setStyles ( {
3939 width : "100%" ,
4040 height : "100%" ,
41- boxSizing : "border-box"
41+ boxSizing : "border-box" ,
42+ overflow : "auto" // ensure local overflow is visible
4243 } ) ;
4344 return this . __root ;
4445 } ,
4546
47+ _getContentHint : function ( ) {
48+ if ( this . __formatterEl ) {
49+ return {
50+ width : this . __formatterEl . scrollWidth ,
51+ height : this . __formatterEl . scrollHeight
52+ } ;
53+ }
54+ return { width : 100 , height : 50 } ;
55+ } ,
56+
4657 setJson : function ( json ) {
4758 if ( ! this . getContentElement ( ) . getDomElement ( ) ) {
4859 this . addListenerOnce ( "appear" , ( ) => this . _mountJson ( json ) , this ) ;
4960 } else {
5061 this . _mountJson ( json ) ;
5162 }
52-
53- this . __applyStyles ( ) ;
5463 } ,
5564
5665 _mountJson : function ( json ) {
@@ -73,31 +82,14 @@ qx.Class.define("osparc.widget.JsonFormatterWidget", {
7382 return ;
7483 }
7584
76- // Hardcoded options
77- const formatter = new JSONFormatter ( jsonObj , 2 , {
78-
79- } ) ;
85+ const formatter = new JSONFormatter ( jsonObj , 2 , { } ) ;
8086 this . __formatterEl = formatter . render ( ) ;
8187
82- // Apply styling
83- const color = qx . theme . manager . Color . getInstance ( ) . resolve ( "text" ) ;
84- this . __formatterEl . style . setProperty ( "color" , color , "important" ) ;
85- this . __formatterEl . style . setProperty ( "font-family" , '"Manrope", sans-serif' , "important" ) ;
86-
87- // Keys font-size
88- this . __formatterEl . querySelectorAll ( ".json-formatter-key" ) . forEach ( el => {
89- el . style . setProperty ( "font-size" , "13px" , "important" ) ;
90- } ) ;
91-
92- // Hide constructor names
93- this . __formatterEl . querySelectorAll ( ".json-formatter-constructor-name" ) . forEach ( el => {
94- el . style . setProperty ( "display" , "none" , "important" ) ;
95- } ) ;
96-
9788 const rootDom = this . getContentElement ( ) . getDomElement ( ) ;
9889 if ( rootDom ) {
9990 rootDom . appendChild ( this . __formatterEl ) ;
10091 }
92+ this . invalidateLayoutCache ( ) ; // notify qooxdoo to recalc size
10193 } ,
10294 } ,
10395
0 commit comments