File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed
packages/tiptap/src/transcript Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -126,3 +126,34 @@ export const WordSplit = Extension.create({
126
126
] ;
127
127
} ,
128
128
} ) ;
129
+
130
+ export const SpeakerSplit = Extension . create ( {
131
+ name : "speakerSplit" ,
132
+
133
+ addProseMirrorPlugins ( ) {
134
+ return [
135
+ new Plugin ( {
136
+ key : new PluginKey ( "hypr-speaker-split" ) ,
137
+ props : {
138
+ handleKeyDown ( view , event ) {
139
+ if (
140
+ event . key === "Enter"
141
+ && ! event . ctrlKey
142
+ && ! event . metaKey
143
+ && ! event . altKey
144
+ ) {
145
+ const { state } = view ;
146
+ const { selection } = state ;
147
+
148
+ if ( ! selection . empty ) {
149
+ return false ;
150
+ }
151
+ }
152
+
153
+ return false ;
154
+ } ,
155
+ } ,
156
+ } ) ,
157
+ ] ;
158
+ } ,
159
+ } ) ;
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import Text from "@tiptap/extension-text";
5
5
import { EditorContent , useEditor } from "@tiptap/react" ;
6
6
import { forwardRef , useEffect } from "react" ;
7
7
8
- import { WordSplit } from "./extensions" ;
8
+ import { SpeakerSplit , WordSplit } from "./extensions" ;
9
9
import { SpeakerNode , WordNode } from "./nodes" ;
10
10
11
11
import "../styles/transcript.css" ;
@@ -17,6 +17,7 @@ export const extensions = [
17
17
SpeakerNode ,
18
18
WordNode ,
19
19
WordSplit ,
20
+ SpeakerSplit ,
20
21
] ;
21
22
22
23
interface TranscriptEditorProps {
You can’t perform that action at this time.
0 commit comments