aboutsummaryrefslogtreecommitdiff
path: root/apps/web/app/components/editor/plugins/soft-break-plugin.ts
blob: a5ed0d45d773580af376544bc7ef4a6ab6404d81 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
'use client';

import { BlockquotePlugin } from '@udecode/plate-block-quote/react';
import { SoftBreakPlugin } from '@udecode/plate-break/react';
import { CalloutPlugin } from '@udecode/plate-callout/react';
import { CodeBlockPlugin } from '@udecode/plate-code-block/react';
import {
  TableCellHeaderPlugin,
  TableCellPlugin,
} from '@udecode/plate-table/react';

export const softBreakPlugin = SoftBreakPlugin.configure({
  options: {
    rules: [
      { hotkey: 'shift+enter' },
      {
        hotkey: 'enter',
        query: {
          allow: [
            CodeBlockPlugin.key,
            BlockquotePlugin.key,
            TableCellPlugin.key,
            TableCellHeaderPlugin.key,
            CalloutPlugin.key,
          ],
        },
      },
    ],
  },
});