diff --git a/src/pretix/plugins/ticketoutputpdf/static/pretixplugins/ticketoutputpdf/editor.css b/src/pretix/plugins/ticketoutputpdf/static/pretixplugins/ticketoutputpdf/editor.css index 32b9cba717..bc70ff64fe 100644 --- a/src/pretix/plugins/ticketoutputpdf/static/pretixplugins/ticketoutputpdf/editor.css +++ b/src/pretix/plugins/ticketoutputpdf/static/pretixplugins/ticketoutputpdf/editor.css @@ -39,3 +39,16 @@ body { .preload-font { visibility: hidden; } +#source-container { + position: absolute; + top: 0; + left: 0; + height: 100%; + background: white; + width: 100%; + text-align: center; +} +#source-container textarea { + width: 100%; + height: 250px; +} diff --git a/src/pretix/plugins/ticketoutputpdf/static/pretixplugins/ticketoutputpdf/editor.js b/src/pretix/plugins/ticketoutputpdf/static/pretixplugins/ticketoutputpdf/editor.js index 7078e09d5f..6dc5e65d17 100644 --- a/src/pretix/plugins/ticketoutputpdf/static/pretixplugins/ticketoutputpdf/editor.js +++ b/src/pretix/plugins/ticketoutputpdf/static/pretixplugins/ticketoutputpdf/editor.js @@ -629,6 +629,20 @@ var editor = { editor._load_pdf(d); }, + _source_show: function () { + $("#source-textarea").text(JSON.stringify(editor.dump())); + $("#source-container").show(); + }, + + _source_close: function () { + $("#source-container").hide(); + }, + + _source_save: function () { + editor.load(JSON.parse($("#source-textarea").val())); + $("#source-container").hide(); + }, + init: function () { editor.$pdfcv = $("#pdf-canvas"); editor.pdf_url = editor.$pdfcv.attr("data-pdf-url"); @@ -646,6 +660,7 @@ var editor = { return gettext("Do you really want to leave the editor without saving your changes?"); } }; + $("#source-container").hide(); $('#fileupload').fileupload({ @@ -704,6 +719,9 @@ var editor = { $("#toolbox-paste").bind('click', editor._paste); $("#toolbox-undo").bind('click', editor._undo); $("#toolbox-redo").bind('click', editor._redo); + $("#toolbox-source").bind('click', editor._source_show); + $("#source-close").bind('click', editor._source_close); + $("#source-save").bind('click', editor._source_save); } }; diff --git a/src/pretix/plugins/ticketoutputpdf/templates/pretixplugins/ticketoutputpdf/index.html b/src/pretix/plugins/ticketoutputpdf/templates/pretixplugins/ticketoutputpdf/index.html index 1d335ec170..42e610fed5 100644 --- a/src/pretix/plugins/ticketoutputpdf/templates/pretixplugins/ticketoutputpdf/index.html +++ b/src/pretix/plugins/ticketoutputpdf/templates/pretixplugins/ticketoutputpdf/index.html @@ -14,6 +14,10 @@
+
+
+
+ + {% blocktrans trimmed %} + This feature is only intended for advanced users. We recommend to only use it + to copy and share ticket designs, not to modify the design source code. + {% endblocktrans %} + +
+

+ +

+

+ + +

+