I swear I tried! But to be honest, I knew from the beginning it was going to be very hard to just keep that idea in a corner of my head and postpone its realization to an uncertain later future. Let me say it right away,
Bespin, from the Mozilla Labs, is much more than just an awesome script editor in your browser! We could go as a far as saying that is it is
yesterday's future of an ideal IDE taking shape today on the cloud and with latest in-browser technologies ;)
The editor itself really is a huge thing. It feels so good to write with I knew I could not resist the terrible temptation to plug and
make it available to edit XWiki's JavaScript and StyleSheets eXtensions. So I did. Let's be clear, it is a
saturday afternoon Q&D hack, not a clean integration, but it does the job. I basically just removed or rewrote some bits in the Bespin.Server class to skip the communication with Bespin server and load and save XWiki's extensions instead, fired automatically a couple of events, et voila! Right now it supports only JavaScript eXtensions, but making it work with StyleSheet ones would be really easy. I only tested it on
a recent snapshot of XWiki, but it should work fine with all recent versions. Of course, we can only experience it in browsers that support the
canvas element.
Here's how it will look in your wiki :
When viewing an eXtension, a link to edit with Bespin Editor is provided
Two buttons when editing with Bespin Editor, one to save the current code, one to go back to the wiki
The XWiki extension is
available here. It contains unmodified code from Bespin attached to a XWiki Document. The modified bits (Bespin.Server and Bespin.FileSystem classes) are in a JavaScript extension, human-readable directly from the archive. This extension is licensed under the
Mozilla Public Licence, and all Bespin original code (that is, 99.99% of this extension) is the work of the
Mozilla Labs Bespin Team.
To use it, just add the following line in the wiki content of a XWiki document that contains a JavaScript eXtension :
#includeForm("XWiki.BespinEditorExtension")
Really, the future is in a <canvas>!