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 531 forks source link

Can you elaborate about the use of the iframe? #341

Closed SvenDowideit closed 11 years ago

SvenDowideit commented 11 years ago

the readme says:

I was looking for a fully featured editor that didn't use iframes to edit the content, and there weren't any decent ones

and yet, when I go to use mercury, it relies on an iframe.

I'm curious to know what you mean by both things - and why its necessary (or what mercury would lose by removing the current iframe)

Curious :)

Sven

gvarela commented 11 years ago

That description refers to the traditional WYSWIG editors that didn't use contentEditable to make DOM elements be editable. They would swap out the element with an iframe and a textarea.

The reason Mercury loads the page into an iframe is to prevent bleeding of styles and javascripts between Mercury and the page it is trying to edit. Not only did jeremy, in his initial implementation, try to not use iframes but, others have come along and tried to make Mercury not use iframes. It's more work and more complexity than the value that may be provided by not loading the content in an iframe.

SvenDowideit commented 11 years ago

hey @gvarela thankyou for the info - do you think it'd be worth adding that to the wiki / readme to provide a perspective for those coming later who might contemplate removing the iframe?

I'm still wondering about it - specifically because in the offline webapp, reloading the html is making a mess of some things - so the more context someone like me has, the more likely we are to approach the problem differently