mozilla / brackets

An open source code editor for the web, written in JavaScript, HTML and CSS.
http://brackets.io
MIT License
176 stars 278 forks source link

Create a proper iframe API for embedding Bramble into a site #243

Closed humphd closed 9 years ago

humphd commented 9 years ago

Thimble embeds Bramble in an iframe and then communicates with it using postMessage. This design is a common one, and it will always be necessary in order to isolate Bramble from an actual web app, since Bramble allows (and encourages!) arbitrary script execution.

We already have requests to use Bramble in other web apps, and it would be nice if we generalized how we're doing it such that any third-party could use the editor easily. I'd like to see us do something like the YouTube IFrame API, where you basically include a script, and specify an element to hold the editor, and then communicate with it using function calls, which get turned into postMessage calls in/out of the iframe. See https://developers.google.com/youtube/iframe_api_reference

We already know that there are some common things one might want to do with Bramble from the hosting app:

We should be careful not to let this get out of hand (it's fun designing APIs), and just start by making it possible to do what we need in Thimble via this API. As we understand the problem, we can add more.

humphd commented 9 years ago

cc @brianfeister

brianfeister commented 9 years ago

Thanks so much for notifying me! I'll be lurking. Still haven't rolled my sleeves up and attempted integrating this project in it's current state into our (Angular) web app. I'm sure there will be lots of lessons learned there.

humphd commented 9 years ago

This is happening in https://github.com/humphd/brackets/pull/349

sedge commented 9 years ago

@humphd You've done a great job on this. Are we ready to close?

humphd commented 9 years ago

Yeah, this is done.