diff --git a/HISTORY.md b/HISTORY.md index b117bdc..44b8d4a 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -3,6 +3,12 @@ https://github.com/josdejong/jsoneditor +## not yet published, version 8.6.6 + +- Fix #969: adding a new property to an empty object or array is broken. + Regression introduced in `v8.6.5`. + + ## 2020-04-19, version 8.6.5 - Fix #964: translation of titles of some context menu items not working. diff --git a/src/js/Node.js b/src/js/Node.js index 88e84a8..8906861 100644 --- a/src/js/Node.js +++ b/src/js/Node.js @@ -3633,15 +3633,6 @@ export class Node { */ showContextMenu (anchor, onClose) { const node = this - - // titles with explanation for the different types - const titles = { - auto: translate('autoType'), - object: translate('objectType'), - array: translate('arrayType'), - string: translate('stringType') - } - let items = [] if (this.editable.value) { @@ -3654,7 +3645,7 @@ export class Node { text: translate('auto'), className: 'jsoneditor-type-auto' + (this.type === 'auto' ? ' jsoneditor-selected' : ''), - title: titles.auto, + title: translate('autoType'), click: function () { node._onChangeType('auto') } @@ -3663,7 +3654,7 @@ export class Node { text: translate('array'), className: 'jsoneditor-type-array' + (this.type === 'array' ? ' jsoneditor-selected' : ''), - title: titles.array, + title: translate('arrayType'), click: function () { node._onChangeType('array') } @@ -3672,7 +3663,7 @@ export class Node { text: translate('object'), className: 'jsoneditor-type-object' + (this.type === 'object' ? ' jsoneditor-selected' : ''), - title: titles.object, + title: translate('objectType'), click: function () { node._onChangeType('object') } @@ -3681,7 +3672,7 @@ export class Node { text: translate('string'), className: 'jsoneditor-type-string' + (this.type === 'string' ? ' jsoneditor-selected' : ''), - title: titles.string, + title: translate('stringType'), click: function () { node._onChangeType('string') } diff --git a/src/js/appendNodeFactory.js b/src/js/appendNodeFactory.js index a307a06..459d56d 100644 --- a/src/js/appendNodeFactory.js +++ b/src/js/appendNodeFactory.js @@ -146,12 +146,12 @@ export function appendNodeFactory (Node) { */ AppendNode.prototype.showContextMenu = function (anchor, onClose) { const node = this - const titles = Node.TYPE_TITLES + const appendSubmenu = [ { text: translate('auto'), className: 'jsoneditor-type-auto', - title: titles.auto, + title: translate('autoType'), click: function () { node._onAppend('', '', 'auto') } @@ -159,7 +159,7 @@ export function appendNodeFactory (Node) { { text: translate('array'), className: 'jsoneditor-type-array', - title: titles.array, + title: translate('arrayType'), click: function () { node._onAppend('', []) } @@ -167,7 +167,7 @@ export function appendNodeFactory (Node) { { text: translate('object'), className: 'jsoneditor-type-object', - title: titles.object, + title: translate('objectType'), click: function () { node._onAppend('', {}) } @@ -175,7 +175,7 @@ export function appendNodeFactory (Node) { { text: translate('string'), className: 'jsoneditor-type-string', - title: titles.string, + title: translate('stringType'), click: function () { node._onAppend('', '', 'string') }