1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-11 18:24:43 +02:00

Show overlay window while editing note

This commit is contained in:
Laurent Cozic 2017-10-24 20:52:26 +01:00
parent 13b4f3f4ea
commit 47da5f24e9
3 changed files with 29 additions and 1 deletions

View File

@ -230,6 +230,30 @@ class AppGui {
this.rootWidget_.addChild(win1);
}
showModalOverlay(text) {
if (!this.widget('overlayWindow')) {
const textWidget = new TextWidget();
textWidget.hStretch = true;
textWidget.vStretch = true;
textWidget.text = 'testing';
textWidget.name = 'overlayText';
const win = new WindowWidget();
win.name = 'overlayWindow';
win.addChild(textWidget);
this.rootWidget_.addChild(win);
}
this.widget('overlayWindow').activate();
this.widget('overlayText').text = text;
}
hideModalOverlay() {
if (this.widget('overlayWindow')) this.widget('overlayWindow').hide();
this.widget('mainWindow').activate();
}
addCommandToConsole(cmd) {
this.stdout(chalk.cyan.bold('> ' + cmd));
}

View File

@ -419,6 +419,8 @@ class Application {
stdout: (text) => { console.info(text); },
fullScreen: (b=true) => {},
exit: () => {},
showModalOverlay: (text) => {},
hideModalOverlay: () => {},
};
}

View File

@ -74,8 +74,9 @@ class Command extends BaseCommand {
this.logger().info('Disabling fullscreen...');
this.stdout(_('Starting to edit note. Close the editor to get back to the prompt.'));
//this.stdout(_('Starting to edit note. Close the editor to get back to the prompt.'));
app().gui().showModalOverlay(_('Starting to edit note. Close the editor to get back to the prompt.'));
app().gui().forceRender();
const termState = app().gui().term().saveState();
@ -83,6 +84,7 @@ class Command extends BaseCommand {
spawnSync(editorPath, editorArgs, { stdio: 'inherit' });
app().gui().term().restoreState(termState);
app().gui().hideModalOverlay();
app().gui().forceRender();
// -------------------------------------------------------------------------