jejacks0n / mercury

Mercury Editor: The Rails WYSIWYG editor that allows embedding full page editing capabilities directly inline.
http://jejacks0n.github.com/mercury
Other
2.63k stars 530 forks source link

Refreshing the iframe created #403

Closed kshitizshankar closed 11 years ago

kshitizshankar commented 11 years ago

Is there a way to refresh the iframe and re-initialize the editor without having to refresh the whole page and reloading the Mercury editor? I am trying to add a javascript console to add custom javascript and need to refresh the page in order to run it.. but I do not want to reload the whole editor

(I am using the standalone version, not the rails one)

gvarela commented 11 years ago

It depends on how you are setting up the content. If you are dynamically creating it with javascript you should be able to trigger a reinitialize event.

Mercury.trigger('reinitialize');

if you want to dynamically change the iframe source without reloading the editor you can call loadIframeSrc https://github.com/jejacks0n/mercury/blob/master/app/assets/javascripts/mercury/page_editor.js.coffee#L189

kshitizshankar commented 11 years ago

ahh .. dont know how I missed 'loadIframeSrc' .. wasted a lot of time on this!! Thanks a LOT :)