Commit f5e12409 authored by Tristan Cavelier's avatar Tristan Cavelier

erp5_svg_editor: lint svg-editor.erp5.js + enable async ajax

parent 2c5c9be5
...@@ -38,30 +38,37 @@ ...@@ -38,30 +38,37 @@
</item> </item>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <unicode>window.onload = function() {\n <value> <unicode>window.onload = function () {\n
var svg_canvas = window.frames["svgframe"].svgCanvas;\n $.ajax({\n
var text_content = $.ajax({\n url: "Base_getSVGTextContent",\n
url: "Base_getSVGTextContent",\n async: true,\n
async: false\n success: function (text_content) {\n
}).responseText;\n var svg_canvas, frame = window.frames.svgframe;\n
text_content != "" ? svg_canvas.setSvgString(text_content) : null;\n if (text_content !== "") {\n
}\n svg_canvas = frame.svgCanvas;\n
svg_canvas.ready(function () {\n
svg_canvas.setSvgString(text_content);\n
});\n
}\n
}\n
});\n
};\n
\n \n
$(document).ready(function(){\n $(document).ready(function () {\n
$("button.save").click(function(event){\n $("button.save").click(function (event) {\n
event.preventDefault();\n event.preventDefault();\n
var svg_canvas = window.frames["svgframe"].svgCanvas;\n var svg_canvas = window.frames.svgframe.svgCanvas;\n
$.ajax({\n $.ajax({\n
type: "POST",\n type: "POST",\n
url: "Base_setSVGTextContent",\n url: "Base_setSVGTextContent",\n
data: "text=" + encodeURIComponent(svg_canvas.getSvgString()),\n data: "text=" + encodeURIComponent(svg_canvas.getSvgString()),\n
success: function(){\n success: function () {\n
window.location.reload();\n window.location.reload();\n
}\n }\n
});\n });\n
});\n });\n
$("iframe#svgframe").css("border", "0px");\n $("iframe#svgframe").css("border", "0px");\n
})</unicode> </value> });</unicode> </value>
</item> </item>
<item> <item>
<key> <string>content_type</string> </key> <key> <string>content_type</string> </key>
......
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