Skip to content

Commit

Permalink
Fix josdejong#946: language not working in modes text, code, an…
Browse files Browse the repository at this point in the history
…d `preview`
  • Loading branch information
josdejong committed Mar 29, 2020
1 parent 4f433cb commit d62d2e1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.


Expand Down
6 changes: 5 additions & 1 deletion src/js/previewmode.js
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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'

Expand Down
6 changes: 5 additions & 1 deletion src/js/textmode.js
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d62d2e1

Please sign in to comment.