aboutsummaryrefslogtreecommitdiff
path: root/apps/web/app/components/editor/plugins/soft-break-plugin.ts
diff options
context:
space:
mode:
Diffstat (limited to 'apps/web/app/components/editor/plugins/soft-break-plugin.ts')
-rw-r--r--apps/web/app/components/editor/plugins/soft-break-plugin.ts30
1 files changed, 30 insertions, 0 deletions
diff --git a/apps/web/app/components/editor/plugins/soft-break-plugin.ts b/apps/web/app/components/editor/plugins/soft-break-plugin.ts
new file mode 100644
index 00000000..a5ed0d45
--- /dev/null
+++ b/apps/web/app/components/editor/plugins/soft-break-plugin.ts
@@ -0,0 +1,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,
+ ],
+ },
+ },
+ ],
+ },
+});