TinyMCE in sage-3.3: How to insert a new text cell?

16 views
Skip to first unread message

Bill Page

unread,
Feb 16, 2009, 11:54:07 AM2/16/09
to sage-devel
I really like TinyMCE but I have a "new user" question:
Double-clicking on some existing text in a worksheet works fine, but
how do I insert a new text cell? Of course I can go to the old raw
text Edit mode, but that seems SO clumsy now that there is TinyMCE.

William Stein

unread,
Feb 16, 2009, 11:59:40 AM2/16/09
to sage-...@googlegroups.com

Shift-click when creating a new cell.

One can "discover" this by reading the page that pops up when you
click "Help" in the upper right.

William

William Stein

unread,
Feb 16, 2009, 12:07:48 PM2/16/09
to sage-...@googlegroups.com

By the way, one annoying thing about tinymce is that there is no
"shift-click" on the iphone. And there is no double click. So it is
impossible to bring up the tinymce editor on the iphone.

This reminds me of the situation that lead to the little "evaluate"
link, which people actually rather like. Maybe something similar
should be added for tinymce.

William

Jason Grout

unread,
Feb 16, 2009, 12:17:27 PM2/16/09
to sage-...@googlegroups.com


At one point, I thought we could divide the current insert line into two
halves (maybe colored differently). One half would be for code input,
the other half for text cells.

What do you think?

Jason

Bill Page

unread,
Feb 16, 2009, 12:21:39 PM2/16/09
to sage-...@googlegroups.com
I am sorry William, I must be especially dense today. After searching
for "shift click" at

http://sagenb.org/help

I found it!

HTML Shift click between cells to create a new HTML cell. Double click
on existing HTML to edit it. Use $...$ and $$...$$ to include typeset
math in the HTML block.

-----

I think a "new user" might wonder what editing text has to do with
"HTML". But I guess this is the kind of question that you only need to
ask once.

Shouldn't there be a more visible way - similar to what you do to
create other new cells?


On Mon, Feb 16, 2009 at 11:59 AM, William Stein wrote:

William Stein

unread,
Feb 16, 2009, 12:22:47 PM2/16/09
to sage-...@googlegroups.com
On Mon, Feb 16, 2009 at 9:21 AM, Bill Page <bill...@newsynthesis.org> wrote:
>
> I am sorry William, I must be especially dense today. After searching
> for "shift click" at
>
> http://sagenb.org/help
>
> I found it!
>
> HTML Shift click between cells to create a new HTML cell. Double click
> on existing HTML to edit it. Use $...$ and $$...$$ to include typeset
> math in the HTML block.
>
> -----
>
> I think a "new user" might wonder what editing text has to do with
> "HTML". But I guess this is the kind of question that you only need to
> ask once.
>
> Shouldn't there be a more visible way - similar to what you do to
> create other new cells?
>

Any suggestions?

William

Luiz Felipe Martins

unread,
Feb 16, 2009, 12:40:57 PM2/16/09
to sage-...@googlegroups.com
One little thing that might be even simpler to implement.

It is not possible to click above a TinyMCE cell to add a new cell. Of
course, it is still possible to Ctrl-;, but sometimes I feel it would
be faster to just Shift-Click, since I have my hand on the mouse
anyway.
--
"The main things which seem to me important on their own account, and
not merely as means to other things, are knowledge, art, instinctive
happiness, and relations of friendship or affection."
-Bertrand Russell

L. Felipe Martins
Department of Mathematics
Cleveland State University
luizfelip...@gmail.com

Jason Grout

unread,
Feb 16, 2009, 12:46:45 PM2/16/09
to sage-...@googlegroups.com
Luiz Felipe Martins wrote:
> One little thing that might be even simpler to implement.
>
> It is not possible to click above a TinyMCE cell to add a new cell. Of
> course, it is still possible to Ctrl-;, but sometimes I feel it would
> be faster to just Shift-Click, since I have my hand on the mouse
> anyway.


I agree that this should be simple to implement. Can you file a trac
ticket for this feature and CC me on it (jason)?

Thanks,

Jason

Bill Page

unread,
Feb 16, 2009, 2:01:34 PM2/16/09
to sage-...@googlegroups.com
On Mon, Feb 16, 2009 at 12:22 PM, William Stein wrote:

>
> On Mon, Feb 16, 2009 at 9:21 AM, Bill Page wrote:
>>
>> Shouldn't there be a more visible way - similar to what you do to
>> create other new cells?
>>
>
> Any suggestions?
>

What I was looking for was some king of highlighting as I hover the
mouse over the cell. Right now I see a blue bar where a new
computation would be inserted if I click the mouse. It appears right
at the start of each cell just *before* the input box and another
final one at the bottom of the page.

What might seem natural to *me* would be another color of bar, say a
red, just like the blue one but at the bottom of each input cell just
*after* the input cell and for good measure an extra initial one at
the top of the page. Of course these should only appear when moving
the mouse in the right location. The click a red bar would lead to
inserting an "HTML" block via TinyMCE. All it would take is just one
experiment by a user to know which input bar does what.

Well, that's my two-cents worth but I realize there may be several
other ways to accomplish something similar.

Regards,
Bill Page.

Rob Beezer

unread,
Feb 17, 2009, 11:27:17 PM2/17/09
to sage-devel
On Mon, Feb 16, 2009 at 12:22 PM, William Stein wrote:

> Any suggestions?

I'm thinking about the new user, who (a) doesn't know at all that you
can add text (b) can't figure out why there are two colors for the
bars or (c) tries to type code into TinyMCE and can't get it to
evaluate.

What about having a small text link, similar to "evaluate" that says
"annotate", "add text", "doodle" or something similar? Placed
somewhere suggestive like the "evaluate" link is. Not sure where that
would be relative to the input cells, output cells and the blue bar.
Maybe it could be shoved off to the right margin, keeping "evaluate"
shoved off to the left margin (simple with CSS?).

Maybe long-term the notebook could have an expert mode. Colored bars
for the pros (which would be nice once you know what's going on) and a
novice mode with more help or more obvious controls, but maybe a tad
more cumbersome. You could go in/out of expert mode with a link at
the top, and/or set your choice permanently with some configuration
option.

I really like the idea of the students having an editor that they can
use to write on a worksheet, and especially the possibility that they
can start learning simple LaTeX without the usual overhead of a big
install, the \begin{document} structure, the command line, etc. So
anything that makes TinyMCE's presence more obvious to the uninitiated
would be another great addition.

Rob

William Stein

unread,
Feb 17, 2009, 11:34:16 PM2/17/09
to sage-...@googlegroups.com
On Tue, Feb 17, 2009 at 8:27 PM, Rob Beezer <goo...@beezer.cotse.net> wrote:
>
> On Mon, Feb 16, 2009 at 12:22 PM, William Stein wrote:
>
>> Any suggestions?
>
> I'm thinking about the new user, who (a) doesn't know at all that you
> can add text (b) can't figure out why there are two colors for the
> bars or (c) tries to type code into TinyMCE and can't get it to
> evaluate.
>
> What about having a small text link, similar to "evaluate" that says
> "annotate", "add text", "doodle" or something similar? Placed
> somewhere suggestive like the "evaluate" link is. Not sure where that
> would be relative to the input cells, output cells and the blue bar.
> Maybe it could be shoved off to the right margin, keeping "evaluate"
> shoved off to the left margin (simple with CSS?).

+1

I think that's a great idea.
--
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

Jason Grout

unread,
Feb 17, 2009, 11:36:31 PM2/17/09
to sage-...@googlegroups.com


How about, in the spirit of the "evaluate" link being real text that
someone can read and immediately guess the function, we have the
new-cell bar, when someone mouses over it, show something like:

___________________________________________________________________
| new code cell | new text cell |
|_____________________________|___________________________________|

Of course, the text would be small (small enough that the new cell bar
wouldn't be much bigger than it is now).

Jason

Rob Beezer

unread,
Feb 18, 2009, 12:39:34 AM2/18/09
to sage-devel
Sure! The best of both worlds? This would put placement of the "new"
function in the same place it always has been, for both code and
text. And it would give the new user some idea of just what the
blue bar is for anyway.

Rather than "code," would "commands" make more sense to the new user
without sounding too pedantic or simplified to the pros?

Rob

Bill Page

unread,
Feb 18, 2009, 8:31:57 AM2/18/09
to sage-...@googlegroups.com
On Wed, Feb 18, 2009 at 12:39 AM, Rob Beezer wrote:
>
> Sure! The best of both worlds?

I do not consider this the "best" but rather a "lowest common
denominator" kind of thing. I quite dislike the evaluate links
scattered down the page, although I have seen many times that this is
what almost every "new user" looks for first rather than discovering
that shift-enter does the same thing.

> This would put placement of the "new" function in the same place
> it always has been, for both code and text. And it would give the
> new user some idea of just what the blue bar is for anyway.
>

What if the bar included "evaluate" as well?
___________________________________________________________________
|______ evaluate ____|_____ new command _____|____ new text _____|

And an option to "auto hide" the bar. The bar would be visible by
default on new worksheets. If you clicked auto hide, then it would
only be visible when hovering over it with the mouse.

> Rather than "code," would "commands" make more sense to the new
> user without sounding too pedantic or simplified to the pros?
>

I don't think this has anything to do with sounding/looking "too
simplified". Simple is better and beautiful. This is about visual
design - creating something that both looks nice *and* works well - an
art that engineers (and apparently also mathematicians :-) often lack.

Regards,
Bill Page

mhampton

unread,
Feb 18, 2009, 11:32:09 AM2/18/09
to sage-devel
Its true, new users love the evaluate button. It would be nice to
have an expert mode, or perhaps "elegant" mode, that turned that off.
But for beginners, I like the idea of an "annotate" button on the
right, opposite the evaluate button.

-Marshall

kcrisman

unread,
Feb 18, 2009, 12:00:17 PM2/18/09
to sage-devel
Not sure what I think about the various annotate ideas, though
probably something like this should be available. It is actually
quite important what you call it, because none of the names (new text,
annotate, etc.) seems to quite characterize it. I don't have any
better ideas, unfortunately.

I have a variant on the initial question, though; new math cells. The
splitting mechanism Ctrl-; I was not aware of, and it doesn't always
keep the previous content in the top cell of the two new ones, at
least not in my limited testing. Perhaps there should be a specific
way mentioned on the help page to get a new cell *immediately* below
an existing cell (as opposed to immediately *before* an existing cell,
assuming there is text between two cells) in the "Insert New Cell"
place?

Also (this is now just wild speculation) would it ever be possible to
make a new math cell *in the middle of a text cell*? That would be
really awesome, let me tell you. Though perhaps impossible?

Similarly, current TinyMCE behavior does not seem to join two existing
adjacent text cells together - which is not a bug, but just a little
weird at times. Say for instance you had a math cell between two text
areas and you delete the math cell; should the text areas join or not
- or could they even? I feel like Jason addressed this a few months
ago, but I can't remember any more.

- kcrisman

Jason Grout

unread,
Feb 18, 2009, 12:03:48 PM2/18/09
to sage-...@googlegroups.com
Bill Page wrote:
> On Wed, Feb 18, 2009 at 12:39 AM, Rob Beezer wrote:
>> Sure! The best of both worlds?
>
> I do not consider this the "best" but rather a "lowest common
> denominator" kind of thing. I quite dislike the evaluate links
> scattered down the page, although I have seen many times that this is
> what almost every "new user" looks for first rather than discovering
> that shift-enter does the same thing.
>
>> This would put placement of the "new" function in the same place
>> it always has been, for both code and text. And it would give the
>> new user some idea of just what the blue bar is for anyway.
>>
>
> What if the bar included "evaluate" as well?
> ___________________________________________________________________
> |______ evaluate ____|_____ new command _____|____ new text _____|

A problem with this proposal is that the evaluate button and the new
command/text buttons put things in different places. If you have a cell
that has output, then the evaluate button is between the cell and its
output, and it changes the output. However, you probably don't want a
new cell (command or text) to come between the cell and its output. For
this reason, I don't like lumping these three things together in the
same horizontal space.


Jason

Bill Page

unread,
Feb 18, 2009, 12:39:56 PM2/18/09
to sage-...@googlegroups.com
On Wed, Feb 18, 2009 at 12:03 PM, Jason Grout wrote:

>
> Bill Page wrote:
>>
>> What if the bar included "evaluate" as well?
>> ___________________________________________________________________
>> |______ evaluate ____|_____ new command _____|____ new text _____|
>
>
>
> A problem with this proposal is that the evaluate button and the
> new command/text buttons put things in different places. If you
> have a cell that has output, then the evaluate button is between the
> cell and its output, and it changes the output. However, you probably
> don't want a new cell (command or text) to come between the cell
> and its output. For this reason, I don't like lumping these three things
> together in the same horizontal space.
>

For some reason I do not associate the "where" with the location of
the button. To me it seems more like a menu item e.g. "edit/insert"
which in many applications occurs at the top of the page but affects
something inside. There is some "cursor" or concept of "current cell"
which determines where this happens.

Regards,
Bill Page.

Jason Grout

unread,
Feb 18, 2009, 4:21:45 PM2/18/09
to sage-...@googlegroups.com
kcrisman wrote:

>
> Also (this is now just wild speculation) would it ever be possible to
> make a new math cell *in the middle of a text cell*? That would be
> really awesome, let me tell you. Though perhaps impossible?


Can you give us a more specific use-case? You mean, you want to "split"
a text cell and in the split, make a new math cell?

>
> Similarly, current TinyMCE behavior does not seem to join two existing
> adjacent text cells together - which is not a bug, but just a little
> weird at times. Say for instance you had a math cell between two text
> areas and you delete the math cell; should the text areas join or not
> - or could they even? I feel like Jason addressed this a few months
> ago, but I can't remember any more.

Any adjacent text cells should merge after you close the page and
reopen, or after you click "edit" and then save your changes. So yes,
they will merge, but not immediately.

Jason

Bill Page

unread,
Feb 18, 2009, 4:54:14 PM2/18/09
to sage-...@googlegroups.com
On Wed, Feb 18, 2009 at 4:21 PM, Jason Grout wrote:
>
> kcrisman wrote:
>
>>
>> Also (this is now just wild speculation) would it ever be possible to
>> make a new math cell *in the middle of a text cell*? That would be
>> really awesome, let me tell you. Though perhaps impossible?
>
> Can you give us a more specific use-case? You mean, you want to
> "split" a text cell and in the split, make a new math cell?
>

+1

If yes, then I agree that this would be very cool.

Of course there may be many different ways/modes in which one can use
the notebook, but here is a possible use-case:

One might start with simply describing the computation that one
intends to do. For that purpose one would just enter a text cell
immediately and start writing. Then some time later you might go back
and begin the actual calculations. Say, at some point in the narrative
you decide you need to define a variable. So you just click
"insert/Sage" and the text box splits, saves and closes both parts
leaving you in a code box between these two sections to enter the
commands. I expect it would be quite normal to iterate in this manner
by double-clicking on the remaining text section that follows the
command to continue revising the text and then at some point split it
again for another computation. That way, the text editing mode becomes
the primary mode for the user, escaping only to perform computations
and/or to save the resulting worksheet.

Regards,
Bill Page.

William Stein

unread,
Feb 18, 2009, 8:07:16 PM2/18/09
to sage-...@googlegroups.com

That is a good idea.

This could be implemented by having a button in the palette on the top to insert
a new "math" cell. The cell itself could just be some special HTML
(maybe with a comment) that gets post-processed by Sage and turned
into an input cell. See the attached "Picture 1" -- that what it
might look like right after one clicks the "insert a new math cell"
button. Then "Picture 2" is what it looks like after one clicks the
save button.

William

Picture 1.png
Picture 2.png

Jason Grout

unread,
Feb 18, 2009, 9:37:56 PM2/18/09
to sage-...@googlegroups.com
William Stein wrote:
>
> That is a good idea.
>
> This could be implemented by having a button in the palette on the top to insert
> a new "math" cell. The cell itself could just be some special HTML
> (maybe with a comment) that gets post-processed by Sage and turned
> into an input cell. See the attached "Picture 1" -- that what it
> might look like right after one clicks the "insert a new math cell"
> button. Then "Picture 2" is what it looks like after one clicks the
> save button.


My guess is that it would be much easier to implement the earlier
proposal: a ctrl-; or something would split the text cell at the cursor
position and create a new code cell in the middle.

This way, we don't have to duplicate all of the functionality
improvements that are going into code cells, like tab completion, etc.


How about this:

If you are in a text cell:
* ctrl-; splits the text cell, puts in a new math cell, and focuses on
the math cell.

If you are in a math cell:
* ctrl-; splits the math cell, focusing on the second math cell
* ctrl-shift-; splits the math cell, inserts a new text cell between
them, and focuses on the text cell.

I actually find that last case one that comes up often for me. I'm
writing code for my class as a sequence of steps, then I want to explain
it. So I would just go to a place in the code I'd like to put in a
note, press ctrl-shift-;, and type my note.


Jason

Bill Page

unread,
Feb 18, 2009, 10:01:17 PM2/18/09
to sage-...@googlegroups.com
>
> William Stein wrote:
>> This could be implemented by having a button in the palette on the
>> top to insert a new "math" cell. The cell itself could just be some
>> special HTML (maybe with a comment) that gets post-processed
>> by Sage and turned into an input cell. See the attached "Picture 1"
>> -- that what it might look like right after one clicks the "insert a new
>> math cell" button. Then "Picture 2" is what it looks like after one
>> clicks the save button.
>
On Wed, Feb 18, 2009 at 9:37 PM, Jason Grout wrote:
> My guess is that it would be much easier to implement the earlier
> proposal: a ctrl-; or something would split the text cell at the cursor
> position and create a new code cell in the middle.
>
> This way, we don't have to duplicate all of the functionality
> improvements that are going into code cells, like tab completion,
> etc.
>

In the example given by William the "new math cell" in text mode is
not "live", i.e. it does not contain any actual commands (yet). The
"special HTML" to which William referred is only an empty marker.
After clicking Save from TinyMCE, the cursor is positioned at the
newly created math cell and only then does the user begin to enter
Sage commands. So tab completion, etc. in TinyMCE never arises.

Of course it is tempting to allow commands to be entered instead the
special HTML construct while still in TinyMCE and I think it might
also be tempting (even necessary and desireable?) to allow more than
one such special HTML construct to be inserted before clicking Save.

I suppose that this design proposed by William is at least in part
motivated by some ideas about what might be simple to implement as an
extension of the current code base. But I have to admit that I find it
just a little more "obtuse" for the user. It raises the obvious
question about why actually command input might not be allowed inside
TinyMCE.

>
> How about this:
>
> If you are in a text cell:
> * ctrl-; splits the text cell, puts in a new math cell, and focuses on
> the math cell.
>
> If you are in a math cell:
> * ctrl-; splits the math cell, focusing on the second math cell
> * ctrl-shift-; splits the math cell, inserts a new text cell between
> them, and focuses on the text cell.
>
> I actually find that last case one that comes up often for me. I'm
> writing code for my class as a sequence of steps, then I want to
> explain it. So I would just go to a place in the code I'd like to put
> in a note, press ctrl-shift-;, and type my note.
>

Except for the mysterious ctrl-shift- key combinations, I still like
this idea better. Besides these "hidden" key short-cuts, I presume
that these same functions would be available from a mouse click?

I also like you idea of splitting math cells in an analogous manner!

Regards,
Bill Page.

kcrisman

unread,
Feb 18, 2009, 11:29:20 PM2/18/09
to sage-devel
> > Similarly, current TinyMCE behavior does not seem to join two existing
> > adjacent text cells together - which is not a bug, but just a little
> > weird at times.  Say for instance you had a math cell between two text
> > areas and you delete the math cell; should the text areas join or not
> > - or could they even?  I feel like Jason addressed this a few months
> > ago, but I can't remember any more.
>
> Any adjacent text cells should merge after you close the page and
> reopen, or after you click "edit" and then save your changes.  So yes,
> they will merge, but not immediately.

Okay, I'll try that in the future.

- kcrisman

kcrisman

unread,
Feb 18, 2009, 11:33:27 PM2/18/09
to sage-devel

> > How about this:
>
> > If you are in a text cell:
> >  * ctrl-; splits the text cell, puts in a new math cell, and focuses on
> > the math cell.
>
> > If you are in a math cell:
> >  * ctrl-; splits the math cell, focusing on the second math cell
> >  * ctrl-shift-; splits the math cell, inserts a new text cell between
> > them, and focuses on the text cell.
>
> > I actually find that last case one that comes up often for me.  I'm
> > writing code for my class as a sequence of steps, then I want to
> > explain it.  So I would just go to a place in the code I'd like to put
> > in a note, press ctrl-shift-;, and type my note.
>
> Except for the mysterious ctrl-shift- key combinations, I still like
> this idea better. Besides these "hidden" key short-cuts, I presume
> that these same functions would be available from a mouse click?
>
> I also like you idea of splitting math cells in an analogous manner!

Yes, all of this is what I was referring to. I'm very pleased the
idea is popular!

I have already corrected silly typos on the fly in class (e.g. n_i
instead of n, missing parentheses) and the class has been rather
surprisingly impressed; however, not being able to easily insert math
wherever I want has been a bit of a downer, because sometimes I think
of some relevant command but it doesn't fit in as well where the cells
actually are.

By the way, any non-keyboard commands would be great; there should be
ample documentation in the notebook help page; and any visual clues
like earlier part of this thread for at least some of these things
would be great too, e.g. the TinyMCE thing in William's mockup.

- kcrisman

Rob Beezer

unread,
Feb 18, 2009, 11:35:23 PM2/18/09
to sage-devel
Bill must have looked at my hand-crafted web pages, since he knows I
have little design sense. I'm sticking to mathematics, don't
worry. ;-)

Strikes me there are two related ideas being discussed here.

1. How does a new user know/learn how to create a new cell (of either
type)?

Right now, a neophyte gets a blank worksheet, but there is a box to
type in. With a click in the box, the "evaluate" link appears. After
an evaluation, they get a new box. Eventually, mousing around between
cells gets you a blue bar flashing in/out as you move over it. You
are sort of led by the hand to the next step.

I knew TinyMCE was coming, but didn't "discover" how to invoke it
until I read the first few messages in this thread! Whatever is
decided, I'd like to see a new user be able to discern this important
functionality very soon after learning how to run commands.

So I'd like to see anything that makes the text-editing tools very
apparent on first-use, perhaps via a rookie/expert mode toggle.

2. How to create new cells?

With the ability to create new cells of two types, how do you make one
in the middle of the other (without going into the text-edit mode of
old)? What if one keystroke/command would split a cell at/near the
cursor and close up the two new cells, leaving you free to make a new
one inbetween. Notice this doesn't say which type you are in, or
which type you want to create.


Use-case: Its no secret I'd like to get my whole linear algebra
textbook converted to a series of (linked) worksheets with live Sage
cells, ready to run/edit/experiment. With TinyMCE comes the natural
possibility of easily scribbling in one's book - even using LaTeX.
Students could annotate in class, while doing homework, and they can
keep it all after the course is over.

Rob
Reply all
Reply to author
Forward
0 new messages