File tree Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change 4
4
; ( function ( window , $ ) {
5
5
$ ( function ( ) {
6
6
$ ( 'div.jsoneditor-wrap' ) . each ( function ( i , wrap ) {
7
+ var fieldset = $ ( wrap ) . parents ( 'li:eq(0)' ) ;
7
8
var container = $ ( wrap ) [ 0 ] ;
8
9
var textarea = $ ( $ ( wrap ) . find ( 'textarea' ) ) ;
9
10
var editor ;
10
11
var options = {
12
+ modes : [ 'tree' , 'text' ] ,
11
13
mode : 'tree' ,
12
14
change : function ( ev ) {
13
- textarea . text ( JSON . stringify ( editor . get ( ) ) ) ;
15
+ try {
16
+ var text = JSON . stringify ( editor . get ( ) ) ;
17
+ textarea . text ( text ) ;
18
+ $ ( fieldset ) . toggleClass ( 'error' , false ) ;
19
+ textarea . text ( JSON . stringify ( editor . get ( ) ) ) ;
20
+ } catch ( e ) {
21
+ editor . options . error ( e ) ;
22
+ }
23
+ } ,
24
+ error : function ( e ) {
25
+ $ ( fieldset ) . toggleClass ( 'error' , true ) ;
14
26
}
15
27
} ;
16
28
editor = new JSONEditor ( container , options , JSON . parse ( textarea . val ( ) ) ) ;
Original file line number Diff line number Diff line change 44
44
.jsoneditor .search .frame {
45
45
border-color : rgb (201 , 208 , 214 );
46
46
}
47
+
48
+
49
+ /*
50
+ * Use text mode
51
+ */
52
+ .jsoneditor-wrap textarea .text {
53
+ display : block;
54
+ }
55
+ .jsoneditor .menu button .separator {
56
+ color : black;
57
+ text-shadow : none;
58
+ }
59
+ .jsoneditor-contextmenu ul li button {
60
+ text-shadow : none;
61
+ }
62
+ form fieldset > ol > li .error .jsoneditor {
63
+ border : 1px solid # 932419 ;
64
+ }
Original file line number Diff line number Diff line change
1
+ class JsonbInput < JsonInput
2
+
3
+ end
You can’t perform that action at this time.
0 commit comments