{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "exit-break-docs",
  "title": "Exit Break",
  "description": "Documentation for Exit Break",
  "files": [
    {
      "path": "../../content/docs/(plugins)/(functionality)/(utils)/exit-break.mdx",
      "content": "---\ntitle: Exit Break\n---\n\n<ComponentPreview name=\"exit-break-demo\" />\n\n<PackageInfo>\n\n## Features\n\n- Exit from nested block structures (like code blocks, tables, columns) using keyboard shortcuts.\n- Automatically determines the appropriate exit point based on block hierarchy.\n\n</PackageInfo>\n\n## Kit Usage\n\n<Steps>\n\n### Installation\n\nThe fastest way to add exit break functionality is with the `ExitBreakKit`, which includes pre-configured `ExitBreakPlugin` with keyboard shortcuts.\n\n<ComponentSource name=\"exit-break-kit\" />\n\n### Add Kit\n\n```tsx\nimport { createPlateEditor } from 'platejs/react';\nimport { ExitBreakKit } from '@/components/editor/plugins/exit-break-kit';\n\nconst editor = createPlateEditor({\n  plugins: [\n    // ...otherPlugins,\n    ...ExitBreakKit,\n  ],\n});\n```\n\n</Steps>\n\n## Manual Usage\n\n<Steps>\n\n### Add Plugin\n\n```tsx\nimport { ExitBreakPlugin } from 'platejs';\nimport { createPlateEditor } from 'platejs/react';\n\nconst editor = createPlateEditor({\n  plugins: [\n    // ...otherPlugins,\n    ExitBreakPlugin,\n  ],\n});\n```\n\n### Configure Plugin\n\n```tsx\nimport { ExitBreakPlugin } from 'platejs';\nimport { createPlateEditor } from 'platejs/react';\n\nconst editor = createPlateEditor({\n  plugins: [\n    // ...otherPlugins,\n    ExitBreakPlugin.configure({\n      shortcuts: {\n        insert: { keys: 'mod+enter' },\n        insertBefore: { keys: 'mod+shift+enter' },\n      },\n    }),\n  ],\n});\n```\n\n- `shortcuts.insert`: Defines a keyboard [shortcut](/docs/plugin-shortcuts) to exit and insert block after.\n- `shortcuts.insertBefore`: Defines a keyboard [shortcut](/docs/plugin-shortcuts) to exit and insert block before.\n\n</Steps>\n\n## Keyboard Shortcuts\n\n<KeyTable>\n  <KeyTableItem hotkey=\"Cmd + Enter\">\n    Exit the current block structure and insert a new block after.\n  </KeyTableItem>\n  <KeyTableItem hotkey=\"Cmd + Shift + Enter\">\n    Exit the current block structure and insert a new block before.\n  </KeyTableItem>\n</KeyTable>\n\n## Plugins\n\n### `ExitBreakPlugin`\n\nProvides transforms to exit nested block structures automatically. The plugin determines the appropriate exit point by finding the first ancestor that allows standard block siblings.\n\n<API name=\"ExitBreakPlugin\">\n<APIOptions>\n  <APIItem name=\"shortcuts\" type=\"object\" optional>\n    Keyboard shortcuts configuration.\n    <APISubList>\n      <APISubListItem parent=\"shortcuts\" name=\"insert\" type=\"Shortcut\" optional>\n        Shortcut to exit and insert block after.\n        - **Example:** `{ keys: 'mod+enter' }`\n      </APISubListItem>\n      <APISubListItem parent=\"shortcuts\" name=\"insertBefore\" type=\"Shortcut\" optional>\n        Shortcut to exit and insert block before.\n        - **Example:** `{ keys: 'mod+shift+enter' }`\n      </APISubListItem>\n    </APISubList>\n  </APIItem>\n</APIOptions>\n</API>\n\n## How Exit Break Works\n\nExit break uses the [`isStrictSiblings`](/docs/api/core/plate-plugin#isstrictsiblings) property to determine where to insert new blocks when exiting nested structures.\n\n### Exit Point Determination\n\nWhen you trigger exit break:\n\n1. Starts from the current text block (e.g., paragraph inside a table cell)\n2. Traverses up the document tree looking at each ancestor\n3. Finds the first ancestor with `isStrictSiblings: false`\n4. Inserts a new paragraph as a sibling to that ancestor\n\n### Examples\n\n**Code Block:**\n```tsx\n<codeblock>                              // ← Exit point (top-level block)\n  <codeline>code|</codeline>             // ← Starting position\n</codeblock>\n<p>|</p>                                 // ← New paragraph inserted here\n```\n\n**Table in Column (exits at table level):**\n```tsx\n// First exit\n<column_group>                           \n  <column>                               \n    <table>                              // ← Exit point (isStrictSiblings: false)\n      <tr>                               // isStrictSiblings: true\n        <td>                             // isStrictSiblings: true\n          <p>content|</p>                // ← Starting position\n        </td>\n      </tr>\n    </table>\n    <p>|</p>                             // ← New paragraph inserted here\n  </column>\n</column_group>\n\n// Second exit\n<column_group>                           // ← Exit point (isStrictSiblings: false)\n  <column>                               // isStrictSiblings: true\n    <table>                              \n      <tr>                               \n        <td>                             \n          <p>content</p>\n        </td>\n      </tr>\n    </table>\n    <p>|</p>                             // ← Starting position\n  </column>\n</column_group>\n<p>|</p>                                 // ← New paragraph inserted here\n```\n\n### Custom Plugin Configuration\n\nConfigure [`isStrictSiblings`](/docs/api/core/plate-plugin#isstrictsiblings) for custom plugins:\n\n```tsx\n// Table structure\nconst CustomTablePlugin = createSlatePlugin({\n  key: 'table',\n  node: {\n    isElement: true,\n    // isStrictSiblings: false (default) - allows paragraph siblings\n  },\n});\n\nconst CustomTableRowPlugin = createSlatePlugin({\n  key: 'tr',\n  node: {\n    isElement: true,\n    isStrictSiblings: true, // Only allows tr siblings\n  },\n});\n\nconst CustomTableCellPlugin = createSlatePlugin({\n  key: 'td',\n  node: {\n    isElement: true,\n    isStrictSiblings: true, // Only allows td/th siblings\n  },\n});\n",
      "type": "registry:file",
      "target": "content/docs/plate/(plugins)/(functionality)/(utils)/exit-break.mdx"
    }
  ],
  "type": "registry:file"
}