Pat LeSmithe wrote: > I'm still reading through the replies to my off-list message, which I've > included below. They're provoking much thought! Please let me know if > it's OK to post them here, too, or feel free to bring them into the light... > > -------- Original Message -------- > Subject: A variation on Rado's graph editor > Date: Thu, 02 Jul 2009 13:29:37 -0700 > From: Pat LeSmithe <qed777> > To: jason, rkirov, beezer > > > Hi Jason, Rado, and Rob! > > Feeling a bit inspired, I put together a preliminary experiment with > contentEditable divs and Rado's graph editor:
This is really great! Thanks for posting the code! Looking at this code last night helped me to have a better idea of what I'm thinking as well. I envision the sage code cells having javascript plugins. A plugin would be a javascript object or something that, given a piece of sage code, could return an html "widget" that represents that sage code in some nice, possibly interactive way, and could be queried for a string of Sage code that represents the current state of the widget. The sage code cell (a designmode iframe or contenteditable div) would then provide some way of activating the widget from a text selection (or from an empty string, if no text is selected). When a widget is activated, the following sort of thing is inserted into the code cell, either replacing the selected text or just at the current position if no text is selected: <div class="widgetcontainer"><div class="code">sage code that the widget represents</div><div class="widget">html code returned by the plugin</span></div> The code cell would provide a way to toggle the text and the widget spans visible or hidden (or deleting it completely). Both the text and the widget update each other on a change (i.e., if the user changes the text, the widget updates; if the user changes the widget, the text updates). Obviously there can be some shortcuts here if one or the other is not visible. When the code cell is evaluated, the text is extracted from each widgetcontainer. In addition, metadata is sent to the sage server marking where the widgets are (e.g., widget "GraphEditor" surrounds the text from character position 120 to 133). Here are some other plugins that could be implemented: 1. An image representation. When first invoked, it has a blank space. Click on the blank space and a small javascript window opens up that allows you to upload an image to the sage server. Then the widget contains a picture of the image. The underlying Sage code is the sage code that references the image file. 2. A list of points constructor -- if you want a series of 2d points, then get something like Rado's editor to just return the list of coordinates. 3. Like Rob Beezer has mentioned, an equation editor, matrix editor, etc. 4. A widget that helps you choose the sloane sequence (i.e., provides a search form, displays the sequence, etc.). The underlying Sage code is "sloane_sequence(<whatever sequence number you picked>)". Really, with a flexible, easy plugin framework, the sky is the limit! What do you think? I've started working on something like this from the code that was attached above (thanks!), but really, there are people that are way better at this (and may have more time) than me! Feel free to jump in! Thanks, Jason --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
