(params, opts = {})
| 895 | }; |
| 896 | |
| 897 | let applyPanelOptions = (params, opts = {}) => { |
| 898 | Object.keys(params).forEach(key => formatOptions[key] = params[key]); |
| 899 | formatOptions.autoDecode = !!formatOptions.AUTO_TEXT_DECODE; |
| 900 | formatOptions.NESTED_ESCAPE_PARSE = !!formatOptions.NESTED_ESCAPE_PARSE; |
| 901 | formatOptions.JSON_FORMAT_COMPACT_MODE = !!formatOptions.JSON_FORMAT_COMPACT_MODE; |
| 902 | formatOptions.JSON_FORMAT_THEME = parseInt(formatOptions.JSON_FORMAT_THEME, 10) || 0; |
| 903 | formatOptions.MAX_JSON_KEYS_NUMBER = parseInt(formatOptions.MAX_JSON_KEYS_NUMBER, 10) || 10000; |
| 904 | |
| 905 | _syncFormatterEscapeState(); |
| 906 | _applyToolbarDisplayState(); |
| 907 | _applyUiMode(); |
| 908 | _applyCompactMode(); |
| 909 | _syncFormatterStatusBarState(); |
| 910 | |
| 911 | $('body').toggleClass('remove-quote', !formatOptions.KEEP_KEY_VALUE_DBL_QUOTE); |
| 912 | $('#jfToolbar .x-fix-encoding').toggle(!!formatOptions.FIX_ERROR_ENCODING); |
| 913 | |
| 914 | if (formatOptions.ENABLE_JSON_KEY_SORT) { |
| 915 | $('#jfToolbar .x-sort').show(); |
| 916 | } else { |
| 917 | formatOptions.sortType = 0; |
| 918 | $('[name=jsonsort][value=0]').prop('checked', true); |
| 919 | $('#jfToolbar .x-sort').hide(); |
| 920 | try { |
| 921 | localStorage.setItem(JSON_SORT_TYPE_KEY, 0); |
| 922 | } catch (e) {} |
| 923 | } |
| 924 | _syncSortMenuState(); |
| 925 | |
| 926 | if (opts.reformat) { |
| 927 | _didFormat(); |
| 928 | } |
| 929 | }; |
| 930 | |
| 931 | const liveCheckboxOptions = { |
| 932 | alwaysOn: {key: 'JSON_PAGE_FORMAT', reformat: false}, |
no test coverage detected