@vmassol sorry for late reply, thanks for your response.
can you help on my first try to implement a macro ?
{{velocity}}
#if($xcontext.action == 'edit')
  {{html}}
    <iframe src="http://172.31.25.15:8280/?embed=1&protocol=json" />
  {{/html}}
#else
  {{html}}
    <img src="data:image/png;base64," />
  {{/html}}
#end
{{/velocity}}
my first problem is when editing a page in WYSISWYG editor, the $xcontext.action is always equal to ‘view’, so I can’t embed a iframe to let user create diagram with external draw.io.
my second problem is I have no idea how to set content at client side using javascript, when the draw.io iframe finished I cant get back the diagram data as text, but how to update it back to server side as macro’s content ?
please help.