Module dnd

Module dnd 

Source
Expand description

Drag-and-drop operations: moving/promoting/tearing-off blocks and tabs.

Functions§

move_block_to_tab
Move a block from one tab to another. Removes the block from source_tab_id.blockids and adds it to dest_tab_id.blockids. Updates block.parentoref to point to the destination tab. If auto_close_source is true, deletes the source tab when it becomes empty (only if the workspace has other tabs).
move_tab_to_workspace
Move a tab from one workspace to another. Removes the tab from the source workspace’s tabids/pinnedtabids and adds it to the destination workspace’s tabids at the specified index. The tab is always added as unpinned in the destination. If the tab was the active tab in the source workspace, a new active tab is chosen.
promote_block_to_tab
Promote a block to a new tab. Removes the block from source_tab_id, creates a new tab in ws_id, and adds the block to the new tab. Returns the new Tab. If auto_close_source is true, deletes the source tab when it becomes empty.
restore_torn_off_tab
Move a tab back from a tear-off workspace into a destination workspace. Unlike move_tab_to_workspace, this skips the “last tab” guard because tear-off workspaces always contain exactly one tab — and after the move the source workspace has zero tabs and is deleted.
tear_off_block
Tear off a block into a new workspace. Removes the block from source_tab_id, creates a new workspace with a single tab containing the block. Returns the new workspace. If auto_close_source is true, deletes the source tab when it becomes empty.
tear_off_tab
Tear off a tab into a new workspace. Removes the tab from the source workspace and creates a new workspace containing just that tab. Returns the new workspace. The source workspace must have more than one tab.