Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Object.keys(config).forEach((key: keyof CodeEditor.IConfig) => {
config[key] =
cached[key] === null || cached[key] === undefined
? CodeEditor.defaultConfig[key]
: cached[key];
});
// Trigger a refresh of the rendered commands
export function updateSettings(
settings: ISettingRegistry.ISettings,
commands: CommandRegistry
): void {
config = {
...CodeEditor.defaultConfig,
...(settings.get('editorConfig').composite as JSONObject)
};
// Trigger a refresh of the rendered commands
commands.notifyCommandChanged();
}
editorServices,
factoryOptions: {
name: FACTORY,
fileTypes: ['markdown', '*'], // Explicitly add the markdown fileType so
defaultFor: ['markdown', '*'] // it outranks the defaultRendered viewer.
}
});
const { commands, restored, shell } = app;
const tracker = new InstanceTracker>({
namespace
});
const isEnabled = () =>
tracker.currentWidget !== null &&
tracker.currentWidget === shell.currentWidget;
let config: CodeEditor.IConfig = { ...CodeEditor.defaultConfig };
// Handle state restoration.
if (restorer) {
restorer.restore(tracker, {
command: 'docmanager:open',
args: widget => ({ path: widget.context.path, factory: FACTORY }),
name: widget => widget.context.path
});
}
/**
* Update the setting values.
*/
function updateSettings(settings: ISettingRegistry.ISettings): void {
config = {
...CodeEditor.defaultConfig,
function updateSettings(settings: ISettingRegistry.ISettings): void {
config = {
...CodeEditor.defaultConfig,
...(settings.get('editorConfig').composite as JSONObject)
};
// Trigger a refresh of the rendered commands
app.commands.notifyCommandChanged();
}
it('shoule accept a custom editorConfig', () => {
const editorConfig: Partial = {
insertSpaces: false,
matchBrackets: false
};
const widget = new Cell({
editorConfig,
model,
contentFactory
}).initializeState();
expect(widget.editor.getOption('insertSpaces')).toEqual(false);
expect(widget.editor.getOption('matchBrackets')).toEqual(false);
expect(widget.editor.getOption('lineNumbers')).toEqual(
CodeEditor.defaultConfig.lineNumbers
);
});
});
*/
styleSelectedText: boolean;
/**
* Defines the mouse cursor appearance when hovering over the selection.
* It can be set to a string, like "pointer", or to true,
* in which case the "default" (arrow) cursor will be used.
*/
selectionPointer: boolean | string;
}
/**
* The default configuration options for an editor.
*/
export let defaultConfig: Required = {
...CodeEditor.defaultConfig,
mode: 'null',
theme: 'jupyter',
smartIndent: true,
electricChars: true,
keyMap: 'default',
extraKeys: null,
gutters: [],
fixedGutter: true,
showCursorWhenSelecting: false,
coverGutterNextToScrollbar: false,
dragDrop: true,
lineSeparator: null,
scrollbarStyle: 'native',
lineWiseCopyCut: true,
scrollPastEnd: false,
styleActiveLine: false,
const updateSettings = (settings: ISettingRegistry.ISettings): void => {
const cached = settings.get('editorConfig').composite as Partial<
CodeEditor.IConfig
>;
const config: CodeEditor.IConfig = {
...CodeEditor.defaultConfig,
...cached
};
item.model!.config = config;
};
void Promise.all([
*/
readonly raw: Partial;
}
/**
* Default configuration options for cell editors.
*/
export const defaultEditorConfig: IEditorConfig = {
code: {
...CodeEditor.defaultConfig,
lineWrap: 'off',
matchBrackets: true,
autoClosingBrackets: true
},
markdown: {
...CodeEditor.defaultConfig,
lineWrap: 'on',
matchBrackets: false,
autoClosingBrackets: false
},
raw: {
...CodeEditor.defaultConfig,
lineWrap: 'on',
matchBrackets: false,
autoClosingBrackets: false
}
};
/**
* A config object for the notebook widget
*/
export interface INotebookConfig {
*/
scrollbarStyle?: string;
/**
* When enabled, which is the default, doing copy or cut when there is no
* selection will copy or cut the whole lines that have cursors on them.
*/
lineWiseCopyCut?: boolean;
}
/**
* The default configuration options for an editor.
*/
export
let defaultConfig: IConfig = {
...CodeEditor.defaultConfig,
mode: 'null',
theme: 'jupyter',
smartIndent: true,
electricChars: true,
keyMap: 'default',
extraKeys: null,
gutters: Object.freeze([]),
fixedGutter: true,
showCursorWhenSelecting: false,
coverGutterNextToScrollbar: false,
dragDrop: true,
lineSeparator: null,
scrollbarStyle: 'native',
lineWiseCopyCut: true,
};
*/
export const defaultEditorConfig: IEditorConfig = {
code: {
...CodeEditor.defaultConfig,
lineWrap: 'off',
matchBrackets: true,
autoClosingBrackets: true
},
markdown: {
...CodeEditor.defaultConfig,
lineWrap: 'on',
matchBrackets: false,
autoClosingBrackets: false
},
raw: {
...CodeEditor.defaultConfig,
lineWrap: 'on',
matchBrackets: false,
autoClosingBrackets: false
}
};
/**
* A config object for the notebook widget
*/
export interface INotebookConfig {
/**
* Enable scrolling past the last cell
*/
scrollPastEnd: boolean;
}
/**