Commit fe105274 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

erp5_svg_editor: Improve Method Draw compatibility with officejs

parent 55c7df0d
...@@ -57,8 +57,8 @@ ...@@ -57,8 +57,8 @@
<!-- renderjs --> <!-- renderjs -->
<script src="rsvp.js"></script> <script src="../rsvp.js"></script>
<script src="renderjs.js"></script> <script src="../renderjs.js"></script>
<!-- custom script --> <!-- custom script -->
<script src="method-draw.gadget.js"></script> <script src="method-draw.gadget.js"></script>
<title>Method Draw</title> <title>Method Draw</title>
......
...@@ -8,13 +8,6 @@ ...@@ -8,13 +8,6 @@
rJS(window) rJS(window)
.ready(function (g) { .ready(function (g) {
g.props = {}; g.props = {};
[].forEach.call(window.document.head.querySelectorAll("base"), function (el) {
// XXX GadgetField adds <base> tag to fit to the parent page location, it's BAD to remove them.
// In the case of method-draw, all component are loaded dynamicaly through ajax requests in
// method-draw "folder". By setting a <base> tag, we change the url resolution behavior, and
// we break all dynamic links. So, deleting <base> is required.
window.document.head.removeChild(el);
});
var deferred = RSVP.defer(); var deferred = RSVP.defer();
svgCanvas.ready(function () { svgCanvas.ready(function () {
deferred.resolve(); deferred.resolve();
...@@ -22,6 +15,13 @@ ...@@ -22,6 +15,13 @@
return deferred.promise; return deferred.promise;
}) })
.declareMethod('render', function (options) { .declareMethod('render', function (options) {
[].forEach.call(window.document.head.querySelectorAll("base"), function (el) {
// XXX GadgetField adds <base> tag to fit to the parent page location, it's BAD to remove them.
// In the case of method-draw, all component are loaded dynamicaly through ajax requests in
// method-draw "folder". By setting a <base> tag, we change the url resolution behavior, and
// we break all dynamic links. So, deleting <base> is required.
window.document.head.removeChild(el);
});
this.props.key = options.key; this.props.key = options.key;
svgCanvas.setSvgString(options.value); svgCanvas.setSvgString(options.value);
}) })
......
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