Added undefined check when building object

dropdown
This commit is contained in:
NWalker4483 2021-06-21 12:50:19 -04:00
parent 4aa0bdd133
commit 235339a77c
4 changed files with 15 additions and 11 deletions

View File

@ -124,13 +124,13 @@ Editor.prototype.init = function () {
<nav>
<ul>
<li><a id="run_btn"></a></li>
<li class="submenu"><a>Scripts</a>
<li class="submenu"><a>Validate to Load Scripts...</a>
<ul id="scripts_list">
</ul>
</li>
<li class="submenu"><a>Data</a>
<ul id="objects_list">
<li><a>Scripts</a></li>
<li><a>Validate to Load Data...</a></li>
</ul>
</li>
</ul>
@ -272,10 +272,15 @@ var triggerEvent = function (element, eventType) {
function recurseObject(data) {
var html = "";
for (const [key, value] of Object.entries(data)) {
if (typeof value == 'object') {
if (typeof value == 'object' && value != undefined) {
html += `<li class="submenu"><a>${key}</a><ul>` + recurseObject(value) + `</ul><li>`;
} else {
html += `<li><a>${key}</a><div class="data-type">${typeof value}</div></li>`;
let type = typeof value
if (value == undefined){
type = "undefined";
}
html += `<li><a>${key}</a><div class="data-type">${type}</div></li>`;
}
}
return html

View File

@ -1,8 +1,6 @@
import Editor from './Editor';
import CoreModule from 'diagram-js/lib/core';
export default {
// __depends__: [ CoreModule ], // {2}
__init__: [ 'editor' ], // {3}
editor: [ 'type', Editor ] // {1}
__init__: [ 'editor' ],
editor: [ 'type', Editor ]
};

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "diagram-js-code-editor",
"version": "1.0.6",
"version": "1.0.7",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "diagram-js-code-editor",
"version": "1.0.6",
"version": "1.1.0",
"description": "A code-editor for diagram-js",
"main": "dist/index.js",
"module": "dist/index.esm.js",
@ -13,7 +13,8 @@
"test": "",
"distro": "run-s build test:build",
"build": "rollup -c",
"test:build": ""
"test:build": "",
"bump": "npm run build; npm publish"
},
"repository": {
"type": "git",