Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
execute: () => {
if (searchInstance) {
searchInstance.focusInput();
return;
}
const provider = new NotebookSearchProvider();
searchInstance = new SearchInstance(nbWidget, provider);
searchInstance.disposed.connect(() => {
searchInstance = undefined;
// find next and previous are now not enabled
commands.notifyCommandChanged();
});
// find next and previous are now enabled
commands.notifyCommandChanged();
searchInstance.focusInput();
}
});
execute: () => {
const currentWidget = app.shell.currentWidget;
if (!currentWidget) {
return;
}
const widgetId = currentWidget.id;
let searchInstance = activeSearches.get(widgetId);
if (!searchInstance) {
const searchProvider = registry.getProviderForWidget(currentWidget);
if (!searchProvider) {
return;
}
searchInstance = new SearchInstance(currentWidget, searchProvider);
activeSearches.set(widgetId, searchInstance);
// find next and previous are now enabled
app.commands.notifyCommandChanged();
searchInstance.disposed.connect(() => {
activeSearches.delete(widgetId);
// find next and previous are now not enabled
app.commands.notifyCommandChanged();
});
}
searchInstance.focusInput();
}
});
execute: () => {
const currentWidget = app.shell.currentWidget;
if (!currentWidget) {
return;
}
const widgetId = currentWidget.id;
let searchInstance = activeSearches.get(widgetId);
if (!searchInstance) {
const searchProvider = registry.getProviderForWidget(currentWidget);
if (!searchProvider) {
return;
}
searchInstance = new SearchInstance(currentWidget, searchProvider);
activeSearches.set(widgetId, searchInstance);
// find next and previous are now enabled
app.commands.notifyCommandChanged();
searchInstance.disposed.connect(() => {
activeSearches.delete(widgetId);
// find next and previous are now not enabled
app.commands.notifyCommandChanged();
});
}
searchInstance.focusInput();
}
});
execute: () => {
if (searchInstance) {
searchInstance.focusInput();
return;
}
const provider = new NotebookSearchProvider();
searchInstance = new SearchInstance(nbWidget, provider);
searchInstance.disposed.connect(() => {
searchInstance = undefined;
// find next and previous are now not enabled
commands.notifyCommandChanged();
});
// find next and previous are now enabled
commands.notifyCommandChanged();
searchInstance.focusInput();
}
});