Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
modelDB.connected.then(() => {
if (!cell.isDisposed) {
// Setup the selection style for collaborators.
let localCollaborator = modelDB.collaborators.localCollaborator;
cell.editor.uuid = localCollaborator.sessionId;
cell.editor.selectionStyle = {
...CodeEditor.defaultSelectionStyle,
color: localCollaborator.color
};
}
});
}
constructor(options: CodeMirrorEditor.IOptions) {
let host = (this.host = options.host);
host.classList.add(EDITOR_CLASS);
host.classList.add('jp-Editor');
host.addEventListener('focus', this, true);
host.addEventListener('blur', this, true);
host.addEventListener('scroll', this, true);
this._uuid = options.uuid || UUID.uuid4();
// Handle selection style.
let style = options.selectionStyle || {};
this._selectionStyle = {
...CodeEditor.defaultSelectionStyle,
...(style as CodeEditor.ISelectionStyle)
};
let model = (this._model = options.model);
let config = options.config || {};
let fullConfig = (this._config = {
...CodeMirrorEditor.defaultConfig,
...config
});
let editor = (this._editor = Private.createEditor(host, fullConfig));
let doc = editor.getDoc();
// Handle initial values for text, mimetype, and selections.
doc.setValue(model.value.text);
this.clearHistory();
constructor(options: CodeMirrorEditor.IOptions) {
let host = this.host = options.host;
host.classList.add(EDITOR_CLASS);
host.classList.add('jp-Editor');
host.addEventListener('focus', this, true);
host.addEventListener('scroll', this, true);
this._uuid = options.uuid || uuid();
// Handle selection style.
let style = options.selectionStyle || {};
this._selectionStyle = {
...CodeEditor.defaultSelectionStyle,
...style as CodeEditor.ISelectionStyle
};
let model = this._model = options.model;
let editor = this._editor = CodeMirror(host, {});
Private.handleConfig(editor, options.config || {});
let doc = editor.getDoc();
// Handle initial values for text, mimetype, and selections.
doc.setValue(model.value.text);
this._onMimeTypeChanged();
this._onCursorActivity();
// Connect to changes.
model.value.changed.connect(this._onValueChanged, this);
constructor(options: CodeMirrorEditor.IOptions) {
let host = (this.host = options.host);
host.classList.add(EDITOR_CLASS);
host.classList.add('jp-Editor');
host.addEventListener('focus', this, true);
host.addEventListener('blur', this, true);
host.addEventListener('scroll', this, true);
this._uuid = options.uuid || UUID.uuid4();
// Handle selection style.
let style = options.selectionStyle || {};
this._selectionStyle = {
...CodeEditor.defaultSelectionStyle,
...(style as CodeEditor.ISelectionStyle)
};
let model = (this._model = options.model);
let config = options.config || {};
let fullConfig = (this._config = {
...CodeMirrorEditor.defaultConfig,
...config
});
let editor = (this._editor = Private.createEditor(host, fullConfig));
let doc = editor.getDoc();
// Handle initial values for text, mimetype, and selections.
doc.setValue(model.value.text);
this.clearHistory();
void modelDB.connected.then(() => {
let collaborators = modelDB.collaborators;
if (!collaborators) {
return;
}
// Setup the selection style for collaborators
let localCollaborator = collaborators.localCollaborator;
this.editor.uuid = localCollaborator.sessionId;
this.editor.selectionStyle = {
...CodeEditor.defaultSelectionStyle,
color: localCollaborator.color
};
collaborators.changed.connect(this._onCollaboratorsChanged, this);
// Trigger an initial onCollaboratorsChanged event.
this._onCollaboratorsChanged();
});
}
modelDB.connected.then(() => {
if (!cell.isDisposed) {
// Setup the selection style for collaborators.
let localCollaborator = modelDB.collaborators.localCollaborator;
cell.editor.uuid = localCollaborator.sessionId;
cell.editor.selectionStyle = {
...CodeEditor.defaultSelectionStyle,
color: localCollaborator.color
};
}
});
}
it('should be the selection style of the editor', () => {
expect(editor.selectionStyle).to.deep.equal(
CodeEditor.defaultSelectionStyle
);
});