Skip to content

@sqlrooms/documents / useSelectedBlockOrPanel

Function: useSelectedBlockOrPanel()

useSelectedBlockOrPanel(editor): SelectedItem

Hook that returns the currently selected block or panel.

Priority order:

  1. Panel selection from blockSelection store (custom selection)
  2. Block selection from TipTap editor state (node selection)
  3. null if neither is selected

Parameters

ParameterTypeDescription
editorEditor | nullTipTap editor instance

Returns

SelectedItem

Selected block/panel info or null