@@ -67,15 +67,15 @@ JSONEditor.defaults.themes.foundation = JSONEditor.AbstractTheme.extend({
6767 addInputError : function ( input , text ) {
6868 if ( ! input . group ) return ;
6969 input . group . className += ' error' ;
70-
70+
7171 if ( ! input . errmsg ) {
7272 input . insertAdjacentHTML ( 'afterend' , '<small class="error"></small>' ) ;
7373 input . errmsg = input . parentNode . getElementsByClassName ( 'error' ) [ 0 ] ;
7474 }
7575 else {
7676 input . errmsg . style . display = '' ;
7777 }
78-
78+
7979 input . errmsg . textContent = text ;
8080 } ,
8181 removeInputError : function ( input ) {
@@ -222,3 +222,63 @@ JSONEditor.defaults.themes.foundation5 = JSONEditor.defaults.themes.foundation.e
222222 holder . children [ 0 ] . appendChild ( tab ) ;
223223 }
224224} ) ;
225+
226+ JSONEditor . defaults . themes . foundation6 = JSONEditor . defaults . themes . foundation5 . extend ( {
227+ getIndentedPanel : function ( ) {
228+ var el = document . createElement ( 'div' ) ;
229+ el . className = 'callout secondary' ;
230+ return el ;
231+ } ,
232+ getButtonHolder : function ( ) {
233+ var el = document . createElement ( 'div' ) ;
234+ el . className = 'button-group tiny' ;
235+ el . style . marginBottom = 0 ;
236+ return el ;
237+ } ,
238+ getFormInputLabel : function ( text ) {
239+ var el = this . _super ( text ) ;
240+ el . style . display = 'block' ;
241+ return el ;
242+ } ,
243+ getFormControl : function ( label , input , description ) {
244+ var el = document . createElement ( 'div' ) ;
245+ el . className = 'form-control' ;
246+ if ( label ) el . appendChild ( label ) ;
247+ if ( input . type === 'checkbox' ) {
248+ label . insertBefore ( input , label . firstChild ) ;
249+ }
250+ else if ( label ) {
251+ label . appendChild ( input ) ;
252+ } else {
253+ el . appendChild ( input ) ;
254+ }
255+
256+ if ( description ) label . appendChild ( description ) ;
257+ return el ;
258+ } ,
259+ addInputError : function ( input , text ) {
260+ if ( ! input . group ) return ;
261+ input . group . className += ' error' ;
262+
263+ if ( ! input . errmsg ) {
264+ var errorEl = document . createElement ( 'span' ) ;
265+ errorEl . className = 'form-error is-visible' ;
266+ input . group . getElementsByTagName ( 'label' ) [ 0 ] . appendChild ( errorEl ) ;
267+
268+ input . className = input . className + ' is-invalid-input' ;
269+
270+ input . errmsg = errorEl ;
271+ }
272+ else {
273+ input . errmsg . style . display = '' ;
274+ input . className = '' ;
275+ }
276+
277+ input . errmsg . textContent = text ;
278+ } ,
279+ removeInputError : function ( input ) {
280+ if ( ! input . errmsg ) return ;
281+ input . className = input . className . replace ( / i s - i n v a l i d - i n p u t / g, '' ) ;
282+ input . errmsg . parentNode . removeChild ( input . errmsg ) ;
283+ } ,
284+ } )
0 commit comments