/usr/lib/python2.7/dist-packages/notebook/static/notebook/js/celltoolbarpresets/rawcell.js is in python-notebook 5.2.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | // Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'notebook/js/celltoolbar',
'base/js/dialog',
'base/js/keyboard',
'base/js/i18n'
], function(celltoolbar, dialog, keyboard, i18n) {
"use strict";
var CellToolbar = celltoolbar.CellToolbar;
var raw_cell_preset = [];
var select_type = CellToolbar.utils.select_ui_generator([
[i18n.msg._("None"), "-"],
["LaTeX", "text/latex"],
["reST", "text/restructuredtext"],
["HTML", "text/html"],
["Markdown", "text/markdown"],
["Python", "text/x-python"],
[i18n.msg._("Custom"), "dialog"],
],
// setter
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 || "-")
);
dialog.modal({
title: i18n.msg._("Raw Cell MIME Type"),
body: dialog,
buttons : {
"Cancel": {},
"OK": {
class: "btn-primary",
click: function () {
console.log(cell);
cell.metadata.raw_mimetype = $(this).find('input').val();
console.log(cell.metadata);
}
}
},
open : function (event, ui) {
var that = $(this);
// Upon ENTER, click the OK button.
that.find('input[type="text"]').keydown(function (event, ui) {
if (event.which === keyboard.keycodes.enter) {
that.find('.btn-primary').first().click();
return false;
}
});
that.find('input[type="text"]').focus().select();
}
});
} else {
cell.metadata.raw_mimetype = value;
}
},
//getter
function(cell) {
return cell.metadata.raw_mimetype || "";
},
// name
i18n.msg._("Raw NBConvert Format")
);
var register = function (notebook) {
CellToolbar.register_callback('raw_cell.select', select_type, ['raw']);
raw_cell_preset.push('raw_cell.select');
CellToolbar.register_preset(i18n.msg._('Raw Cell Format'), raw_cell_preset, notebook);
};
return {'register': register};
});
|