Skip to content

Commit

Permalink
#37 added favorite notebook toggle to the notebook webview title/toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomFractals committed Aug 13, 2020
1 parent fdf2c96 commit 71be803
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions web/notebook.view.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
}
.label {
color: var(--vscode-editor-foreground);
text-decoration: none;
}
select {
color: var(--vscode-editor-foreground);
Expand Down Expand Up @@ -118,7 +119,10 @@
style="color: orangered; font-weight: bold"
onClick="buyCoffee()">☕️</a>
</div>
<div id="toolbar-left">
<div id="toolbar-left">
<a id="favorite-notebook-button" title="Favorite"
href="#" class="label"
onClick="toggleFavorite('{notebookUrl}')"></a>
<a id="title" title="View Notebook Source"
href="#"
onClick="viewNotebookSource('{notebookUrl}')">
Expand Down Expand Up @@ -149,7 +153,9 @@
<div id="notebook-view"></div>
<!-- notebook view init script -->
<script type="text/javascript">
let vscode, title, message, notebook,
let vscode, title,
message, notebook,
favoriteNotebookButton,
notebookUrlInput, saveFileTypeSelector,
notebookAuthor, notebookFileName, notebookUrl = '{notebookUrl}';

Expand Down Expand Up @@ -180,6 +186,7 @@
// initialize notebook view page elements
title = document.getElementById('title');
message = document.getElementById('message');
favoriteNotebookButton = document.getElementById('favorite-notebook-button');
notebookUrlInput = document.getElementById('notebook-url-input');
saveFileTypeSelector = document.getElementById('save-file-type-selector');
try {
Expand Down Expand Up @@ -228,6 +235,14 @@
console.log(`initializeNotebook: loading ${notebookUrl} ...`);
}

// toggle favorite notebook setting
function toggleFavorite(notebookUrl) {
vscode.postMessage({
command: 'toggleFavorite',
uri: notebookUrl
});
}

// view notebook source
function viewNotebookSource(notebookUrl) {
vscode.postMessage({
Expand Down

0 comments on commit 71be803

Please sign in to comment.