Skip to content

Commit

Permalink
Set notebook as dirty on cell change
Browse files Browse the repository at this point in the history
  • Loading branch information
tmetzl committed Feb 11, 2025
1 parent d8a2e6e commit 639b020
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions packages/cells/src/cells/choice-cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export class SinglechoiceCell extends ChoiceCell {
choices.indexOf(i.toString()) >= 0,
function () {
that.set_choice(this.value);
Jupyter.notebook.set_dirty(true);
}
);
Jupyter.keyboard_manager.register_events(input);
Expand Down Expand Up @@ -117,6 +118,7 @@ export class MultiplechoiceCell extends ChoiceCell {
} else {
that.remove_choice(this.value);
}
Jupyter.notebook.set_dirty(true);
});
if (selected) {
input.attr("checked", "checked");
Expand Down
8 changes: 4 additions & 4 deletions packages/cells/src/utils/diagram-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,7 @@ class DiagramEditor {

postMessage(msg) {
if (this.frame != null) {
this.frame.contentWindow.postMessage(
JSON.stringify(msg),
this.origin
);
this.frame.contentWindow.postMessage(JSON.stringify(msg), this.origin);
}
}

Expand Down Expand Up @@ -288,13 +285,16 @@ class DiagramEditor {
this.initializeEditor();
} else if (msg.event == "autosave") {
this.save(msg.xml, true, this.startElement);
Jupyter.notebook.set_dirty(true);
} else if (msg.event == "export") {
this.cell.model.setAttachment("diagram.png", msg.data);
this.setElementData(this.startElement, msg.data);
this.stopEditing();
this.xml = null;
Jupyter.notebook.set_dirty(true);
} else if (msg.event == "save") {
this.save(msg.xml, false, this.startElement);
Jupyter.notebook.set_dirty(true);
this.xml = msg.xml;

if (msg.exit) {
Expand Down

0 comments on commit 639b020

Please sign in to comment.