Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken "Raw cell MIME type" dialog (#3255) #5385

Merged
merged 1 commit into from
May 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 28 additions & 13 deletions notebook/static/notebook/js/celltoolbarpresets/rawcell.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,35 @@ define([
function(cell, value) {
if (value === "-") {
delete cell.metadata.raw_mimetype;
} else if (value === 'dialog'){
var dialog = $('<div/>').append(
$("<p/>")
.text(i18n.msg._("Set the MIME type of the raw cell:"))
).append(
$("<br/>")
).append(
$('<input/>').attr('type','text').attr('size','25')
.val(cell.metadata.raw_mimetype || "-")
);
} else if (value === 'dialog') {
var message =
i18n.msg._("Set the MIME type of the raw cell:");

var mimeinput = $('<input/>')
.attr('type', 'text')
.attr('size', '25')
.attr('name', 'mimetype')
.val(cell.metadata.raw_mimetype || "-");

var dialogform = $('<div/>').attr('title', i18n.msg._("Edit MIME type"))
.append(
$('<form/>').append(
$('<fieldset/>').append(
$('<label/>')
.attr('for', 'mimetype')
.text(message)
)
.append($('<br/>'))
.append(mimeinput)
)
);

dialog.modal({
title: i18n.msg._("Raw Cell MIME Type"),
body: dialog,
body: dialogform,
buttons : {
"Cancel": {},
"OK": {
Cancel: {},
OK: {
class: "btn-primary",
click: function () {
console.log(cell);
Expand All @@ -50,6 +63,8 @@ define([
}
}
},
notebook: cell.notebook,
keyboard_manager: cell.keyboard_manager,
open : function (event, ui) {
var that = $(this);
// Upon ENTER, click the OK button.
Expand Down