GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
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.
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.
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.
Is this closed and fixed or closed and wontfix?
Don't know why it's closed, but if it isn't yet fixed, it will be fixed in the howling-mad branch.
I have the exact same problem
karger how you solved this problem?
I never solved it; been waiting for a fix.
Well I just searched for the same problem and lo and behold I find you as the top search result David -- Small world :)