summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2015-12-14 12:41:38 +0100
committerPatrick Simianer <p@simianer.de>2015-12-14 12:41:38 +0100
commit0c7416c98a9f21eb3a10a59a8553228ecb8338af (patch)
tree2fc3cae8cfc7e7ce4c36d193087df6e1d22af8c8
parente2feed531667f16840f74613853075c47e93ae8e (diff)
extract raw svg as fun.
-rw-r--r--derivation-editor.js20
1 files changed, 12 insertions, 8 deletions
diff --git a/derivation-editor.js b/derivation-editor.js
index 968d591..29f95c1 100644
--- a/derivation-editor.js
+++ b/derivation-editor.js
@@ -980,6 +980,14 @@ var DE_enter_edit_mode = function (sh, kbd=false)
* extract data from ui
*
*/
+var DE_get_raw_svg_data = function()
+{
+ if (DE_paper)
+ return btoa(DE_paper.canvas.innerHTML);
+ else
+ return "";
+}
+
var DE_extract_data = function ()
{
el = document.getElementById("data");
@@ -1013,16 +1021,12 @@ var DE_extract_data = function ()
}
// source_raw
if (DE_data_source_raw) {
- for (var i=0; i<DE_data_source_raw.length; i++) {
- d["source_raw"].push(encodeURIComponent(DE_data_source_raw[i]));
- }
+ for (var i=0; i<DE_data_source_raw.length; i++) {
+ d["source_raw"].push(encodeURIComponent(DE_data_source_raw[i]));
+ }
}
-
// image
- d["svg"] = "";
- if (DE_paper)
- d["svg"] = btoa(DE_paper.canvas.innerHTML);
-
+ d["svg"] = DE_get_raw_svg_data();
// output
s = JSON.stringify(d);
el.innerHTML = s;