Skip to content

Commit dd69708

Browse files
committed
style: 💄 fix linter issues
1 parent 0b585fa commit dd69708

File tree

6 files changed

+29
-20
lines changed

6 files changed

+29
-20
lines changed

src/json-crdt-extensions/peritext/editor/Cursor.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ import type {Point} from '../rga/Point';
77
* Cursor is a slice that represents an explicitly highlighted place in the
88
* text to the user. The {@link Cursor} is a {@link Range}, it has a `start`
99
* {@link Point} and an `end` {@link Point}.
10-
*
10+
*
1111
* The {@link Cursor} can be a caret (collapsed cursor) or a selection (range
1212
* expanded cursor). The caret is said to be "collapsed", its `start` and `end`
1313
* {@link Point}s are the same. When the selection is said to be "expanded", its
1414
* `start` and `end` {@link Point}s are different.
15-
*
15+
*
1616
* The `start` {@link Point} is always the one that comes first in the text, it
1717
* is less then or equal to the `end` {@link Point} in the spatial (text) order.
18-
*
18+
*
1919
* An expanded selection cursor has a *focus* and an *anchor* side. The *focus*
2020
* side is the one that moves when the user presses the arrow keys. The *anchor*
2121
* side is the one that stays in place when the user presses the arrow keys. The

src/json-crdt-extensions/peritext/editor/Editor.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -672,11 +672,17 @@ export class Editor<T = string> implements Printable {
672672
const pending = this.pending.value;
673673
const pendingFormatted = {} as any;
674674
for (const [type, data] of pending) pendingFormatted[formatType(type)] = data;
675-
return 'Editor' + printTree(tab, [
676-
(tab) => 'cursors' + printTree(tab,
677-
[...this.cursors()].map((cursor) => (tab) => cursor.toString(tab)),
678-
),
679-
() => `pending ${stringify(pendingFormatted)}`
680-
]);
675+
return (
676+
'Editor' +
677+
printTree(tab, [
678+
(tab) =>
679+
'cursors' +
680+
printTree(
681+
tab,
682+
[...this.cursors()].map((cursor) => (tab) => cursor.toString(tab)),
683+
),
684+
() => `pending ${stringify(pendingFormatted)}`,
685+
])
686+
);
681687
}
682688
}

src/json-crdt-peritext-ui/plugins/cursor/RenderCaret.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,15 @@ export const RenderCaret: React.FC<RenderCaretProps> = ({italic, children}) => {
7474
return (
7575
<span className={blockClass}>
7676
{children}
77-
{score !== plugin.lastVisScore.value && <CaretScore score={score} delta={delta} onRender={() => {plugin.lastVisScore.value = score;}} />}
77+
{score !== plugin.lastVisScore.value && (
78+
<CaretScore
79+
score={score}
80+
delta={delta}
81+
onRender={() => {
82+
plugin.lastVisScore.value = score;
83+
}}
84+
/>
85+
)}
7886
<span className={innerClass} style={style} />
7987
</span>
8088
);

src/json-crdt-peritext-ui/plugins/cursor/RenderPeritext.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,5 @@ export const RenderPeritext: React.FC<RenderPeritextProps> = ({ctx, children}) =
5151
};
5252
}, [ctx?.dom, value]);
5353

54-
return (
55-
<context.Provider value={value}>
56-
{children}
57-
</context.Provider>
58-
);
54+
return <context.Provider value={value}>{children}</context.Provider>;
5955
};

src/json-crdt-peritext-ui/plugins/minimal/text.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as React from 'react';
1+
import type * as React from 'react';
22
import {CommonSliceType} from '../../../json-crdt-extensions';
33
import type {PeritextPlugin} from '../../react/types';
44
import type {InlineAttrStack} from '../../../json-crdt-extensions/peritext/block/Inline';

src/json-crdt-peritext-ui/react/types.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import type {PeritextSurfaceContextValue} from './context';
99
import type {Inline} from '../../json-crdt-extensions/peritext/block/Inline';
1010

1111
export interface PeritextPlugin {
12-
1312
// --------------------------------------------------- Block-level formatting
1413

1514
peritext?: (
@@ -28,7 +27,7 @@ export interface PeritextPlugin {
2827

2928
/**
3029
* Renders a custom view for the *caret* (collapsed cursor) in the editor.
31-
*
30+
*
3231
* Make sure that this component is treated as `{ display: inline }` by the
3332
* browser. Otherwise, it will break words, which will result in word
3433
* wrapping, and the layout will shift when the caret is moved.
@@ -46,7 +45,7 @@ export interface PeritextPlugin {
4645
* Renders a custom view for the *focus* edge of a selection
4746
* (range expanded cursor) in the editor. The focus edge of the selection is
4847
* the one that moves when the user presses the arrow keys.
49-
*
48+
*
5049
* Make sure that this component is treated as `{ display: inline }` by the
5150
* browser. Otherwise, it will break words, which will result in word
5251
* wrapping, and the layout will shift when the selection is moved.
@@ -64,7 +63,7 @@ export interface PeritextPlugin {
6463
* Renders a custom view for the *anchor* edge of a selection
6564
* (range expanded cursor) in the editor. The anchor edge of the selection is
6665
* the one that stays in place when the user presses the arrow keys.
67-
*
66+
*
6867
* Make sure that this component is treated as `{ display: inline }` by the
6968
* browser. Otherwise, it will break words, which will result in word
7069
* wrapping, and the layout will shift when the selection is moved.

0 commit comments

Comments
 (0)