Files
Tom Moor 49aee74190 feat: Add filtering to tables in the editor (#14625)
* feat: Add filtering to tables in the editor

* Show the column filter button on header hover in edit mode

* Keep the filter button shown while its menu is open

* Move focusEditor to its own module

* Anchor the filter menu to the filter button

* Address review feedback on table filtering

* Show the filter button background while its menu is open

* Always show the filter button background with its icon

* Remove value counts and hide Clear when there is no filter

* Translations

* placeholder
2026-11-18 22:37:15 -05:00

17 lines
504 B
TypeScript

import type { EditorView } from "prosemirror-view";
/**
* Focus the editor if focus is elsewhere, for controls such as the table grips
* that stay visible while focus is elsewhere. Focus in an open menu stays
* there, as moving it would close the menu.
*
* @param view The editor view.
*/
export function focusEditor(view: EditorView): void {
const { activeElement } = view.dom.ownerDocument;
if (view.hasFocus() || activeElement?.closest("[role='menu']")) {
return;
}
view.focus();
}