Fix #969: adding a new property to an empty object or array is broken
This commit is contained in:
parent
a292b82792
commit
a68ecf5297
|
@ -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.
|
||||
|
|
|
@ -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')
|
||||
}
|
||||
|
|
|
@ -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')
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue