@@ -2,13 +2,10 @@ import { AbstractEditor } from '../editor.js'
22import { extend , trigger , hasOwnProperty } from '../utilities.js'
33
44export class ObjectEditor extends AbstractEditor {
5- constructor ( a , b , recursion , stopRecursionCallback = ( ) => { } ) {
6- super ( a , b )
7- this . _recursion = recursion
8- this . _stopRecursionCallback = stopRecursionCallback
5+ constructor ( options , defaults , recursions ) {
6+ super ( options , defaults )
7+ this . currentRecursions = recursions
98 this . collapsed = null
10- this . collapseOnStopRecursion = this . collapseOnStopRecursion . bind ( this )
11- console . log ( 'jsoneditor MAX_RECURSIONS' , this . jsoneditor . MAX_RECURSIONS )
129 }
1310
1411 getDefault ( ) {
@@ -385,7 +382,6 @@ export class ObjectEditor extends AbstractEditor {
385382
386383 /* If the object should be rendered as a table row */
387384 if ( this . options . table_row ) {
388- console . log ( 'OPTION TABLE ROW ' , this . _recursion )
389385 Object . entries ( this . schema . properties ) . forEach ( ( [ key , schema ] ) => {
390386 const editor = this . jsoneditor . getEditorClass ( schema )
391387 this . editors [ key ] = this . jsoneditor . createEditor ( editor , {
@@ -395,7 +391,7 @@ export class ObjectEditor extends AbstractEditor {
395391 parent : this ,
396392 compact : true ,
397393 required : true
398- } , this . _recursion + 1 , this . collapseOnStopRecursion )
394+ } , this . currentRecursions + 1 )
399395 this . editors [ key ] . preBuild ( )
400396
401397 const width = this . editors [ key ] . options . hidden ? 0 : ( this . editors [ key ] . options . grid_columns || this . editors [ key ] . getNumColumns ( ) )
@@ -522,7 +518,6 @@ export class ObjectEditor extends AbstractEditor {
522518 }
523519
524520 build ( ) {
525- console . log ( '>>>>>>>>>>>>>>>>> LINKED CORRECTLY ' )
526521 const isCategoriesFormat = ( this . format === 'categories' )
527522 this . rows = [ ]
528523 this . active_tab = null
@@ -720,15 +715,8 @@ export class ObjectEditor extends AbstractEditor {
720715 }
721716
722717 /* Show/Hide button */
723- console . log ( 'BUILD ' , this . _recursion , this . collapsed )
724- if ( this . collapsed === true ) {
725- this . editor_holder . style . display = 'none'
726- this . collapse_control = this . getButton ( '' , 'expand' , this . translate ( 'button_expand' ) )
727- } else {
728- this . collapsed = false
729- this . collapse_control = this . getButton ( '' , 'collapse' , this . translate ( 'button_collapse' ) )
730- }
731-
718+ this . collapsed = false
719+ this . collapse_control = this . getButton ( '' , 'collapse' , this . translate ( 'button_collapse' ) )
732720 this . collapse_control . style . margin = '0 10px 0 0'
733721 this . collapse_control . classList . add ( 'json-editor-btntype-toggle' )
734722 this . title . insertBefore ( this . collapse_control , this . title . childNodes [ 0 ] )
@@ -985,13 +973,11 @@ export class ObjectEditor extends AbstractEditor {
985973 this . editors [ name ] . register ( )
986974 /* New property */
987975 } else {
988- console . log ( 'NAME ' , ! this . canHaveAdditionalProperties ( ) , name )
989976 if ( ! this . canHaveAdditionalProperties ( ) && ( ! this . schema . properties || ! this . schema . properties [ name ] ) ) {
990977 return
991978 }
992979
993980 const schema = this . getPropertySchema ( name )
994- console . log ( 'SCHEMA ' , schema )
995981 if ( typeof schema . propertyOrder !== 'number' ) {
996982 /* if the propertyOrder undefined, then set a smart default value. */
997983 schema . propertyOrder = Object . keys ( this . editors ) . length + 1000
@@ -1002,10 +988,10 @@ export class ObjectEditor extends AbstractEditor {
1002988
1003989 this . editors [ name ] = this . jsoneditor . createEditor ( editor , {
1004990 jsoneditor : this . jsoneditor ,
1005- schema : this . _recursion >= this . jsoneditor . MAX_RECURSIONS ? { type : schema . type || null } : schema ,
991+ schema : this . currentRecursions >= this . jsoneditor . MAX_RECURSIONS ? { type : schema . type || null } : schema ,
1006992 path : `${ this . path } .${ name } ` ,
1007993 parent : this
1008- } , this . _recursion + 1 , this . collapseOnStopRecursion )
994+ } , this . currentRecursions + 1 )
1009995 this . editors [ name ] . preBuild ( )
1010996
1011997 if ( ! prebuildOnly ) {
@@ -1019,11 +1005,6 @@ export class ObjectEditor extends AbstractEditor {
10191005 }
10201006
10211007 this . cached_editors [ name ] = this . editors [ name ]
1022-
1023- if ( this . _recursion >= this . jsoneditor . MAX_RECURSIONS ) {
1024- console . info ( 'Stop recursion' )
1025- this . _stopRecursionCallback ( )
1026- }
10271008 }
10281009
10291010 /* If we're only prebuilding the editors, don't refresh values */
@@ -1033,13 +1014,6 @@ export class ObjectEditor extends AbstractEditor {
10331014 }
10341015 }
10351016
1036- collapseOnStopRecursion ( ) {
1037- this . collapsed = true
1038- if ( this . _recursion !== 0 ) {
1039- this . _stopRecursionCallback ( )
1040- }
1041- }
1042-
10431017 onOutsideModalClick ( e ) {
10441018 if ( this . addproperty_holder && ! this . addproperty_holder . contains ( e . target ) && this . adding_property ) {
10451019 e . preventDefault ( )
0 commit comments