Skip to content

Commit

Permalink
refactor method options
Browse files Browse the repository at this point in the history
  • Loading branch information
mbektas committed Mar 17, 2024
1 parent 244f7fb commit b89d893
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/main/labview/labview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,9 @@ export class LabView implements IDisposable {

await this._view.webContents.executeJavaScript(`
{
jlabDesktop_setUIMode('${this._uiMode}', ${userSettings.getValue(
SettingType.showTOCInZenMode
)});
jlabDesktop_setUIMode('${this._uiMode}', {
showTOCInZenMode: ${userSettings.getValue(SettingType.showTOCInZenMode)}
});
}
`);
}
Expand Down Expand Up @@ -465,7 +465,7 @@ export class LabView implements IDisposable {
});
}
async function jlabDesktop_setUIMode(uiMode, showTOCInZenMode) {
async function jlabDesktop_setUIMode(uiMode, options) {
const lab = await jlabDesktop_getLab();
const labShell = lab.shell;
const statusBar = labShell.widgets('bottom').find(widget => widget.id === 'jp-main-statusbar');
Expand Down Expand Up @@ -520,7 +520,7 @@ export class LabView implements IDisposable {
statusBar.setHidden(true);
}
}
if (showTOCInZenMode) {
if (options?.showTOCInZenMode) {
labShell.activateById('table-of-contents');
}
}
Expand All @@ -529,9 +529,14 @@ export class LabView implements IDisposable {
jlabDesktop_getLab().then((lab) => {
${
setToSingleFileUIMode
? `jlabDesktop_setUIMode('${userSettings.getValue(
SettingType.uiModeForSingleFileOpen
)}', ${userSettings.getValue(SettingType.showTOCInZenMode)});`
? `jlabDesktop_setUIMode(
'${userSettings.getValue(
SettingType.uiModeForSingleFileOpen
)}', {
showTOCInZenMode: ${userSettings.getValue(
SettingType.showTOCInZenMode
)}
});`
: ''
}
lab.restored.then(() => {
Expand Down

0 comments on commit b89d893

Please sign in to comment.