William Stein wrote: >> Also, I've been thinking about how to add Rado's graph editor, an equation >> editor, and other nice input methods to the code cells. Basically, I'm >> looking at how to replace a small section of Sage code with a "widget" that >> represents the code nicely, all inside of the code cell. Requirements that >> make sense to me include: >> >> 1. When the cell is recreated (on page creation, for example), the user >> should see the widget, not the generated Sage code >> 2. The user should be able to highlight some Sage code and convert it to the >> widget (replacing the highlighted part with the graphical div). If the sage >> code is not understood by the widget, then some sort of error should be >> signaled (maybe an alert box?) and the code should remain in the cell. >> 3. The user should be able to toggle between seeing the Sage code text and >> the widget representation, on a widget-by-widget basis. >> >> Point (1) requires that the cell understand that some sort of widget >> represents the code between character positions x and y. What's the easiest >> way to store/send that sort of metadata along with the cell? >> >> We probably don't want to use tinymce---it's way too heavyweight for this >> and has *lots* of unneeded functionality. >> >> This will probably necessitate subtle changes in the existing javascript for >> code cells, as we can't use textareas anymore, but instead will use some >> sort of contentEditable divs for code cells. This also exposes us to lots >> of cross-browser support issues, I believe. It seems that a major issue for >> the html wysiwyg editors is how well they support different browsers. >> >> What do you think? > > Ouch. Oh the pain. I would have to see a demo. I have never tried > any sort of contentEditable div before. I'm amazed how far we've gone > using textareas, to be honest.
Actually, that's how TinyMCE is implemented, so you've been using lots of these contentEditable divs lately (well, probably actually an ancestor to contentEditable divs). Since textareas can't contain anything but text currently, we can't implement any sort of wysiwyg mathematics with just a textarea. What I'm talking about is a lightweight tinymce-like control that would be able to sections of represent Sage code with a graphical widget, like replacing Graph({0:[2,3], 1:[3],2:[3,4]}) with Rado's graph editor, or a symbolic expression with Davide's equation editor. So in a cell, you would see something like: ----------------------------------------------------------------------- | ____________________________________________________ | | | XX| | | | Rado's graph editor | | | G= | | | | | | | | ---------------------------------------------------- | | | ---------------------------------------------------------------------- Clicking on the small XX in the upper right corner would replace the graph editor with the corresponding code. On the other hand, you could highlight "Graph({0:[2,3], 1:[3],2:[3,4]})" in a cell and click a "Graph Editor" button that would then replace the text with Rado's editor, as sketched above. Does anyone here have experience with contentEditable divs? I don't, but I'm learning slowly as I have time. Does anyone have good experience with a very lightweight online edit control that lets us easily replace random text with a div (containing the representing widget)? I've looked at lots of different possibilities, but I don't have experience with any other than TinyMCE. I haven't found anything that strikes me as easy to modify for what we need and as lightweight as we need. Jason --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---