File tree Expand file tree Collapse file tree 2 files changed +29
-10
lines changed
extensions/web-base/www/app Expand file tree Collapse file tree 2 files changed +29
-10
lines changed Original file line number Diff line number Diff line change @@ -552,28 +552,43 @@ var promptDialog = new Vue({
552
552
data : {
553
553
message : 'Nothing here' ,
554
554
schema : false ,
555
- value : null
555
+ value : ''
556
556
} ,
557
557
methods : {
558
558
ask : function ( schema , message ) {
559
+ if ( typeof schema === 'string' ) {
560
+ message = schema ;
561
+ schema = undefined ;
562
+ }
559
563
if ( ! isObject ( schema ) ) {
560
- return Promise . reject ( 'invalid schema' ) ;
564
+ schema = {
565
+ title : 'Value' ,
566
+ type : 'string'
567
+ } ;
561
568
}
562
- this . schema = schema ;
569
+ var wrapped = false ;
563
570
if ( schema . type === 'object' ) {
571
+ this . schema = schema ;
564
572
this . value = { } ;
565
573
} else if ( schema . type === 'array' ) {
574
+ this . schema = schema ;
566
575
this . value = [ ] ;
567
576
} else {
568
- this . value = '' ;
577
+ this . schema = {
578
+ type : 'array' ,
579
+ prefixItems : [ schema ] ,
580
+ minItems : 1
581
+ }
582
+ this . value = [ ] ;
583
+ wrapped = true ;
569
584
}
570
585
this . message = message || 'Value?' ;
571
586
app . openDialog ( 'prompt' ) ;
572
587
var self = this ;
573
588
return new Promise ( function ( resolve , reject ) {
574
589
self . apply = function ( confirm ) {
575
590
if ( confirm ) {
576
- resolve ( self . value ) ;
591
+ resolve ( wrapped ? self . value [ 0 ] : self . value ) ;
577
592
} else {
578
593
reject ( 'canceled' ) ;
579
594
}
Original file line number Diff line number Diff line change @@ -426,11 +426,15 @@ Vue.component('json-item', {
426
426
v = parseJsonItemValue ( this . schema . type , val ) ;
427
427
}
428
428
}
429
- var k = this . $vnode . key ;
430
- if ( v === undefined ) {
431
- delete this . pobj [ k ] ;
432
- } else {
433
- this . pobj [ k ] = v ;
429
+ if ( this . pobj && isObject ( this . pobj ) ) {
430
+ var k = this . $vnode . key ;
431
+ if ( v === undefined ) {
432
+ delete this . pobj [ k ] ;
433
+ } else {
434
+ this . pobj [ k ] = v ;
435
+ }
436
+ } else if ( v !== undefined ) {
437
+ this . obj = v ;
434
438
}
435
439
}
436
440
} ,
You can’t perform that action at this time.
0 commit comments