|
@@ -27,6 +27,19 @@ import {
|
|
|
* An interface for modifying and saving application settings.
|
|
|
*/
|
|
|
class SettingEditor extends Widget {
|
|
|
+ /**
|
|
|
+ * Create a new setting editor.
|
|
|
+ */
|
|
|
+ constructor(options: SettingEditor.IOptions) {
|
|
|
+ super();
|
|
|
+ this.settings = options.settings;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * The setting registry modified by the editor.
|
|
|
+ */
|
|
|
+ readonly settings: ISettingRegistry;
|
|
|
+
|
|
|
/**
|
|
|
* Handle `'activate-request'` messages.
|
|
|
*/
|
|
@@ -37,6 +50,23 @@ class SettingEditor extends Widget {
|
|
|
}
|
|
|
|
|
|
|
|
|
+/**
|
|
|
+ * A namespace for `SettingEditor` statics.
|
|
|
+ */
|
|
|
+namespace SettingEditor {
|
|
|
+ /**
|
|
|
+ * The instantiation options for a setting editor.
|
|
|
+ */
|
|
|
+ export
|
|
|
+ interface IOptions {
|
|
|
+ /**
|
|
|
+ * The setting registry the editor modifies.
|
|
|
+ */
|
|
|
+ settings: ISettingRegistry;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* The command IDs used by the setting editor.
|
|
|
*/
|
|
@@ -47,13 +77,13 @@ namespace CommandIDs {
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * Activate the command palette.
|
|
|
+ * Activate the setting editor.
|
|
|
*/
|
|
|
export
|
|
|
function activateSettingEditor(app: JupyterLab, restorer: ILayoutRestorer, settings: ISettingRegistry): void {
|
|
|
const { commands, shell } = app;
|
|
|
const namespace = 'setting-editor';
|
|
|
- const editor = new SettingEditor();
|
|
|
+ const editor = new SettingEditor({ settings });
|
|
|
const tracker = new InstanceTracker<SettingEditor>({ namespace });
|
|
|
|
|
|
editor.id = namespace;
|