Full document, spreadsheet, slideshow, and diagram tooling
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 27 lines 631 B view raw
1/** 2 * Tab key behavior resolver for the docs editor. 3 * 4 * Pure function: given editor context, returns the action to take. 5 * This keeps the logic testable without requiring a TipTap instance. 6 */ 7import type { TabAction, TabContext } from './types.js'; 8 9/** 10 * Determine what Tab/Shift+Tab should do in the docs editor. 11 */ 12export function resolveTabAction({ isInList, isInCodeBlock, shiftKey }: TabContext): TabAction { 13 if (isInList) { 14 return shiftKey ? 'outdent' : 'indent'; 15 } 16 17 if (isInCodeBlock) { 18 return 'insertTab'; 19 } 20 21 // Normal paragraph 22 if (shiftKey) { 23 return 'noop'; 24 } 25 26 return 'insertTab'; 27}