Are there any issues/risks with adding

        extended_valid_elements: "style",

to the tinyMCE.init object in notebook.py (around line 1810)?  I ask
because it seems that TinyMCE "removes" from edited and saved text any
elements not specified in its valid_elements or extended_valid_elements
options:

http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/valid_elements
http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/extended_valid_elements
.

For example, I can open an editor, click on the HTML icon to "Edit HTML
Source," and paste, e.g.,

Hello there!<style> div.worksheet {background-color: goldenrod;} </style>

into a textarea.  Alternatively, I can use the plain text editor to
place this element outside a cell block.  But by default, when I save
the area with TinyMCE, it replaces <style> and </style> with <!-- and
-->.  That is, it comments out the style directive.  If I don't include
"Hello there!," the style does stay, but I need to remember to leave
that area alone.

It seems the worksheet's first two lines, with the sheet's title and
system, are off-limits to TinyMCE.  Another possible workaround is to
add a "field" for custom CSS to this area.  I'm not sure if this would
cause compatibility headaches.

Anyway, one advantage to preserving style elements across simple edits
in a browser is that I can use something like (you may need to fix the
indentation)

s = ''
@interact
def _(radius=slider(0.0,1.0,0.05,0.5,'Border radii'), c_in_bord =
Color('blue'), c_in_back = Color('white'), c_ac_bord = Color('blue'),
c_ac_back = Color('white')):
    global s
    s = ''
    s += '<style type="text/css">'
    s += 'div.worksheet {-moz-border-radius: %fem;}' % radius
    s += 'textarea.cell_input, pre.cell_input, textarea.cell_input_hide,
pre.cell_input_hide {border-color: %s; background-color: %s;
-moz-border-radius: %fem;}' % (c_in_bord.html_color(),
c_in_back.html_color(), radius)
    s += 'textarea.cell_input_active, div.cell_input_active
{border-color: %s; background-color: %s; -moz-border-radius: %fem;}' %
(c_ac_bord.html_color(), c_ac_back.html_color(), radius)
    s += '</style>'
    html(s)

to tune a color scheme --- with instant feedback, thanks to auto
updates! --- and paste the output of "print s" into the plain text
editor to apply it.  Of course, a built-in function which returns a more
detailed control panel and other changes to server-side code could
automate this.

Since this panel may take up lots of space, I propose crossing the input
grid and color selector controls, to get a new control similar to that
in the attached screenshot.  Here, all I've done is tweaked a Farbtastic
demo,

$SAGE_ROOT/local/notebook/javascript/jquery/plugins/farbtastic/demo2.html ,

so this is still just a concept.

Thoughts?

By the way, I may have missed this in the documentation, but is it
possible to set a transparent background for 2D plots in Sage?

Thanks.


Pat LeSmithe wrote:
> Jason Grout wrote:
>> Pat LeSmithe wrote:
>>> option to bring up a worksheet settings page.  How about serving up an
>>> @interact widget for the settings?
>> How do you see this working?  In other words, what do you see in the 
>> interact widget controls, and how would they affect the notebook, etc.
> 
> It may be a while before I can converge on a design and a reasonable
> feature-set, but I'm thinking of a "control panel" with buttons,
> selectors, etc., for changing a worksheet's background color, input /
> output / active cell background / border colors, font family / weight /
> size / color, and similar stylistic attributes (see the attached CSS for
> a few examples).  Preset themes could also be available.  A new setting
> could take effect immediately or after a "submit" button is pressed.
> The latter could simply reload the worksheet.  Perhaps similar @interact
> panels would suffice for notebook and user-level settings.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

<<inline: mutant.png>>

Reply via email to