Problems editing content in an iframe #734

karger opened this Issue Sep 29, 2012 · 7 comments


None yet
5 participants

karger commented Sep 29, 2012

I'm writing an application that uses Aloha (loaded in the parent window) to edit content in an iframe. Yes, you could ask why I need an iframe when aloha is all about in-place editing, but there are good reasons. My efforts are revealing that Aloha has baked in, I think unnecessarily, an assumption that the editable content and the aloha scripts are in the same window. For example, when I call $().mahalo() it invokes Aloha.getEditableById(jQuery(this).attr('id')).destroy(); Then, getEditableById(id) invokes jQuery('#'+id).get(0) . Since the node with the given id was inside the iframe, jQuery('#'+id) has no match (in the parent window), so get(0) returns null which crashes mahalo. This was unnecessary, as the nodes you used getEditableById to find were already in hand during the mahalo() invocation.

This is not only a problem with an iframe but also if I edit content in a second window.

A solution here would be a method getEditable(node) which, instead of being passed an id, is passed a jquery node whose editable you want to find. Since you already have the node in hand, you don't need to use jquery to find the node.

Any "absolute" jquery selector, which is implicitly scoped to the current document, offers the same potential problem. Selectors scoped relative to some preexisting jquery do not.

karger commented Sep 29, 2012

As another example, typing backspace in the in-iframe editable throws an exception as Aloha tries to compare the position of nodes outside the iframe.


deliminator commented Sep 30, 2012

I think it will take some work to make Aloha window-independent. Pull requests are welcome.

As a work around, you could simply load Aloha inside the iframe.

@evo42 evo42 closed this Oct 17, 2013

karger commented Oct 18, 2013

Is this closed and fixed or closed and wontfix?


deliminator commented Oct 18, 2013

Don't know why it's closed, but if it isn't yet fixed, it will be fixed in the howling-mad branch.

meded90 commented Oct 20, 2014

I have the exact same problem

karger how you solved this problem?

karger commented Oct 20, 2014

I never solved it; been waiting for a fix.

eob commented Jun 16, 2015

Well I just searched for the same problem and lo and behold I find you as the top search result David -- Small world :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment