JohnMcLear / ep_print_preview_pdf

Etherpad, Preview PDF before printing..

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clicking out of the renderer doesn't close

cmbirk opened this issue · comments

This closes if I click inside of the etherpad window, but not somewhere in the parent window. There needs to be a way to close on parent window click, but I have no idea on how to pass that information.

Yea in general you can't lose focus from Etherpad by doing events outside of the iframe, that's pretty normal. We can/could pass events back and forth I guess if that's something you want? Probably a task for later on though when we decide what events you want to pass so we can define scope.

So it's pretty easy to pass things to the parent, but going the other way is hard iirc. We'll probably have to set a property on the parent and listen to that from the child, maybe with a settimeout or something to test if the value has changed.

There is a plugin for stuff like this, will find it when I get back onto stuff for you :)

Alternatively just target the element in the editor iframe

Something like this in the Madison viewer window should do it..
$('iframe').contents().find('iframe[name="ace_outer"]').contents().find('#outerdocbody').contents().find('#pdfpreview').hide();

note that you can replace the first instance of iframe with the target ID of the iframe IE #embeddedEtherpad

Note sure if you need the contents() but suck it and see :) It's a one time event anyway so relatively cheap to do.

Well that'll actually have to be set up on every click so it won't be that cheap. Although clicking isn't the most prevalent event here.

I guess if we could get the child iframe to tell the parent iframe when the viewer is open we could bind and unbind on the click event based on that

Closing as it's really outside of the scope of the plugin imho