Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Initialize the command registry with the bindings.
let commands = new CommandRegistry();
let useCapture = true;
// Setup the keydown listener for the document.
document.addEventListener(
'keydown',
event => {
commands.processKeydownEvent(event);
},
useCapture
);
let rendermime = new RenderMimeRegistry({
initialFactories: initialFactories,
latexTypesetter: new MathJaxTypesetter({
url: PageConfig.getOption('mathjaxUrl'),
config: PageConfig.getOption('mathjaxConfig')
})
});
let opener = {
open: (widget: Widget) => {
// Do nothing for sibling widgets for now.
}
};
let docRegistry = new DocumentRegistry();
let docManager = new DocumentManager({
registry: docRegistry,
manager,
opener
function showDiff(data: {base: nbformat.INotebookContent, diff: IDiffEntry[]}): Promise {
let rendermime = new RenderMimeRegistry({
initialFactories: rendererFactories,
sanitizer: defaultSanitizer,
latexTypesetter: new MathJaxTypesetter({
url: getConfigOption('mathjaxUrl'),
config: getConfigOption('mathjaxConfig'),
}),
});
let nbdModel = new NotebookDiffModel(data.base, data.diff);
let nbdWidget = new NotebookDiffWidget(nbdModel, rendermime);
let root = document.getElementById('nbdime-root');
if (!root) {
throw new Error('Missing root element "nbidme-root"');
}
root.innerHTML = '';
// Hide unchanged cells by default:
toggleShowUnchanged(!getConfigOption('hideUnchanged', true));
function renderCell(element, options) {
// render a single cell
// element should be a `<pre>` tag with some code in it
let mergedOptions = mergeOptions({ options });
let $cell = $("<div class="thebelab-cell">");
let $element = $(element);
let $output = $element.next(mergedOptions.outputSelector);
let source = $element.text().trim();
let renderers = {
initialFactories: getRenderers(mergedOptions),
};
if (mergedOptions.mathjaxUrl) {
renderers.latexTypesetter = new MathJaxTypesetter({
url: mergedOptions.mathjaxUrl,
config: mergedOptions.mathjaxConfig,
});
}
let renderMime = new RenderMimeRegistry(renderers);
let manager = options.manager;
renderMime.addFactory(
{
safe: false,
mimeTypes: [WIDGET_MIMETYPE],
createRenderer: options => new WidgetRenderer(options, manager),
},
1
);</div></pre>
// Initialize the command registry with the bindings.
let commands = new CommandRegistry();
let useCapture = true;
// Setup the keydown listener for the document.
document.addEventListener(
'keydown',
event => {
commands.processKeydownEvent(event);
},
useCapture
);
let rendermime = new RenderMimeRegistry({
initialFactories: initialFactories,
latexTypesetter: new MathJaxTypesetter({
url: PageConfig.getOption('mathjaxUrl'),
config: PageConfig.getOption('mathjaxConfig')
})
});
let opener = {
open: (widget: Widget) => {
// Do nothing for sibling widgets for now.
}
};
let docRegistry = new DocumentRegistry();
let docManager = new DocumentManager({
registry: docRegistry,
manager,
opener
// Initialize the command registry with the bindings.
let commands = new CommandRegistry();
let useCapture = true;
// Setup the keydown listener for the document.
document.addEventListener(
'keydown',
event => {
commands.processKeydownEvent(event);
},
useCapture
);
let rendermime = new RenderMimeRegistry({
initialFactories: initialFactories,
latexTypesetter: new MathJaxTypesetter({
url: PageConfig.getOption('mathjaxUrl'),
config: PageConfig.getOption('mathjaxConfig')
})
});
let opener = {
open: (widget: Widget) => {
// Do nothing for sibling widgets for now.
}
};
let docRegistry = new DocumentRegistry();
let docManager = new DocumentManager({
registry: docRegistry,
manager,
opener
manager.ready.then(() => {
let kind = PageConfig.getOption('kind') as KindType;
let path = PageConfig.getOption('path');
const rendermime = new RenderMimeRegistry({
initialFactories: initialFactories,
latexTypesetter: new MathJaxTypesetter({
url: PageConfig.getOption('mathjaxUrl'),
config: PageConfig.getOption('mathjaxConfig')
})
});
ReactDOM.render(
,
document.getElementById('everything-container')
);
});
}