ok, give it a try !
You can edit a page of the play framework manual using this textile editor.
You need a pretty recent browser with a fast Javascript engine and full canvas support, including text drawing features.
So try with Safari 4, Firefox 3.5 or Chrome 2.
Performances are pretty good (almost on my Macbook Pro), it can edit without pain a file of thousands lines.
Modern javascript engines rocks. Canvas implementations rocks. To be honest, I was more concerned
about performances issues last time I wrote an eclipse editor plugin using Java and SWT so called native bindings.
how to embed it ?
First download the textile-editor.min.js component (or get the uncompressed code if you need to hack it).
Then you need JQuery (in fact you can avoid it will a little hack, see bellow).
To integrate an editor in any web page,
just create a canvas element, and instantiate an editor on it at load time. Something like :
<canvas id="editor" width="500" height="300">Textile content here ...</canvas>
...
<script type="text/javascript">
var init = function() {
new Textile.Editor('editor');
}
</script>
If you really can't add JQuery to your page, you can avoid it, but you have to monkey patch the editor
to provide an alternative implementation of the Textile.Editor.getPosition function that return the canvas
position (but I'm sure that your preferred javascript framework will help you to do that). Example:
Textile.Editor.prototype.getPosition = function() {
var canvas = this.el;
// compute canvas position
var x = 0, y = 0;
...
// return the result
return {
top: y,
left: x
}
}
This code is licenced under the Apache 2 licence, and copyrighted zenexity.