Skip to content

Commit

Permalink
Convert on double click
Browse files Browse the repository at this point in the history
Signed-off-by: Colin Grant <[email protected]>
  • Loading branch information
colin-grant-work committed May 27, 2021
1 parent cbec39f commit 0053b56
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/editor-preview/src/browser/editor-preview-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export class EditorPreviewManager extends EditorManager {
});
}
});

this.preferences.onPreferenceChanged(change => {
if (!change.newValue) {
this.currentPreview?.convertToNonPreview();
Expand All @@ -70,6 +71,8 @@ export class EditorPreviewManager extends EditorManager {
}
this.layoutIsSet = true;
});

document.addEventListener('dblclick', this.convertEditorOnDoubleClick.bind(this));
}

protected async doOpen(widget: EditorPreviewWidget, options?: EditorOpenerOptions): Promise<void> {
Expand Down Expand Up @@ -113,4 +116,11 @@ export class EditorPreviewManager extends EditorManager {
navigatableOptions.preview = !!options?.preview;
return navigatableOptions;
}

protected convertEditorOnDoubleClick(event: Event): void {
const widget = this.shell.findTargetedWidget(event);
if (widget === this.currentPreview) {
this.currentPreview?.convertToNonPreview();
}
}
}

0 comments on commit 0053b56

Please sign in to comment.