@dualbox/editor 1.0.19 → 1.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -112,7 +112,11 @@ class GraphView {
112
112
  }
113
113
 
114
114
  // add main template
115
- this.templateMgr.appendTemplate(this.div, "main", {showLoadSaveButtons: this.attrs.showLoadSaveButtons}, () => {
115
+ this.templateMgr.appendTemplate(this.div, "main", {
116
+ showLoadButton: this.attrs.showLoadButton,
117
+ showSaveButton: this.attrs.showSaveButton,
118
+ saveButtonFunction: this.attrs.saveButtonFunction
119
+ }, () => {
116
120
  // for convenience, define thoses once the main div is ready
117
121
  this.div.ready(() => {
118
122
  this.graphContainer = this.div.find('.dualbox-graph-container');
@@ -352,3 +352,129 @@
352
352
  .dualbox-graph-container span {
353
353
  pointer-events: none;
354
354
  }
355
+
356
+ /* ex-plumb.css */
357
+ .dualbox-graph-canvas .marker-color-tag {
358
+ height: 8px;
359
+ margin: 0 3px 3px 0;
360
+ padding: 0;
361
+ width: 42px;
362
+ line-height: 75pt;
363
+ border-radius: 3px;
364
+ display: block;
365
+ width: 100%;
366
+ }
367
+
368
+ .input-color-tag {
369
+ background-color: #F2D600;
370
+ }
371
+
372
+ .output-color-tag {
373
+ background-color: #FFAB4A;
374
+ }
375
+
376
+ .ui-color-tag {
377
+ background-color: #61BD4F;
378
+ }
379
+
380
+ .metanode-color-tag {
381
+ background-color: #DDDDDD;
382
+ }
383
+
384
+ .input {
385
+ }
386
+
387
+ .output {
388
+ }
389
+
390
+ .dualbox-graph-canvas .jsplumb-connector {
391
+ z-index: 4;
392
+ }
393
+
394
+ .dualbox-graph-canvas .jsplumb-endpoint {
395
+ z-index: 30;
396
+ }
397
+ .dualbox-graph-canvas .inoutEndpointLabel, .endpointSourceLabel {
398
+ box-shadow: 1px 1px 1px #716f6f;
399
+ -o-box-shadow: 1px 1px 1px #716f6f;
400
+ -webkit-box-shadow: 0px 1px 1px #716f6f;
401
+ -moz-box-shadow: 1px 1px 1px #716f6f;
402
+ z-index: 2000;
403
+ transform:translate(0%,0%) !important; /* this shit is just to prevent jsplumb of centering the box on the endpoint... */
404
+ }
405
+ .dualbox-graph-canvas .descSpan {
406
+ box-shadow: 1px 1px 1px #716f6f;
407
+ -o-box-shadow: 1px 1px 1px #716f6f;
408
+ -webkit-box-shadow: 0px 1px 1px #716f6f;
409
+ -moz-box-shadow: 1px 1px 1px #716f6f;
410
+ position: fixed;
411
+ display:none;
412
+ z-index:2010;
413
+ }
414
+
415
+ .dualbox-graph-canvas .aLabel {
416
+ background-color: white;
417
+ padding: 0.4em;
418
+ font: 12px sans-serif;
419
+ color: #444;
420
+ z-index: 21;
421
+ border: 1px dotted gray;
422
+ opacity: 0.8;
423
+ cursor: pointer;
424
+ }
425
+
426
+ .dualbox-graph-canvas .aLabel.jsplumb-hover {
427
+ background-color: #5C96BC;
428
+ color: white;
429
+ border: 1px solid white;
430
+ }
431
+
432
+ .card.jsplumb-connected {
433
+ /*border: 1px solid #a1a1a1; change border when connected to spot isolated elements as disabled*/
434
+ }
435
+
436
+ .jsplumb-drag {
437
+ opacity:0.7 !important;
438
+ }
439
+
440
+ path, .jsplumb-endpoint {
441
+ cursor: pointer;
442
+ }
443
+
444
+ .jsplumb-overlay {
445
+ background-color:transparent;
446
+ }
447
+
448
+ .fileUpload {
449
+ position: relative;
450
+ overflow: hidden;
451
+ margin: 10px;
452
+ }
453
+ .fileUpload input.upload {
454
+ position: absolute;
455
+ top: 0;
456
+ right: 0;
457
+ margin: 0;
458
+ padding: 0;
459
+ font-size: 20px;
460
+ cursor: pointer;
461
+ opacity: 0;
462
+ filter: alpha(opacity=0);
463
+ }
464
+
465
+
466
+ .module-edit-modal-body .btn+.btn {
467
+ margin-bottom: 0;
468
+ margin-left: 5px;
469
+ }
470
+
471
+ .btn-add-node {
472
+ width:46%;
473
+ margin:1%;
474
+ }
475
+
476
+ button.close {
477
+ position: absolute;
478
+ right: 0;
479
+ margin-right: 5px!important;
480
+ }
@@ -10,12 +10,14 @@
10
10
  </li>
11
11
  </ul>
12
12
 
13
- @if (attrs.showLoadSaveButtons) {
14
- <div class="nav navbar-right" style="vertical-align: top; margin-top: 5px; margin-right: 10px; margin-bottom: 5px;">
15
- <button class="load-app btn btn-sm btn-light" style="position: relative; bottom: 3px;">Load App</button>
16
- <button class="save-app btn btn-sm btn-light" style="position: relative; bottom: 3px;">Save App</button>
17
- </div>
18
- }
13
+ <div class="nav navbar-right" style="vertical-align: top; margin-top: 5px; margin-right: 10px; margin-bottom: 5px;">
14
+ @if (attrs.showLoadButton) {
15
+ <button class="load-app btn btn-sm btn-light" style="position: relative; bottom: 3px;">Load App</button>
16
+ }
17
+ @if (attrs.showSaveButton) {
18
+ <button class="save-app btn btn-sm btn-light" style="position: relative; bottom: 3px;">Save App</button>
19
+ }
20
+ </div>
19
21
  </nav>
20
22
  <div class="tab-content dualbox-graph-tab" style="width: 100%; height: calc(100% - 46px);">
21
23
  <div class="tab-pane active" id="1" style="width: 100%; height: 100%;">
@@ -1,7 +1,7 @@
1
1
  const swal = require('sweetalert2');
2
2
  var CodeMirror = require('../../libs/CodeMirror.js');
3
3
 
4
- var TemplateBinds = function(view, div) {
4
+ var TemplateBinds = function(view, div, data) {
5
5
  // instanciate main settings first
6
6
  view.setMainMenu();
7
7
 
@@ -32,7 +32,6 @@ var TemplateBinds = function(view, div) {
32
32
  })
33
33
  });
34
34
 
35
- // bind the app load
36
35
  div.find('.load-app').click(function(e) {
37
36
  // create a fake input and click it to select a file
38
37
  var input = $('<input/>', { "type": "file", "class": "upload", "accept" : ".json" });
@@ -55,24 +54,33 @@ var TemplateBinds = function(view, div) {
55
54
  });
56
55
 
57
56
  // bind the app load
58
- div.find('.save-app').click(function(e) {
59
- var app = view.m.getCleanJson();
60
- var text = JSON.stringify(app, null, 2);
61
- var blob = new Blob([text], { "type" : "application/octet-stream" });
62
-
63
- var a = document.createElement('a');
64
- a.href = window.URL.createObjectURL(blob);
65
- a.download = "app.json";
66
-
67
- // simulate a click on the link
68
- if (document.createEvent) {
69
- var event = document.createEvent("MouseEvents");
70
- event.initEvent("click", true, true);
71
- a.dispatchEvent(event);
72
- } else {
73
- a.click();
57
+ if( data.saveButtonFunction ) {
58
+ var saveButtonFunction = function(e) {
59
+ var json = view.m.getCleanJson();
60
+ return data.saveButtonFunction(json);
74
61
  }
75
- });
62
+ }
63
+ else {
64
+ var saveButtonFunction = function(e) {
65
+ var app = view.m.getCleanJson();
66
+ var text = JSON.stringify(app, null, 2);
67
+ var blob = new Blob([text], { "type" : "application/octet-stream" });
68
+
69
+ var a = document.createElement('a');
70
+ a.href = window.URL.createObjectURL(blob);
71
+ a.download = "app.json";
72
+
73
+ // simulate a click on the link
74
+ if (document.createEvent) {
75
+ var event = document.createEvent("MouseEvents");
76
+ event.initEvent("click", true, true);
77
+ a.dispatchEvent(event);
78
+ } else {
79
+ a.click();
80
+ }
81
+ }
82
+ }
83
+ div.find('.save-app').click(saveButtonFunction);
76
84
 
77
85
  div.find('.add-box').click(function(e) {
78
86
  $('#add-node-modal').modal();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dualbox/editor",
3
- "version": "1.0.19",
3
+ "version": "1.0.21",
4
4
  "description": "Editor of Dualbox apps",
5
5
  "browser": "js/dist/GraphEditor.js",
6
6
  "main": "js/dist/GraphEditor.js",