Closed isidorn closed 4 years ago
The issue here is that the Notebook Cell List is not a child of the Editor Part workbench.parts.editor.part.editor
@rebornix is there a special reason why the Notebook cell list does not respect the workbench HTML hierarchy.
Because it is not a child of the parts.editor
element this action here does not know that the editor part is focused and goes to the default - to focus the editor which is already focused.
@rebornix friendly ping Also @roblourens or @jrieken might have more details
@isidorn the notebook list view contains a webview, which will be destroyed when reparenting it so we have to render notebook list out of the grid view. That's why the notebook list view is not part of parts.editor
. Do you have any suggestion what we should do here to support F6?
@rebornix is there some service which can tell me if the focus is in the notebook?
we can probably check IEditorService
to check if the editor is notebook editor and then check if the active element is in the notebook editor's list view
for example
export function isActiveElementInNotebookEditor(editorService: IEditorService): boolean {
const activeEditorPane = editorService.activeEditorPane as unknown as { isNotebookEditor?: boolean } | undefined;
if (activeEditorPane?.isNotebookEditor) {
const control = editorService.activeEditorPane?.getControl() as INotebookEditor;
const activeElement = document.activeElement;
return isAncestor(activeElement, control.getOverflowContainerDomNode());
}
return false;
}
Went with @rebornix solution
fyi @bpasero if you have a good idea on a common way to get an HTML element of any editor (including custom editors). Could not find it, since getDomNode()
is only exposed by some eidtor types.
@isidorn what HTML element are you wanting to access specifically, the container of an editor?
@bpasero yeah, container should be fine.
@isidorn logically it should be a property on IEditorPane
imho, but the challenge is that this interface lives in common
and cannot reference HTMLElement
.
@bpasero yeah I was expecting it there. But I see the issue, thanks.
F6 can navigate you across the workbench parts. Pressing F6 when the focus is in a notebook cell has no effect
fyi @rebornix reported by @webczat