Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change launch button #114

Merged
merged 1 commit into from
Mar 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { DocumentRegistry } from '@jupyterlab/docregistry';

import { NotebookPanel, INotebookModel } from '@jupyterlab/notebook';

import { launcherIcon } from '@jupyterlab/ui-components';

import { PageConfig } from '@jupyterlab/coreutils';

import { CommandRegistry } from '@lumino/commands';
Expand All @@ -12,8 +14,6 @@ import { IDisposable } from '@lumino/disposable';

import { dashboardIcon } from '../../icons';

const VOILA_ICON_CLASS = 'jp-MaterialIcon jp-VoilaIcon';

/**
* A WidgetExtension for Notebook's toolbar to open a `VoilaGridstack` widget.
*/
Expand All @@ -32,7 +32,7 @@ export class EditorButton
*/
createNew(panel: NotebookPanel): IDisposable {
const button = new ToolbarButton({
tooltip: 'Open with Voilà GridStack',
tooltip: 'Open with Voilà GridStack editor',
icon: dashboardIcon,
onClick: () => {
this._commands.execute('docmanager:open', {
Expand All @@ -58,13 +58,12 @@ export class VoilaButton
*/
createNew(panel: NotebookPanel): IDisposable {
const button = new ToolbarButton({
className: 'voila',
tooltip: 'Open with Voilà in a New Browser Tab',
iconClass: VOILA_ICON_CLASS,
tooltip: 'Open with Voilà Gridstack in a New Browser Tab',
icon: launcherIcon,
onClick: () => {
const baseUrl = PageConfig.getBaseUrl();
const win = window.open(
`${baseUrl}voila/render/${panel.context.path}`,
`${baseUrl}voila/render/${panel.context.path}?voila-template=gridstack`,
'_blank'
);
win?.focus();
Expand Down
6 changes: 4 additions & 2 deletions packages/jupyterlab-gridstack/src/editor/toolbar/voila.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { ReactWidget, ToolbarButtonComponent } from '@jupyterlab/apputils';

import { launcherIcon } from '@jupyterlab/ui-components';

import { PageConfig } from '@jupyterlab/coreutils';

import * as React from 'react';
Expand All @@ -26,9 +28,9 @@ export default class Voila extends ReactWidget {

return (
<ToolbarButtonComponent
iconClass="jp-MaterialIcon jp-VoilaIcon"
icon={launcherIcon}
onClick={onClick}
tooltip={'Open with Voilà in a New Browser Tab'}
tooltip={'Open with Voilà Gridstack in a New Browser Tab'}
/>
);
}
Expand Down