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

iframe has fixed 150 pixel height and 0px offset (Mercury 0.9) #419

Closed mbrookes closed 11 years ago

mbrookes commented 11 years ago

Sorry to post as an issue, when the problem is clearly my code not yours, but I've been battling this on and off for a few days now, and must be missing something obvious.

I'm trying to integrate Mercury 0.9 with a Rails 3.2 project, but the content iframe just refuses to be visible on the correct part of the page - it's behind the Mercury toolbar, and has a fixed height of 150 pixels.

When I look at the Mercury page, I see the following iFrame for the content:

<iframe id="mercury_iframe" name="mercury_iframe" class="mercury-iframe" 
frameborder="0" src="about:blank" style="left: 0px; visibility: visible; ">
</iframe>

When I look at the Mercury demo page [1] it looks like this:

<iframe id="mercury_iframe" class="mercury-iframe" 
frameborder="0" src="about:blank" style="top: 86px; left: 0px; 
height: 744px; visibility: visible; "></iframe>

I don't have the top and height styles - for some reason.

All the Mercury js and css appears to be loading, and the editable page has no styling or js of its own that could be interfering. I'm not getting any js errors.

I have tried both the mercury-rails gem and from Master on GitHub.

At my wits end. Any help appreciated! (And thank you for Mercury - it looks wonderful, if only I could get it to work! :+1:

jejacks0n commented 11 years ago

Sorry you're dealing with frustration. I can't really help without an error, so that makes it sort of hard. The code that does that would be in the page editor class, so that's a good place to start looking to understand it more.

https://github.com/jejacks0n/mercury/blob/master/app/assets/javascripts/mercury/page_editor.js.coffee#L161

I have seen similar issues with it not sizing correctly when using jQuery > 1.7.7 (I think). Mercury comes with the proper version of jQuery, and it shouldn't cause any issues to use that for mercury, and your own jQuery version in your own pages.

mbrookes commented 11 years ago

Thank you, thank you, thank you! You are a god amongst men.

I had *= require jquery in mercury.js which I'd added at some point during troubleshooting, which would load the default Rails jQuery (1.9.x); along with `*= require query-migrate-min' to fix another issue with jQuery 1.9 konqueror incompatibility with Mercury, which should have been a giveaway that 1.9 was a problem!

I removed these, changed <%= javascript_include_tag 'jquery', 'admin/mercury' %> in layouts/mercury.html.erb to <%= javascript_include_tag 'jquery-1.7', 'admin/mercury' %> and all was fixed.

My only question is, why didn't I ask sooner?! I actually gave up working on this project a few months ago when I couldn't get over this hurdle, but have been having another go this week. So glad to be able to finally move forward!

Thank you again!