Skip to content

Commit

Permalink
implements #1590
Browse files Browse the repository at this point in the history
  • Loading branch information
boothby committed Jan 3, 2008
1 parent ed505c3 commit 7eb57c8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/sage/server/notebook/js.py
Original file line number Diff line number Diff line change
Expand Up @@ -1244,6 +1244,10 @@ def notebook_lib():
/* Disable coloring and change to div for now */
cell.className="cell_input";
cell_input_minimize_size(cell);
if(cell_has_changed)
send_cell_input(id);
return true; /* disable for now */
cell.className="hidden";
Expand All @@ -1253,16 +1257,14 @@ def notebook_lib():
var t = cell.value.replaceAll("<","&lt;");
if(cell_has_changed)
send_cell_input(id);
return true;
}
function send_cell_input(id) {
cell = get_cell(id)
if(cell == null) return;
async_request("/set_cell_input", generic_callback, "cell_id="+id+"&input="+cell.value);
async_request(worksheet_command('eval'), generic_callback, "save_only=1&id="+id+"&input="+cell.value);
}
function debug_focus() {
Expand Down
8 changes: 7 additions & 1 deletion src/sage/server/notebook/twist.py
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,6 @@ class Worksheet_eval(WorksheetResource, resource.PostableResource):
respectively.
"""
def render(self, ctx):
newcell = int(ctx.args['newcell'][0]) # whether to insert a new cell or not
id = self.id(ctx)
if not ctx.args.has_key('input'):
input_text = ''
Expand All @@ -997,6 +996,13 @@ def render(self, ctx):
cell = W.get_cell_with_id(id)

cell.set_input_text(input_text)

if ctx.args.has_key('save_only') and ctx.args['save_only'][0] == '1':
notebook_updates()
return http.Response(stream='')
else:
newcell = int(ctx.args['newcell'][0]) # whether to insert a new cell or not

cell.evaluate(username = self.username)

if cell.is_last():
Expand Down

0 comments on commit 7eb57c8

Please sign in to comment.