').addClass("row");
for (let xfile of row) {
- div.append(xfile);
+ if (xfile.classList[1])
+ div.append(xfile);
}
- divFiles.append(div)
+ if (div[0].innerHTML)
+ divFiles.append(div)
}
this.$el.append($("
").attr("id", "filesCore").append(divFiles).append($("
").attr("id", "core").html(core_tpl())))
+ this.$el.find("#core .cb-XMLFile").html(xmlfile_tpl())
+
+ const edCnt = this.$el.find("#core .cb-ace").get(0);
+
+ loadScript("dist/js/libs/ace/ace.js", { scriptTag: true }).then(() => {
+ var editor;
+ ace.require(['ace/ace'], (loadedAce) => {
+ editor = loadedAce.edit(edCnt);
+
+ editor.setTheme("ace/theme/chrome");
+ editor.setShowPrintMargin(false);
+ editor.getSession().setMode("ace/mode/xml");
+ editor.$blockScrolling = Infinity;
+ editor.$enableBlockSelect = false;
+ editor.$enableMultiselect = false;
+ if (XML == undefined)
+ editor.getSession().insert({ column: 0, row: 0 }, coreXML_tpl())
+ else
+ editor.getSession().insert({ column: 0, row: 0 }, XML)
+ editor.moveCursorTo({ column: 0, row: 0 });
+ });
+ });
+
+ this.$el.find("#core .cb-ace").height(this.$el.find("#files").height() - this.$el.find("#coreHeader").height())
}
}
diff --git a/src/js/views/app-view.js b/src/js/views/app-view.js
index d556c79..f59c440 100644
--- a/src/js/views/app-view.js
+++ b/src/js/views/app-view.js
@@ -8,6 +8,7 @@ import ElementSet from '../data/model-ElementSet';
import FileUploadComponent from '../components/fileupload';
import SetElementsComponent from '../components/setelements';
import Events from '../utils/backbone-events.js';
+import loadScript from "../utils/load-script"
// Sadly Bootstrap js is not ES6 ready yet.
var $ = global.jQuery = require('jquery');
@@ -105,8 +106,21 @@ class CoreBuilder extends Backbone.View {
arrange(e) {
e.preventDefault();
let pos = 6 - $(e.target).index();
- this.xmlFilesView.arrange(pos);
- this.coreView.renderEntries()
+
+ const edCnt = this.$el.find("#core .cb-ace").get(0);
+
+ loadScript("dist/js/libs/ace/ace.js", { scriptTag: true }).then(() => {
+ var editor;
+ ace.require(['ace/ace'], (loadedAce) => {
+ editor = loadedAce.edit(edCnt);
+
+ let XML = ""
+ for (let i = 0; i < editor.getSession().getLength(); i++)
+ XML += editor.getSession().getLine(i) + '\n'
+
+ this.xmlFilesView.arrange(pos, XML)
+ });
+ });
}
}
diff --git a/src/scss/workspace.scss b/src/scss/workspace.scss
index 648a87e..0fc93b8 100644
--- a/src/scss/workspace.scss
+++ b/src/scss/workspace.scss
@@ -37,75 +37,84 @@
.row {
margin: 0;
- .cb-XMLFile {
- background: Grey;
- border: 1px solid White;
- min-height: 20em;
- padding: 2px;
-
- .cb-xf-title {
- min-height: 2em;
+ .cb-ace {
+ min-height: inherit;
+ }
+ }
+ }
+
+ .cb-XMLFile {
+ background: Grey;
+ border: 1px solid White;
+ min-height: 20em;
+ padding: 2px;
+
+ .cb-xf-title {
+ min-height: 2em;
+ color: white;
+ font-weight: bold;
+
+ .cb-xf-controls {
+ float: right;
+
+ a:link,
+ a:hover,
+ a:active,
+ a:visited {
color: white;
- font-weight: bold;
-
- .cb-xf-controls {
- float: right;
-
- a:link,
- a:hover,
- a:active,
- a:visited {
- color: white;
- text-decoration: none;
- }
-
- button span {
- display: none;
- }
- }
+ text-decoration: none;
+ }
- .cb-xf-xp-drawer {
- color: black;
- width: 250px;
- background-color: $logo-secondary;
- height: 35px;
- margin: auto;
- position: absolute;
- top: 36px;
- left: 0;
- right: 0;
- z-index: 999 !important;
- text-align: center;
- border-radius: 5px;
- display: none;
-
- span {
- display: inline-block;
- margin-top: 5px;
- }
-
- span.cb-xf-xp-d-ctrls {
- display: inline-block;
- float: right;
- margin: 5px 10px 0 0;
-
- a.cb-xf-xp-d-b {
- }
- }
- }
+ button span {
+ display: none;
+ }
+ }
- .cb-xf-xp-drawer.cb-xp-ok {
- background-color: green;
- }
- .cb-xf-xp-drawer.cb-xp-fail {
- background-color: red;
- }
+ .cb-xf-xp-drawer {
+ color: black;
+ width: 250px;
+ background-color: $logo-secondary;
+ height: 35px;
+ margin: auto;
+ position: absolute;
+ top: 36px;
+ left: 0;
+ right: 0;
+ z-index: 999 !important;
+ text-align: center;
+ border-radius: 5px;
+ display: none;
+
+ span {
+ display: inline-block;
+ margin-top: 5px;
}
- .cb-ace {
- min-height: inherit;
+ span.cb-xf-xp-d-ctrls {
+ display: inline-block;
+ float: right;
+ margin: 5px 10px 0 0;
+
+ a.cb-xf-xp-d-b {
+ }
}
}
+
+ .cb-xf-xp-drawer.cb-xp-ok {
+ background-color: green;
+ }
+ .cb-xf-xp-drawer.cb-xp-fail {
+ background-color: red;
+ }
+ }
+ }
+
+ #core {
+ width: 100%;
+
+ #coreSubHeader {
+ display: flex;
+ justify-content: space-between;
}
}
}