Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
})
});
let opener = {
open: (widget: Widget) => {
// Do nothing for sibling widgets for now.
}
};
let docRegistry = new DocumentRegistry();
let docManager = new DocumentManager({
registry: docRegistry,
manager,
opener
});
let mFactory = new NotebookModelFactory({});
let editorFactory = editorServices.factoryService.newInlineEditor;
let contentFactory = new NotebookPanel.ContentFactory({ editorFactory });
let wFactory = new NotebookWidgetFactory({
name: 'Notebook',
modelName: 'notebook',
fileTypes: ['notebook'],
defaultFor: ['notebook'],
preferKernel: true,
canStartKernel: true,
rendermime,
contentFactory,
mimeTypeService: editorServices.mimeTypeService
});
docRegistry.addModelFactory(mFactory);
docRegistry.addWidgetFactory(wFactory);
})
});
let opener = {
open: (widget: Widget) => {
// Do nothing for sibling widgets for now.
}
};
let docRegistry = new DocumentRegistry();
let docManager = new DocumentManager({
registry: docRegistry,
manager,
opener
});
let mFactory = new NotebookModelFactory({});
let editorFactory = editorServices.factoryService.newInlineEditor;
let contentFactory = new NotebookPanel.ContentFactory({ editorFactory });
let wFactory = new NotebookWidgetFactory({
name: 'Notebook',
modelName: 'notebook',
fileTypes: ['notebook'],
defaultFor: ['notebook'],
preferKernel: true,
canStartKernel: true,
rendermime,
contentFactory,
mimeTypeService: editorServices.mimeTypeService
});
docRegistry.addModelFactory(mFactory);
docRegistry.addWidgetFactory(wFactory);
it('should get the file format', () => {
const factory = new NotebookModelFactory({});
expect(factory.fileFormat).to.equal('json');
});
});
it('should always return an empty string', () => {
const factory = new NotebookModelFactory({});
expect(factory.preferredLanguage('')).to.equal('');
expect(factory.preferredLanguage('.ipynb')).to.equal('');
});
});
it('should get whether the factory is disposed', () => {
const factory = new NotebookModelFactory({});
expect(factory.isDisposed).to.equal(false);
factory.dispose();
expect(factory.isDisposed).to.equal(true);
});
});
it('should get the file type', () => {
const factory = new NotebookModelFactory({});
expect(factory.contentType).to.equal('notebook');
});
});
it('should accept a language preference', () => {
const factory = new NotebookModelFactory({});
const model = factory.createNew('foo');
expect(model.defaultKernelLanguage).to.equal('foo');
});
});
const node = host.getElementsByClassName('jp-Dialog')[0];
if (node) {
simulate(node as HTMLElement, 'keydown', { keyCode: 27 });
}
}
/**
* A namespace for private data.
*/
namespace Private {
let manager: ServiceManager;
export const textFactory = new TextModelFactory();
export const notebookFactory = new NotebookModelFactory({});
/**
* Get or create the service manager singleton.
*/
export function getManager(): ServiceManager {
if (!manager) {
manager = new ServiceManager({ standby: 'never' });
}
return manager;
}
}
const node = host.getElementsByClassName('jp-Dialog')[0];
if (node) {
simulate(node as HTMLElement, 'keydown', { keyCode: 27 });
}
}
/**
* A namespace for private data.
*/
namespace Private {
export const manager = new ServiceManager();
export const textFactory = new TextModelFactory();
export const notebookFactory = new NotebookModelFactory({});
class JSONRenderer extends RenderedHTML {
mimeType = 'text/html';
renderModel(model: IRenderMime.IMimeModel): Promise {
let source = model.data['application/json'];
model.setData({ data: { 'text/html': json2html(source) } });
return super.renderModel(model);
}
}
const jsonRendererFactory = {
mimeTypes: ['application/json'],
safe: true,
createRenderer(
options: IRenderMime.IRendererOptions