Publish `v5.31.0`

This commit is contained in:
jos 2019-03-10 17:56:47 +01:00
parent 829225849e
commit afead89e3b
9 changed files with 68 additions and 36 deletions

View File

@ -3,7 +3,7 @@
https://github.com/josdejong/jsoneditor https://github.com/josdejong/jsoneditor
## not yet published, version 5.31.0 ## 2019-03-10, version 5.31.0
- Display JSON schema examples in tooltip (#664). Thanks @AdamVig. - Display JSON schema examples in tooltip (#664). Thanks @AdamVig.

View File

@ -24,8 +24,8 @@
* Copyright (c) 2011-2019 Jos de Jong, http://jsoneditoronline.org * Copyright (c) 2011-2019 Jos de Jong, http://jsoneditoronline.org
* *
* @author Jos de Jong, <wjosdejong@gmail.com> * @author Jos de Jong, <wjosdejong@gmail.com>
* @version 5.30.0 * @version 5.31.0
* @date 2019-03-02 * @date 2019-03-10
*/ */
(function webpackUniversalModuleDefinition(root, factory) { (function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object') if(typeof exports === 'object' && typeof module === 'object')
@ -4626,6 +4626,7 @@ return /******/ (function(modules) { // webpackBootstrap
var jsonlint = __webpack_require__(13); var jsonlint = __webpack_require__(13);
var jsonMap = __webpack_require__(14); var jsonMap = __webpack_require__(14);
var translate = __webpack_require__(15).translate;
/** /**
* Parse JSON using the parser built-in in the browser. * Parse JSON using the parser built-in in the browser.
@ -5733,10 +5734,11 @@ return /******/ (function(modules) { // webpackBootstrap
/** /**
* Make a tooltip for a field based on the field's schema. * Make a tooltip for a field based on the field's schema.
* @param {Object} schema JSON schema * @param {object} schema JSON schema
* @param {string} [locale] Locale code (for example, zh-CN)
* @returns {string} Field tooltip, may be empty string if all relevant schema properties are missing * @returns {string} Field tooltip, may be empty string if all relevant schema properties are missing
*/ */
exports.makeFieldTooltip = function (schema) { exports.makeFieldTooltip = function (schema, locale) {
if (!schema) { if (!schema) {
return ''; return '';
} }
@ -5753,6 +5755,16 @@ return /******/ (function(modules) { // webpackBootstrap
tooltip += schema.description; tooltip += schema.description;
} }
if (Array.isArray(schema.examples) && schema.examples.length > 0) {
if (tooltip.length > 0) {
tooltip += '\n\n';
}
tooltip += translate('examples', undefined, locale) + '\n';
schema.examples.forEach(function (example) {
tooltip += JSON.stringify(example, null, 2) + '\n';
});
}
return tooltip; return tooltip;
} }
@ -6685,6 +6697,7 @@ return /******/ (function(modules) { // webpackBootstrap
modeTreeTitle: 'Switch to tree editor', modeTreeTitle: 'Switch to tree editor',
modeViewText: 'View', modeViewText: 'View',
modeViewTitle: 'Switch to tree view', modeViewTitle: 'Switch to tree view',
examples: 'Examples',
}, },
'zh-CN': { 'zh-CN': {
array: '数组', array: '数组',
@ -6767,6 +6780,7 @@ return /******/ (function(modules) { // webpackBootstrap
modeTreeTitle: '切换至树编辑', modeTreeTitle: '切换至树编辑',
modeViewText: '视图', modeViewText: '视图',
modeViewTitle: '切换至树视图', modeViewTitle: '切换至树视图',
examples: '例子',
}, },
'pt-BR': { 'pt-BR': {
array: 'Lista', array: 'Lista',
@ -6860,7 +6874,8 @@ return /******/ (function(modules) { // webpackBootstrap
'Uma lista contem uma coleção de valores ordenados.', 'Uma lista contem uma coleção de valores ordenados.',
stringType: 'Campo do tipo "string". ' + stringType: 'Campo do tipo "string". ' +
'Campo do tipo nao é determinado através do seu valor, ' + 'Campo do tipo nao é determinado através do seu valor, ' +
'mas sempre retornara um texto.' 'mas sempre retornara um texto.',
examples: 'Exemplos',
}, },
tr: { tr: {
array: 'Dizin', array: 'Dizin',
@ -6942,7 +6957,8 @@ return /******/ (function(modules) { // webpackBootstrap
modeTreeText: 'Ağaç', modeTreeText: 'Ağaç',
modeTreeTitle: 'Ağaç düzenleyiciye geç', modeTreeTitle: 'Ağaç düzenleyiciye geç',
modeViewText: 'Görünüm', modeViewText: 'Görünüm',
modeViewTitle: 'Ağaç görünümüne geç' modeViewTitle: 'Ağaç görünümüne geç',
examples: 'Örnekler',
} }
}; };
@ -9002,7 +9018,7 @@ return /******/ (function(modules) { // webpackBootstrap
Node.prototype._updateDomField = function () { Node.prototype._updateDomField = function () {
var domField = this.dom.field; var domField = this.dom.field;
if (domField) { if (domField) {
var tooltip = util.makeFieldTooltip(this.schema); var tooltip = util.makeFieldTooltip(this.schema, this.editor.options.language);
if (tooltip) { if (tooltip) {
domField.title = tooltip; domField.title = tooltip;
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

30
dist/jsoneditor.js vendored
View File

@ -24,8 +24,8 @@
* Copyright (c) 2011-2019 Jos de Jong, http://jsoneditoronline.org * Copyright (c) 2011-2019 Jos de Jong, http://jsoneditoronline.org
* *
* @author Jos de Jong, <wjosdejong@gmail.com> * @author Jos de Jong, <wjosdejong@gmail.com>
* @version 5.30.0 * @version 5.31.0
* @date 2019-03-02 * @date 2019-03-10
*/ */
(function webpackUniversalModuleDefinition(root, factory) { (function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object') if(typeof exports === 'object' && typeof module === 'object')
@ -33268,6 +33268,7 @@ return /******/ (function(modules) { // webpackBootstrap
var jsonlint = __webpack_require__(66); var jsonlint = __webpack_require__(66);
var jsonMap = __webpack_require__(67); var jsonMap = __webpack_require__(67);
var translate = __webpack_require__(68).translate;
/** /**
* Parse JSON using the parser built-in in the browser. * Parse JSON using the parser built-in in the browser.
@ -34375,10 +34376,11 @@ return /******/ (function(modules) { // webpackBootstrap
/** /**
* Make a tooltip for a field based on the field's schema. * Make a tooltip for a field based on the field's schema.
* @param {Object} schema JSON schema * @param {object} schema JSON schema
* @param {string} [locale] Locale code (for example, zh-CN)
* @returns {string} Field tooltip, may be empty string if all relevant schema properties are missing * @returns {string} Field tooltip, may be empty string if all relevant schema properties are missing
*/ */
exports.makeFieldTooltip = function (schema) { exports.makeFieldTooltip = function (schema, locale) {
if (!schema) { if (!schema) {
return ''; return '';
} }
@ -34395,6 +34397,16 @@ return /******/ (function(modules) { // webpackBootstrap
tooltip += schema.description; tooltip += schema.description;
} }
if (Array.isArray(schema.examples) && schema.examples.length > 0) {
if (tooltip.length > 0) {
tooltip += '\n\n';
}
tooltip += translate('examples', undefined, locale) + '\n';
schema.examples.forEach(function (example) {
tooltip += JSON.stringify(example, null, 2) + '\n';
});
}
return tooltip; return tooltip;
} }
@ -35327,6 +35339,7 @@ return /******/ (function(modules) { // webpackBootstrap
modeTreeTitle: 'Switch to tree editor', modeTreeTitle: 'Switch to tree editor',
modeViewText: 'View', modeViewText: 'View',
modeViewTitle: 'Switch to tree view', modeViewTitle: 'Switch to tree view',
examples: 'Examples',
}, },
'zh-CN': { 'zh-CN': {
array: '数组', array: '数组',
@ -35409,6 +35422,7 @@ return /******/ (function(modules) { // webpackBootstrap
modeTreeTitle: '切换至树编辑', modeTreeTitle: '切换至树编辑',
modeViewText: '视图', modeViewText: '视图',
modeViewTitle: '切换至树视图', modeViewTitle: '切换至树视图',
examples: '例子',
}, },
'pt-BR': { 'pt-BR': {
array: 'Lista', array: 'Lista',
@ -35502,7 +35516,8 @@ return /******/ (function(modules) { // webpackBootstrap
'Uma lista contem uma coleção de valores ordenados.', 'Uma lista contem uma coleção de valores ordenados.',
stringType: 'Campo do tipo "string". ' + stringType: 'Campo do tipo "string". ' +
'Campo do tipo nao é determinado através do seu valor, ' + 'Campo do tipo nao é determinado através do seu valor, ' +
'mas sempre retornara um texto.' 'mas sempre retornara um texto.',
examples: 'Exemplos',
}, },
tr: { tr: {
array: 'Dizin', array: 'Dizin',
@ -35584,7 +35599,8 @@ return /******/ (function(modules) { // webpackBootstrap
modeTreeText: 'Ağaç', modeTreeText: 'Ağaç',
modeTreeTitle: 'Ağaç düzenleyiciye geç', modeTreeTitle: 'Ağaç düzenleyiciye geç',
modeViewText: 'Görünüm', modeViewText: 'Görünüm',
modeViewTitle: 'Ağaç görünümüne geç' modeViewTitle: 'Ağaç görünümüne geç',
examples: 'Örnekler',
} }
}; };
@ -37644,7 +37660,7 @@ return /******/ (function(modules) { // webpackBootstrap
Node.prototype._updateDomField = function () { Node.prototype._updateDomField = function () {
var domField = this.dom.field; var domField = this.dom.field;
if (domField) { if (domField) {
var tooltip = util.makeFieldTooltip(this.schema); var tooltip = util.makeFieldTooltip(this.schema, this.editor.options.language);
if (tooltip) { if (tooltip) {
domField.title = tooltip; domField.title = tooltip;
} }

2
dist/jsoneditor.map vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "jsoneditor", "name": "jsoneditor",
"version": "5.30.0", "version": "5.31.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "jsoneditor", "name": "jsoneditor",
"version": "5.30.0", "version": "5.31.0",
"main": "./index", "main": "./index",
"description": "A web-based tool to view, edit, format, and validate JSON", "description": "A web-based tool to view, edit, format, and validate JSON",
"tags": [ "tags": [