Fix #946: `language` not working in modes `text`, `code`, and `preview`

This commit is contained in:
jos 2020-03-29 11:57:06 +02:00
parent 4f433cb6a9
commit d62d2e14db
3 changed files with 11 additions and 2 deletions

View File

@ -5,6 +5,7 @@ https://github.com/josdejong/jsoneditor
## not yet published, version 8.6.4
- Fix #921: `sortObjectKeys` emits `onChange` events.
- Fix #946: `language` not working in modes `text`, `code`, and `preview`.
- Implement support for repairing line separate JSON.

View File

@ -1,6 +1,6 @@
'use strict'
import { translate } from './i18n'
import { setLanguage, setLanguages, translate } from './i18n'
import { ModeSwitcher } from './ModeSwitcher'
import { ErrorTable } from './ErrorTable'
import { showSortModal } from './showSortModal'
@ -56,6 +56,10 @@ previewmode.create = function (container, options = {}) {
this.indentation = 2 // number of spaces
}
// language
setLanguages(this.options.languages)
setLanguage(this.options.language)
// determine mode
this.mode = 'preview'

View File

@ -1,7 +1,7 @@
'use strict'
import ace from './ace'
import { translate } from './i18n'
import { setLanguage, setLanguages, translate } from './i18n'
import { ModeSwitcher } from './ModeSwitcher'
import { ErrorTable } from './ErrorTable'
import { validateCustom } from './validationUtils'
@ -59,6 +59,10 @@ textmode.create = function (container, options = {}) {
this.indentation = 2 // number of spaces
}
// language
setLanguages(this.options.languages)
setLanguage(this.options.language)
// grab ace from options if provided
const _ace = options.ace ? options.ace : ace
// TODO: make the option options.ace deprecated, it's not needed anymore (see #309)