Experience embedding multiple bespins into a page

1 view
Skip to first unread message

James Casbon

unread,
Aug 2, 2010, 4:23:33 AM8/2/10
to Bespin, codenod...@googlegroups.com
Hi Bespin,

I just wanted to let you know my experiences embedding multiple
bespins into a page in codenode. It works pretty well now using
0.91a, but there are a few things I should point out. (cross post to
codenode-devel, branch here: http://github.com/jamescasbon/codenode/tree/bespin
)

1. The onBespinLoad function needs looking at to get multiple bespins
to upgrade. Covered before here:
http://groups.google.com/group/bespin/browse_frm/thread/7cf6c3711da703da/4db5f7221c876799?#4db5f7221c876799

2. The startup options need linking to from here:
https://bespin.mozillalabs.com/docs/embedding/index.html at the point
"It's possible to change any settings (as in those defined by the
'set' command where the command line is available)", because I can't
find a list anywhere online.

3. I am managing the size of the bespins myself. This is a bit klunky
because on a new line event, bespin gets the event first and adds a
scrollbar before I can get the event externally and resize which then
removes the scrollbar. Is it possible to disable the scrollbar to
make this smoother? Another problem is that the line numbers don't
seem to resize correctly - they grow but they dont shrink. One final
problem with size management is that very small inputs have a lot of
space on the bottom: i.e. a one line input box needs about three lines
of space.

4. Is it possible to disable the line numbers (see also (2))?

5. I need more control over event handling. I have a context menu
activated on right click, but I cannot get that event since it seems
to be swallowed by bespin. It is not listed in the api for events
https://bespin.mozillalabs.com/docs/pluginguide/editorapi.html

Any advice on how to handle these would be appreciated.

thanks,
James

Bartosz Telenczuk

unread,
Aug 3, 2010, 2:18:19 PM8/3/10
to codenod...@googlegroups.com
Hi all,

Sorry, I haven't been active recently. I am finishing my thesis and I have less time for working on codenode than I wished.

I have experimented with alternative approach for syntax highlighting based on prettify. The basic idea is to replace the textareas with contenteditable divs which allow for html markup. The first working implementation is available in the contenteditable branch of my codenode fork:

g...@github.com:btel/codenode.git

This is only a proof of concept now and it has not been thoroughly tested. I took it as an example to understand the code base of codenode and learn javascript.

There are two disadvantages of the approach:

- the syntax is not highlighted until the cell is evaluated,
- it does not support automatic indentation.

I also tried Bespin, but I did not work for me either. Another code editor worth trying is codemirror:

http://codemirror.net/contrib/python/index.html

When I have some spare time I may try it as well.

Cheers,

Bartosz

> --
> http://groups.google.com/group/codenode-devel?hl=en
> http://codenode.org

James Casbon

unread,
Aug 6, 2010, 11:54:40 AM8/6/10
to codenode-devel


On Aug 3, 7:18 pm, Bartosz Telenczuk <bartosz.telenc...@gmail.com>
wrote:
> Hi all,
>
> Sorry, I haven't been active recently. I am finishing my thesis and I have less time for working on codenode than I wished.

Good luck with that!

> I have experimented with alternative approach for syntax highlighting based on prettify. The basic idea is to replace the textareas with contenteditable divs which allow for html markup. The first working implementation is available in the contenteditable branch of my codenode fork:
>
> g...@github.com:btel/codenode.git
>
> This is only a proof of concept now and it has not been thoroughly tested. I took it as an example to understand the code base of codenode and learn javascript.
>
> There are two disadvantages of the approach:
>
> - the syntax is not highlighted until the cell is evaluated,

This is the big drawback for me - highlighting definitely works best
while you type.

> - it does not support automatic indentation.
>
>  I also tried Bespin, but I did not work for me either. Another code editor worth trying is codemirror:
>
> http://codemirror.net/contrib/python/index.html

I looked at this, but the fact it uses an iframe put me off (IIRC).

Bartosz Telenczuk

unread,
Aug 6, 2010, 4:07:53 PM8/6/10
to codenod...@googlegroups.com
>>
>> - the syntax is not highlighted until the cell is evaluated,
>
> This is the big drawback for me - highlighting definitely works best
> while you type.

There is probably a solution to this using keydown event and jquery timer:

http://www.codingthewheel.com/archives/syntax-highlighting-stackoverflow-google-prettify

but I haven't tested it yet.

I ve also found a very nice editor based on contenteditable:

http://aloha-editor.com/index.html

It doesnt seem that it supports syntax highlighting yet, but if it did it would be extremely cool.


>
>> - it does not support automatic indentation.
>>
>> I also tried Bespin, but I did not work for me either. Another code editor worth trying is codemirror:
>>
>> http://codemirror.net/contrib/python/index.html
>
> I looked at this, but the fact it uses an iframe put me off (IIRC).

You're right, but what is wrong with iframe?

Reply all
Reply to author
Forward
0 new messages