Commit 593d78f0 authored by lukas.niegsch's avatar lukas.niegsch

made ui more responsive

parent d97d8849
...@@ -44,4 +44,5 @@ html, body { ...@@ -44,4 +44,5 @@ html, body {
box-shadow: 2px 2px 3px #999; box-shadow: 2px 2px 3px #999;
font-size: 16px; font-size: 16px;
z-index: 9999; z-index: 9999;
border: 2px solid blue;
} }
\ No newline at end of file
...@@ -21,6 +21,10 @@ ...@@ -21,6 +21,10 @@
indentUnit: 4, indentUnit: 4,
tabsize: 4 tabsize: 4
}); });
var editor = document.querySelector(".CodeMirror").CodeMirror
editor.on("change", function (event) {
document.getElementById('convert').style.border = "";
})
}) })
.onEvent("click", function (event) { .onEvent("click", function (event) {
var gadget = this; var gadget = this;
...@@ -29,20 +33,23 @@ ...@@ -29,20 +33,23 @@
case "convert": case "convert":
return gadget.changeState({update: true}); return gadget.changeState({update: true});
} }
}) })
.onStateChange(function (ignored) { .onStateChange(function (ignored) {
var gadget = this; var gadget = this;
var editor = document.querySelector(".CodeMirror").CodeMirror; var editor = document.querySelector(".CodeMirror").CodeMirror;
var viewer = document.getElementById("viewer") var viewer = document.getElementById("viewer");
var button = document.getElementById('convert');
var converter; var converter;
return gadget.getDeclaredGadget("converter") return gadget.getDeclaredGadget("converter")
.push(function (subgadget) { .push(function (subgadget) {
converter = subgadget; converter = subgadget;
button.style.border = "2px solid orange";
let html = editor.getValue(); let html = editor.getValue();
return converter.convert(html); return converter.convert(html);
}) })
.push(function (base64data) { .push(function (base64data) {
button.style.border = "2px solid green";
viewer.src = "data:application/pdf;base64," + base64data; viewer.src = "data:application/pdf;base64," + base64data;
}) })
.push(function () { .push(function () {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment