@@ -11,39 +11,39 @@ export default (fugue: Fugue, { socket }: Communication): InputDomainOperations
11
11
function insertCharacter ( char : string , cursor : Cursor , styles : InlineStyle [ ] = [ ] ) {
12
12
if ( char . length !== 1 ) throw new Error ( 'Invalid character' ) ;
13
13
const operations = fugue . insertLocal ( cursor , nodeInsert ( char , styles ) ) ;
14
- socket . emit ( 'operation ' , operations ) ;
14
+ socket . emit ( 'operations ' , operations ) ;
15
15
}
16
16
17
17
function insertLineBreak ( cursor : Cursor ) {
18
18
const operations = fugue . insertLocal ( cursor , '\n' ) ;
19
19
const styleOperation = fugue . updateBlockStyleLocal ( cursor . line + 1 , 'paragraph' , true ) ;
20
- socket . emit ( 'operation ' , [ styleOperation , ...operations ] ) ;
20
+ socket . emit ( 'operations ' , [ styleOperation , ...operations ] ) ;
21
21
}
22
22
23
23
function deleteCharacter ( cursor : Cursor ) {
24
24
// don't delete line if it's not a paragraph - this is to prevent deleting the block style & line simultaneously
25
25
if ( cursor . column === 0 && fugue . getBlockStyle ( cursor . line ) !== 'paragraph' ) return ;
26
26
const operations = fugue . deleteLocalByCursor ( cursor ) ;
27
- if ( operations ) socket . emit ( 'operation ' , operations ) ;
27
+ if ( operations ) socket . emit ( 'operations ' , operations ) ;
28
28
}
29
29
30
30
function deleteSelection ( selection : Selection ) {
31
31
const operations = fugue . deleteLocal ( selection ) ;
32
- socket . emit ( 'operation ' , operations ) ;
32
+ socket . emit ( 'operations ' , operations ) ;
33
33
}
34
34
35
35
function deleteWord ( cursor : Cursor , reverse : boolean ) {
36
36
const operations = fugue . deleteWordByCursor ( cursor , reverse ) ;
37
37
if ( ! operations ) return ;
38
- socket . emit ( 'operation ' , operations ) ;
38
+ socket . emit ( 'operations ' , operations ) ;
39
39
}
40
40
41
41
function pasteText ( start : Cursor , text : string ) {
42
42
const chars = text . split ( '' ) ;
43
43
const lineNodes = chars . filter ( char => char === '\n' ) ;
44
44
const insertOperations : Operation [ ] = fugue . insertLocal ( start , ...text ) ;
45
45
const styleOperations = lineNodes . map ( ( ) => fugue . updateBlockStyleLocal ( start . line + 1 , 'paragraph' , true ) ) ;
46
- socket . emit ( 'operation ' , [ ...styleOperations , ...insertOperations ] ) ;
46
+ socket . emit ( 'operations ' , [ ...styleOperations , ...insertOperations ] ) ;
47
47
}
48
48
49
49
function updateSelection ( range : BaseSelection , styles : InlineStyle [ ] ) {
0 commit comments