Skip to content

Commit 3c6cc5a

Browse files
committed
Rename to view-only
1 parent b5c3a4c commit 3c6cc5a

File tree

3 files changed

+34
-34
lines changed

3 files changed

+34
-34
lines changed

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { Commands } from './commands';
1616
import { competitions } from './pages/competitions';
1717
import { notebookPlugin } from './pages/notebook';
1818
import { generateDefaultNotebookName } from './notebook-name';
19-
import { readonlyNotebookFactoryPlugin } from './readonly-notebook';
19+
import { viewOnlyNotebookFactoryPlugin } from './view-only';
2020

2121
/**
2222
* Generate a shareable URL for the currently active notebook.
@@ -238,7 +238,7 @@ const plugin: JupyterFrontEndPlugin<void> = {
238238
};
239239

240240
export default [
241-
readonlyNotebookFactoryPlugin,
241+
viewOnlyNotebookFactoryPlugin,
242242
plugin,
243243
notebookPlugin,
244244
files,

src/pages/notebook.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ import { ToolbarButton, IToolbarWidgetRegistry } from '@jupyterlab/apputils';
77
import { DownloadDropdownButton } from '../ui-components/DownloadDropdownButton';
88
import { Commands } from '../commands';
99
import { SharingService } from '../sharing-service';
10-
import { READONLY_NOTEBOOK_FACTORY, IReadonlyNotebookTracker } from '../readonly-notebook';
10+
import { VIEW_ONLY_NOTEBOOK_FACTORY, IViewOnlyNotebookTracker } from '../view-only';
1111

1212
export const notebookPlugin: JupyterFrontEndPlugin<void> = {
1313
id: 'jupytereverywhere:notebook',
1414
autoStart: true,
15-
requires: [INotebookTracker, IReadonlyNotebookTracker, IToolbarWidgetRegistry],
15+
requires: [INotebookTracker, IViewOnlyNotebookTracker, IToolbarWidgetRegistry],
1616
activate: (
1717
app: JupyterFrontEnd,
1818
tracker: INotebookTracker,
19-
readonlyTracker: IReadonlyNotebookTracker,
19+
readonlyTracker: IViewOnlyNotebookTracker,
2020
toolbarRegistry: IToolbarWidgetRegistry
2121
) => {
2222
const { commands, shell, serviceManager } = app;
@@ -76,7 +76,7 @@ export const notebookPlugin: JupyterFrontEndPlugin<void> = {
7676

7777
await commands.execute('docmanager:open', {
7878
path: filename,
79-
factory: READONLY_NOTEBOOK_FACTORY
79+
factory: VIEW_ONLY_NOTEBOOK_FACTORY
8080
});
8181

8282
console.log(`Successfully loaded shared notebook: ${filename}`);

src/readonly-notebook.ts renamed to src/view-only.ts

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@ import { createToolbarFactory, IToolbarWidgetRegistry } from '@jupyterlab/apputi
1111
import { Widget } from '@lumino/widgets';
1212
import { Token } from '@lumino/coreutils';
1313

14-
export const READONLY_NOTEBOOK_FACTORY = 'ReadonlyNotebook';
14+
export const VIEW_ONLY_NOTEBOOK_FACTORY = 'ViewOnlyNotebook';
1515

1616
const NOTEBOOK_PANEL_CLASS = 'jp-NotebookPanel';
1717

1818
const NOTEBOOK_PANEL_TOOLBAR_CLASS = 'jp-NotebookPanel-toolbar';
1919

2020
const NOTEBOOK_PANEL_NOTEBOOK_CLASS = 'jp-NotebookPanel-notebook';
2121

22-
export const IReadonlyNotebookTracker = new Token<IReadonlyNotebookTracker>(
23-
'jupytereverywhere:readonly-notebook:IReadonlyNotebookTracker'
22+
export const IViewOnlyNotebookTracker = new Token<IViewOnlyNotebookTracker>(
23+
'jupytereverywhere:view-only-notebook:IViewOnlyNotebookTracker'
2424
);
2525

26-
export interface IReadonlyNotebookTracker extends IWidgetTracker<ReadonlyNotebookPanel> {}
26+
export interface IViewOnlyNotebookTracker extends IWidgetTracker<ViewOnlyNotebookPanel> {}
2727

2828
/**
29-
* Creates a "View Only" header widget for read-only notebooks.
29+
* Creates a "View Only" header widget for view-only notebooks.
3030
*/
3131
class ViewOnlyHeader extends Widget {
3232
constructor() {
@@ -39,15 +39,15 @@ class ViewOnlyHeader extends Widget {
3939
}
4040
}
4141

42-
class ReadonlyNotebook extends StaticNotebook {
43-
// Add any customization for read-only notebook here if needed
42+
class ViewOnlyNotebook extends StaticNotebook {
43+
// Add any customization for view-only notebook here if needed
4444
}
4545

46-
class ReadonlyNotebookPanel extends DocumentWidget<ReadonlyNotebook, INotebookModel> {
46+
class ViewOnlyNotebookPanel extends DocumentWidget<ViewOnlyNotebook, INotebookModel> {
4747
/**
48-
* Construct a new readonly notebook panel.
48+
* Construct a new view-only notebook panel.
4949
*/
50-
constructor(options: DocumentWidget.IOptions<ReadonlyNotebook, INotebookModel>) {
50+
constructor(options: DocumentWidget.IOptions<ViewOnlyNotebook, INotebookModel>) {
5151
super(options);
5252

5353
this.addClass(NOTEBOOK_PANEL_CLASS);
@@ -61,8 +61,8 @@ class ReadonlyNotebookPanel extends DocumentWidget<ReadonlyNotebook, INotebookMo
6161
}
6262
}
6363

64-
namespace ReadonlyNotebookWidgetFactory {
65-
export interface IOptions extends DocumentRegistry.IWidgetFactoryOptions<ReadonlyNotebookPanel> {
64+
namespace ViewOnlyNotebookWidgetFactory {
65+
export interface IOptions extends DocumentRegistry.IWidgetFactoryOptions<ViewOnlyNotebookPanel> {
6666
rendermime: IRenderMimeRegistry;
6767
contentFactory: Notebook.IContentFactory;
6868
mimeTypeService: IEditorMimeTypeService;
@@ -72,16 +72,16 @@ namespace ReadonlyNotebookWidgetFactory {
7272
}
7373
}
7474

75-
class ReadonlyNotebookWidgetFactory extends ABCWidgetFactory<
76-
ReadonlyNotebookPanel,
75+
class ViewOnlyNotebookWidgetFactory extends ABCWidgetFactory<
76+
ViewOnlyNotebookPanel,
7777
INotebookModel
7878
> {
7979
/**
8080
* Construct a new notebook widget factory.
8181
*
8282
* @param options - The options used to construct the factory.
8383
*/
84-
constructor(private _options: ReadonlyNotebookWidgetFactory.IOptions) {
84+
constructor(private _options: ViewOnlyNotebookWidgetFactory.IOptions) {
8585
super(_options);
8686
}
8787

@@ -90,8 +90,8 @@ class ReadonlyNotebookWidgetFactory extends ABCWidgetFactory<
9090
*/
9191
protected createNewWidget(
9292
context: DocumentRegistry.IContext<INotebookModel>,
93-
source?: ReadonlyNotebookPanel
94-
): ReadonlyNotebookPanel {
93+
source?: ViewOnlyNotebookPanel
94+
): ViewOnlyNotebookPanel {
9595
const translator = (context as any).translator;
9696
const { contentFactory, mimeTypeService, rendermime } = this._options;
9797
const nbOptions = {
@@ -108,14 +108,14 @@ class ReadonlyNotebookWidgetFactory extends ABCWidgetFactory<
108108
: this._options.notebookConfig || StaticNotebook.defaultNotebookConfig,
109109
translator
110110
};
111-
const content = new ReadonlyNotebook(nbOptions);
111+
const content = new ViewOnlyNotebook(nbOptions);
112112

113-
return new ReadonlyNotebookPanel({ context, content });
113+
return new ViewOnlyNotebookPanel({ context, content });
114114
}
115115
}
116116

117-
export const readonlyNotebookFactoryPlugin: JupyterFrontEndPlugin<IReadonlyNotebookTracker> = {
118-
id: 'jupytereverywhere:readonly-notebook',
117+
export const viewOnlyNotebookFactoryPlugin: JupyterFrontEndPlugin<IViewOnlyNotebookTracker> = {
118+
id: 'jupytereverywhere:view-only-notebook',
119119
requires: [
120120
NotebookPanel.IContentFactory,
121121
IEditorServices,
@@ -124,7 +124,7 @@ export const readonlyNotebookFactoryPlugin: JupyterFrontEndPlugin<IReadonlyNoteb
124124
ISettingRegistry,
125125
ITranslator
126126
],
127-
provides: IReadonlyNotebookTracker,
127+
provides: IViewOnlyNotebookTracker,
128128
autoStart: true,
129129
activate: (
130130
app: JupyterFrontEnd,
@@ -140,16 +140,16 @@ export const readonlyNotebookFactoryPlugin: JupyterFrontEndPlugin<IReadonlyNoteb
140140
const toolbarFactory = createToolbarFactory(
141141
toolbarRegistry,
142142
settingRegistry,
143-
READONLY_NOTEBOOK_FACTORY,
143+
VIEW_ONLY_NOTEBOOK_FACTORY,
144144
PANEL_SETTINGS,
145145
translator
146146
);
147147

148148
const trans = translator.load('jupyterlab');
149149

150-
const factory = new ReadonlyNotebookWidgetFactory({
151-
name: READONLY_NOTEBOOK_FACTORY,
152-
label: trans.__('Readonly Notebook'),
150+
const factory = new ViewOnlyNotebookWidgetFactory({
151+
name: VIEW_ONLY_NOTEBOOK_FACTORY,
152+
label: trans.__('View-only Notebook'),
153153
fileTypes: ['notebook'],
154154
modelName: 'notebook',
155155
preferKernel: false,
@@ -162,8 +162,8 @@ export const readonlyNotebookFactoryPlugin: JupyterFrontEndPlugin<IReadonlyNoteb
162162
toolbarFactory,
163163
translator
164164
});
165-
const tracker = new WidgetTracker<ReadonlyNotebookPanel>({
166-
namespace: 'readonly-notebook'
165+
const tracker = new WidgetTracker<ViewOnlyNotebookPanel>({
166+
namespace: 'view-only-notebook'
167167
});
168168
factory.widgetCreated.connect((sender, widget) => {
169169
void tracker.add(widget);

0 commit comments

Comments
 (0)