sage and TinyMCE

16 views
Skip to first unread message

Jason Grout

unread,
Jan 7, 2009, 6:59:43 PM1/7/09
to sage-...@googlegroups.com
Hi everyone,

There was another request on sage-edu for a nice way to edit text cells
in the notebook. Patches which enable a very nice in-place wysiwyg
editor for text cells are sitting on trac waiting to be reviewed. Some
people have reviewed them and found them to work well. I'm not sure how
much review is needed before they pass the test and are merged (the
patches touch a lot of notebook and javascript code). If anyone can
test them, I'm pleading for more reviews (at least, I think that's the
stage they are stuck at now). I believe the main concerns are making
sure that the patches work on a variety of platforms/browsers. Another
concern that has been expressed is a review of the javascript code (for
example, the notebook AJAX communication code was replaced with jquery
function calls).

Instructions for applying the patches are below and at the bottom of the
ticket at http://trac.sagemath.org/sage_trac/ticket/4705. Note that
some of these tickets have cleaned-up spkgs from mabshoff (listed at the
bottom of the relevant ticket) that should be tested instead of the
spkgs listed in the email below.

Thanks,

Jason


Forwarded message from sage-edu:

Luiz Felipe Martins wrote:
> > Here is a basic question: how to enter the HTML text between cells? Is
> > there a handy way to do it? The only thing I could figure out is to
> > jump back and forth from "Worksheet" to "Edit".
> >
> > (I also saw the LaTeX-Sage converter, but still have to experiment
with it.)
> >

There is a patch under review that enables you to shift-click on the
new-cell bar and it will create an in-place wysiwyg editor (TinyMCE, see
http://tinymce.moxiecode.com/examples/full.php). You can edit the html
text in-place and it feels just like a normal word processor (i.e., you
don't see the html code). After saving changes, you are then able to
edit the text in-place by double-clicking on the text.

If you would like to apply the patch and help review it, the
instructions are at the bottom of
http://trac.sagemath.org/sage_trac/ticket/4705. For your convenience,
I've copied them below.

I think the main holdup of the patches is someone reviewing them. We
need to make sure that these changes work on a wide variety of platforms
well.

Thanks,

Jason


Apply the following patches from 4674, 3767, 4704, and 4705, in order:

jsmath-spkg.patch
jquery-and-friends-spkg.2.patch
jquery-javascript-cleanup.patch
tinymce-editable.patch
safari-fix.patch

Install the following packages from the above tickets. You may have to
do ./sage -f <spkg URL> to force an installation if you've already
installed an spkg.

http://sage.math.washington.edu/home/jason/notebook/jquery-1.2.6.spkg
http://sage.math.washington.edu/home/jason/notebook/jqueryui-1.6r807svn.spkg

http://sage.math.washington.edu/home/jason/notebook/jsmath-3.6a.spkg
http://sage.math.washington.edu/home/jason/notebook/tinyMCE-3.2.0.2.spkg

Optionally, you can also install the jsmath image fonts by installing:
http://sage.math.washington.edu/home/jason/notebook/jsmath-image-fonts-1.3p0.spkg

Now rebuild sage by starting sage with "sage -br"

Now you should be able to shift-click on a new cell bar to create a text
cell using tinyMCE. You should also be able to double-click on an
existing text cell to edit it in-place.

David Joyner

unread,
Jan 7, 2009, 10:05:50 PM1/7/09
to sage-...@googlegroups.com
On Wed, Jan 7, 2009 at 6:59 PM, Jason Grout <jason...@creativetrax.com> wrote:
>
> Hi everyone,
>
> There was another request on sage-edu for a nice way to edit text cells
> in the notebook. Patches which enable a very nice in-place wysiwyg


Just to emphasize the importance (and not meaning to hijack the
thread): There was also a request by Mike May at the booth for this too.
Mike May, if you don't know, is a huge resource for people who teach
using Maple, as he has tons of great Maple worksheets on his website.

I hope and think I convinced him that Sage is the way to go and he
plans to test out Sage this semester before giving it to his students.
(He seemed inclined anyway, so I just strongly encouraged his own idea.)
However, he explained clearly how he teaches and that he needs the
students to be able to *easily* edit the text he types into the worksheets.
I've forgotten why - maybe he used the cell for computation and asks
the students to
enter their answer as text in a grammatically correct sentence.

If Mike May does in fact switch over to Sage, this will be a huge benefit, IMHO,
since he is well-known in the Maple community, so this will be a sign
of confidence in Sage as a teaching platform by a widely respected teacher,
and also will be a great resource for really high quality teaching materials
down the road. He also agreed that the CC attribution license is
acceptable to him for his "maple->Sage translated" worksheets, if
he agrees to switch to Sage. (I spent some time trying to talk him out of the
non-commercial CC version, which I hope was successful.)

mabshoff

unread,
Jan 8, 2009, 3:15:13 PM1/8/09
to sage-devel


On Jan 7, 7:05 pm, "David Joyner" <wdjoy...@gmail.com> wrote:
> On Wed, Jan 7, 2009 at 6:59 PM, Jason Grout <jason-s...@creativetrax.com> wrote:
>
> > Hi everyone,
>
> > There was another request on sage-edu for a nice way to edit text cells
> > in the notebook.  Patches which enable a very nice in-place wysiwyg

Hi David,

> Just to emphasize the importance (and not meaning to hijack the
> thread): There was also a request by Mike May at the booth for this too.
> Mike May, if you don't know, is a huge resource for people who teach
> using Maple, as he has tons of great Maple worksheets on his website.

Nice, I took a look and the worksheets are pretty nice.

> I hope and think I convinced him that Sage is the way to go and he
> plans to test out Sage this semester before giving it to his students.
> (He seemed inclined anyway, so I just strongly encouraged his own idea.)
> However, he explained clearly how he teaches and that he needs the
> students to be able to *easily* edit the text he types into the worksheets.
> I've forgotten why - maybe he used the cell for computation and asks
> the students to
> enter their answer as text in a grammatically correct sentence.
>
> If Mike May does in fact switch over to Sage, this will be a huge benefit, IMHO,
> since he is well-known in the Maple community, so this will be a sign
> of confidence in Sage as a teaching platform by a widely respected teacher,
> and also will be a great resource for really high quality teaching materials
> down the road. He also agreed that the CC attribution license is
> acceptable to him for his "maple->Sage translated" worksheets, if
> he agrees to switch to Sage. (I spent some time trying to talk him out of the
> non-commercial CC version, which I hope was successful.)

:)

> > editor for text cells are sitting on trac waiting to be reviewed.  Some
> > people have reviewed them and found them to work well.  I'm not sure how
> > much review is needed before they pass the test and are merged (the
> > patches touch a lot of notebook and javascript code).  If anyone can
> > test them, I'm pleading for more reviews (at least, I think that's the
> > stage they are stuck at now).  I believe the main concerns are making
> > sure that the patches work on a variety of platforms/browsers.  Another
> > concern that has been expressed is a review of the javascript code (for
> > example, the notebook AJAX communication code was replaced with jquery
> > function calls).

I think that the editor is just as important as the @interact in the
notebook. So if we could find some more people to test the patches we
can get them into the next release. As long as they don't break any
existing functionality I would think that even if the editor support
is slightly broken on some platforms it should still go in. The patch
has been around for a while and resolving this would make life easier
for everyone.

> > Instructions for applying the patches are below and at the bottom of the
> > ticket athttp://trac.sagemath.org/sage_trac/ticket/4705.  Note that
> > some of these tickets have cleaned-up spkgs from mabshoff (listed at the
> > bottom of the relevant ticket) that should be tested instead of the
> > spkgs listed in the email below.
>
> > Thanks,
>
> > Jason

Cheers,

Michael

Luiz Felipe Martins

unread,
Jan 8, 2009, 4:27:46 PM1/8/09
to sage-...@googlegroups.com
I'm still working on this, but here is some quick feedback.

The tinymce editor essentially works "as advertised". I stumbled upon
some snags, but it seems to be pretty much robust. I am making a list
of what I see as I work with it, and can post it later.

Here is the worksheet I'm working on. The context is the following: I
have some students that did 1 semester of introductory number theory
and some graduate and stronger students that had little or none. So
the "crash course".

Please do not distribute this, since it is work in progress.
--
"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
Crash_Course_in_Number_Theory.sws

Martin Albrecht

unread,
Jan 8, 2009, 5:16:46 PM1/8/09
to sage-...@googlegroups.com
> Please do not distribute this, since it is work in progress.

You just sent the worksheet to a public mailinglist with 752 members.

Furthermore, your attachment is available for download here:

http://groups.google.com/group/sage-devel/browse_thread/thread/a4ba0ed228e220c5

i.e. your work is already distributed considerably :)

Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://www.informatik.uni-bremen.de/~malb
_jab: martinr...@jabber.ccc.de

Luiz Felipe Martins

unread,
Jan 8, 2009, 5:21:50 PM1/8/09
to sage-...@googlegroups.com
Oh well...

mabshoff

unread,
Jan 8, 2009, 5:26:40 PM1/8/09
to sage-devel


On Jan 8, 2:21 pm, "Luiz Felipe Martins"
<luizfelipe.mart...@gmail.com> wrote:
> Oh well...

Yeah, I kind of wandered about this myself and we could in theory
delete that particular message from sage-devel. But since this list is
archived elsewhere there is no point to do this and I would greatly
prefer not to change/delete any messages here anyway.

Cheers,

Michael

Luiz Felipe Martins

unread,
Jan 8, 2009, 5:37:20 PM1/8/09
to sage-...@googlegroups.com
That's ok, not to worry. Actually I just want people to keep in mind
it is something unfinished. Perhaps in retrospect I should have waited
one day to post it.

Jason Grout

unread,
Jan 8, 2009, 6:22:05 PM1/8/09
to sage-...@googlegroups.com
mabshoff wrote:

>
> I think that the editor is just as important as the @interact in the
> notebook. So if we could find some more people to test the patches we
> can get them into the next release. As long as they don't break any
> existing functionality I would think that even if the editor support
> is slightly broken on some platforms it should still go in. The patch
> has been around for a while and resolving this would make life easier
> for everyone.

Can someone official make a list of requirements on this ticket to get
into Sage (i.e., a list of platforms people need to try it on, so many
people per platform, whatever). I would, but I'm afraid it'd be a bit
biased :).

Thanks,

Jason

mabshoff

unread,
Jan 8, 2009, 7:15:50 PM1/8/09
to sage-devel
Well, my personal POV:

(a) testing with IE 6, IE 7 Windows
(b) testing with FF 2.0.x, 3.x on Windows, OSX and Linux
(c) testing with Safari on 10.4 and 10.5
(d) testing with Opera 9.5 on Windows, OSX, Linux
(e) Chrome on Windows

Obviously this is rather harsh, so if we covered all five major
browsers somehow this would be enough for me assuming the patches
themselves get a positive review and everything is working *after* we
delete the javascript from the ext repo since there is potentially a
reference to some code in there.

Some of the above has already been tested and confirmed to work. Maybe
you can grab a couple people at the AMS meeting and make them review
this patch :)

I think all the spkgs are covered and it would be nice if someone can
review the changes I made to some of them. Then I would take care of
the rest.

In the end having your assurance that you will available to fix some
of the inevitable issues would also be assuring.

> Thanks,
>
> Jason

Cheers,

Michael

kcrisman

unread,
Jan 12, 2009, 12:39:47 PM1/12/09
to sage-devel


> Just to emphasize the importance (and not meaning to hijack the
> thread): There was also a request by Mike May at the booth for this too.
> Mike May, if you don't know, is a huge resource for people who teach
> using Maple, as he has tons of great Maple worksheets on his website.
>
> I hope and think I convinced him that Sage is the way to go and he
> plans to test out Sage this semester before giving it to his students.
> (He seemed inclined anyway, so I just strongly encouraged his own idea.)
> However, he explained clearly how he teaches and that he needs the
> students to be able to *easily* edit the text he types into the worksheets.
> I've forgotten why - maybe he used the cell for computation and asks
> the students to
> enter their answer as text in a grammatically correct sentence.
>
> If Mike May does in fact switch over to Sage, this will be a huge benefit, IMHO,
> since he is well-known in the Maple community, so this will be a sign
> of confidence in Sage as a teaching platform by a widely respected teacher,
> and also will be a great resource for really high quality teaching materials
> down the road. He also agreed that the CC attribution license is
> acceptable to him for his "maple->Sage translated" worksheets, if
> he agrees to switch to Sage. (I spent some time trying to talk him out of the
> non-commercial CC version, which I hope was successful.)

(I guess this belongs on sage-edu, but since it was mentioned in this
one...)

Just FYI, completely randomly I stopped by his poster about hosting
PREP workshops through the MAA (he will be able to do an online
workshop on using Geogebra through the MAA PREP program, which is NSF-
funded) and he has been extremely helpful in suggesting how to apply
for hosting an online Sage workshop. MAA has *very* nice marketing
for this set of workshops, and the deadline for summer 2010 workshops
is still coming, I believe.

I'll also take this opportunity to to thank particularly Robert
Miller, Marshall Hampton, David Harvey, and David Joyner for their
yeoman's work at the booth and with the various talks and session -
very dedicated and great work!

- kcrisman

Jason Grout

unread,
Jan 13, 2009, 10:53:56 AM1/13/09
to sage-...@googlegroups.com

Here are the things that still need to be done to get this in (I believe
I've covered everything). If anyone can do part or all of this, that
would be great!

* testing with IE 6 on Windows
* testing with FF 2.0.x on Windows, OSX and Linux
* testing with Safari on 10.4
* testing with Opera 9.5 on OSX, Linux
* review of the patches themselves
* review of mabshoff's changes to the spkgs
* trivial one-line patch to fix the "ghostly text" issue (just make
the placeholder string the empty string in cell.py (search for
"placeholder" in cell.py).
* (maybe can wait for another patch): figure out what is going on
with divs with the same id. My guess is that it is an issue with setting
the innerHTMl of an object, rather than replacing the object itself.
When the page is "Edit"ed and then reloaded, the duplicate nested IDs go
away. This points to the javascript code that inserts text cells as the
problem.

> In the end having your assurance that you will available to fix
> some of the inevitable issues would also be assuring.

You have my assurance.

Jason

kcrisman

unread,
Jan 13, 2009, 3:24:53 PM1/13/09
to sage-devel


>      * testing with FF 2.0.x on OSX
>      * testing with Safari on 10.4

I have reviewed for Safari on 10.4 PPC, FF on 10.4 PPC (see ticket).
Safari looks good! But I have inexplicable, horrible, rendering bug
on FF 2.0.0.13 which is reproducible for me, but hopefully not for
anyone else.

- kcrisman

Luiz Felipe Martins

unread,
Jan 19, 2009, 12:45:55 AM1/19/09
to sage-...@googlegroups.com
I have been using TinyMCE for about three weeks now. My ultimate goal
would be to to do something along the lines that David Joyner mentions
in a previous message (have students create worksheets that have
comments/interpretation between the cells).

TinyMCE works very well as far as editing goes, and I didn't test all
buttons available in the tool bar. I think it would be a nice edition
to Sage. It does not seem to affect how responsively the code is
executed, but what I am doing is not very demanding.

However, I noticed the following: (I'm using it in Firefox 3.0.5 in
Ubuntu 10.2. The Sage version is 3.2.2.)

(1)
If I click the menu Action-Evaluate All, exceptions are thrown in
certain situations. The following is the sequence that will trigger
it:
- Execute the code in some cells
- Create text using TinyMCE and save it.
- Do Action-Evaluate All
The problem does not appear to happen with worksheets that had been
saved in a previous Sage session, and then are opened in a new
session. Quitting the worksheet and reopening it also seems to fix the
problem, as long as there were no previous exceptions thrown. I'm not
including a worksheet reproducing the problem because it seems to be
"dynamic", it only occurs as one is working on the worksheet. I am
attaching a text file with the output of the sage session.

(2)
If one creates a link in TinyMCE (highlight text, use the link
button), save the changes in the TinyMCE editor and then follow the
link, when returning to the page with the worksheet (using the
browser's back button), the text that has just been typed disappears.
It reappears if the reload button in the browser is used. (So, it
seems to be a problem of refreshing the cached page). The same happens
if the HTML is directly edited to create the link. In my opinion, the
default behavior on clicking a link in a worksheet should be to open
it in another tab/window in the browser. The idea is that the links
might have reference to documentation, math references, etc, and users
will want to continue to do their math in Sage.

(3)
This is more in the "weirdness" department. I noticed that, sometimes,
each time I reopen a worksheet, a new empty cell is created at the
bottom. I was not able to reproduce it consistently.

Felipe
TinyMCE.log

mhampton

unread,
Jan 19, 2009, 8:53:15 AM1/19/09
to sage-devel
Thanks for keeping track of those issues. I would add them to the
tinymce track ticket (4705) but its just been closed as that was
merged in sage-3.3.alpha0 which is up on sage.math.washington.edu in
mabshoff's folder but hasn't been announced yet. I could open a new
ticket, but there have been a lot of little fixes to the notebook in
sage-3.3.alpha0 and so its possible that some of the weird things you
saw have been fixed.

So this should be looked at in sage-3.3.alpha0 - I will give it a
whirl as soon as I've got it running.

-Marshall Hampton

On Jan 18, 11:45 pm, Luiz Felipe Martins
> luizfelipe.mart...@gmail.com
>
> TinyMCE.log
> 25KViewDownload

mabshoff

unread,
Jan 19, 2009, 9:07:15 AM1/19/09
to sage-devel


On Jan 19, 5:53 am, mhampton <hampto...@gmail.com> wrote:
Hi,

> Thanks for keeping track of those issues.  I would add them to the
> tinymce track ticket (4705)

Please do not add anything to a messy ticket like that. The TinyMCE
and related patches have been the worst merge I have ever done while
doing releases for Sage because things were distributed over five
tickets which all had an usual amount of comments. There were also
patches that were not to be applied while the comments Jason gave were
incomplete. Also note that the two spkgs I did not review both had
issues, so I fixed them, too. I can only advocate again for the future
to do a series of incremental tickets without interaction between the
various components and a strict dependency graph. That was partially
the case in the beginning, but then as usual chaos ensued.

Overall the positive review for that whole series is somewhat fishy,
but now it is in and at SD 12 we will hopefully see further
stabilization and bug fixes to the code. Thanks to Mike Hansen a
couple of the more annoying bugs in the notebook like the magic
autoevaluation of interact widges have already been reviewed and
merged in 3.3.alpha0, too.

> but its just been closed as that was
> merged in sage-3.3.alpha0

Yep, I am giving it a full build spin since so much changed. I nuked
the build directory to flush out any issues with the jquery and jsmath
removal from extcode and so on and it seemed to work, but I would
rather err on the side of caution before building this all over the
place. So I will announce once it has build and tested for me and
given that I use 20 cores on geom it won't be long, i.e. a little over
90 minutes walltime total and I am already past clisp.

> which is up on sage.math.washington.edu in
> mabshoff's folder but hasn't been announced yet.  I could open a new
> ticket, but there have been a lot of little fixes to the notebook in
> sage-3.3.alpha0 and so its possible that some of the weird things you
> saw have been fixed.
>
> So this should be looked at in sage-3.3.alpha0 - I will give it a
> whirl as soon as I've got it running.
>
> -Marshall Hampton

Yep, please test the notebook in 3.3.alpha0. Since SD 12 is coming up
real soon now this is the golden chance to report issues and have them
fixed in the next week.

Cheers,

Michael

Jason Grout

unread,
Jan 19, 2009, 9:10:57 AM1/19/09
to sage-...@googlegroups.com
mhampton wrote:
> Thanks for keeping track of those issues. I would add them to the
> tinymce track ticket (4705) but its just been closed as that was
> merged in sage-3.3.alpha0 which is up on sage.math.washington.edu in
> mabshoff's folder but hasn't been announced yet. I could open a new
> ticket, but there have been a lot of little fixes to the notebook in
> sage-3.3.alpha0 and so its possible that some of the weird things you
> saw have been fixed.
>
> So this should be looked at in sage-3.3.alpha0 - I will give it a
> whirl as soon as I've got it running.


I just opened #5025, which quotes the relevant email.

Thanks,

Jason

mhampton

unread,
Jan 19, 2009, 9:59:07 AM1/19/09
to sage-devel
I can reproduce (1) on sage-3.3.alpha0, which seems like the most
important one. This should be relatively easy to fix - I think the
new text cell type just needs more infrastructure. I agree with (2),
it would be nice if the default link opens a new tab or window. I
cannot reproduce (3) but I didn't try very had.

-Marshall
Reply all
Reply to author
Forward
0 new messages