mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-27 04:20:22 +08:00
sanitize only of text and not explicitely asked not to.
also some docs.
This commit is contained in:
parent
6c5a4ec115
commit
b52467a966
@ -8,6 +8,35 @@ define(function(require) {
|
||||
var IPython = require('base/js/namespace');
|
||||
var $ = require('jquery');
|
||||
|
||||
/**
|
||||
* A wrapper around bootstrap modal for easier use
|
||||
* Pass it an option dictionary with the following properties:
|
||||
*
|
||||
* - body : <string> or <DOM node>, main content of the dialog
|
||||
* if pass a <string> it will be wrapped in a p tag and
|
||||
* html element escaped, unless you specify sanitize=false
|
||||
* option.
|
||||
* - title : Dialog title, default to empty string.
|
||||
* - buttons : dict of btn_options who keys are button label.
|
||||
* see btn_options below for description
|
||||
* - open : callback to trigger on dialog open.
|
||||
* - destroy:
|
||||
* - notebook : notebook instance
|
||||
* - keyboard_manager: keyboard manager instance.
|
||||
*
|
||||
* Unlike bootstrap modals, the backdrop options is set by default
|
||||
* to 'static'.
|
||||
*
|
||||
* The rest of the options are passed as is to bootstrap modals.
|
||||
*
|
||||
* btn_options: dict with the following property:
|
||||
*
|
||||
* - click : callback to trigger on click
|
||||
* - class : css classes to add to button.
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
var modal = function (options) {
|
||||
|
||||
var modal = $("<div/>")
|
||||
@ -20,7 +49,7 @@ define(function(require) {
|
||||
var dialog_content = $("<div/>")
|
||||
.addClass("modal-content")
|
||||
.appendTo(dialog);
|
||||
if(typeof(options.body) === 'string'){
|
||||
if(typeof(options.body) === 'string' && options.sanitize !== false){
|
||||
options.body = $("<p/>").text(options.body)
|
||||
}
|
||||
dialog_content.append(
|
||||
@ -35,7 +64,7 @@ define(function(require) {
|
||||
).append(
|
||||
$("<h4/>")
|
||||
.addClass('modal-title')
|
||||
.text(options.title || "No Title")
|
||||
.text(options.title || "")
|
||||
)
|
||||
).append(
|
||||
$("<div/>").addClass("modal-body").append(
|
||||
|
Loading…
Reference in New Issue
Block a user