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: false\n async: true,\n
}).responseText;\n success: function (text_content) {\n
text_content != "" ? svg_canvas.setSvgString(text_content) : null;\n var svg_canvas, frame = window.frames.svgframe;\n
}\n if (text_content !== "") {\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