Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function activateChatbox(app: JupyterLab, rendermime: IRenderMime, palette: ICommandPalette, editorServices: IEditorServices, docManager: IDocumentManager, restorer: ILayoutRestorer): void {
const id = 'chatbox';
let { commands, shell } = app;
let category = 'Chatbox';
let command: string;
/**
* Create a chatbox for a given path.
*/
let editorFactory = editorServices.factoryService.newInlineEditor.bind(
editorServices.factoryService);
let contentFactory = new ChatboxPanel.ContentFactory({ editorFactory });
let panel = new ChatboxPanel({
rendermime: rendermime.clone(),
contentFactory
});
// Add the chatbox panel to the tracker.
panel.title.label = 'Chat';
panel.id = id;
restorer.add(panel, 'chatbox');
command = CommandIDs.clear;
commands.addCommand(command, {
label: 'Clear Chat',
execute: args => {
panel.chatbox.clear();
}
function activateChatbox(app: JupyterLab, rendermime: IRenderMime, palette: ICommandPalette, editorServices: IEditorServices, docManager: IDocumentManager, restorer: ILayoutRestorer): void {
const id = 'chatbox';
let { commands, shell } = app;
let category = 'Chatbox';
let command: string;
/**
* Create a chatbox for a given path.
*/
let editorFactory = editorServices.factoryService.newInlineEditor.bind(
editorServices.factoryService);
let contentFactory = new ChatboxPanel.ContentFactory({ editorFactory });
let panel = new ChatboxPanel({
rendermime: rendermime.clone(),
contentFactory
});
// Add the chatbox panel to the tracker.
panel.title.label = 'Chat';
panel.id = id;
restorer.add(panel, 'chatbox');
command = CommandIDs.clear;
commands.addCommand(command, {
label: 'Clear Chat',
execute: args => {
panel.chatbox.clear();
beforeEach(() => {
chatbox = new Chatbox({
rendermime, contentFactory
});
modelDB = new DummyCollaborativeDB();
docmodel = new DocumentModel('', modelDB);
chatbox.model = docmodel;
});
import {
ModelDB, ObservableMap, ObservableList, ICollaborator
} from '@jupyterlab/coreutils';
import {
defaultRenderMime
} from '../utils';
/**
* Factory stuff.
*/
const editorFactory = editorServices.factoryService.newInlineEditor.bind(
editorServices.factoryService);
const contentFactory = new Chatbox.ContentFactory({ editorFactory });
const rendermime = defaultRenderMime();
/**
* Create a dummy collaborator map.
*/
class DummyCollaboratorMap extends ObservableMap {
type: 'Map';
readonly localCollaborator: ICollaborator = {
userId: '1234',
sessionId: '5678',
displayName: 'A. U. Thor',
color: '#00FF33',
shortName: 'AU'
}
}