Skip to content

Commit 385ce80

Browse files
committed
style(json-crdt-peritext-ui): 💄 fix linter issues
1 parent 77bc14f commit 385ce80

File tree

5 files changed

+23
-36
lines changed

5 files changed

+23
-36
lines changed

src/json-crdt-peritext-ui/plugins/blocks/RenderBlock/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,28 +22,28 @@ export const RenderBlock: React.FC<RenderBlockProps> = (props) => {
2222
return <Blockquote {...props} />;
2323
}
2424
case CommonSliceType.h1: {
25-
return <h1>{children}</h1>
25+
return <h1>{children}</h1>;
2626
}
2727
case CommonSliceType.h2: {
28-
return <h2>{children}</h2>
28+
return <h2>{children}</h2>;
2929
}
3030
case CommonSliceType.h3: {
31-
return <h3>{children}</h3>
31+
return <h3>{children}</h3>;
3232
}
3333
case CommonSliceType.h4: {
34-
return <h4>{children}</h4>
34+
return <h4>{children}</h4>;
3535
}
3636
case CommonSliceType.h5: {
37-
return <h5>{children}</h5>
37+
return <h5>{children}</h5>;
3838
}
3939
case CommonSliceType.h6: {
40-
return <h6>{children}</h6>
40+
return <h6>{children}</h6>;
4141
}
4242
case CommonSliceType.title: {
43-
return <h1>{children}</h1>
43+
return <h1>{children}</h1>;
4444
}
4545
case CommonSliceType.subtitle: {
46-
return <h2>{children}</h2>
46+
return <h2>{children}</h2>;
4747
}
4848
default: {
4949
return <p style={{padding: '16px 0'}}>{children}</p>;

src/json-crdt-peritext-ui/plugins/toolbar/RenderFocus.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const RenderFocus: React.FC<RenderFocusProps> = ({children, cursor}) => {
4444

4545
let toolbarElement: React.ReactNode = null;
4646

47-
if (showInlineToolbarValue && !isScrubbing && (toolbar.txt.editor.mainCursor() === cursor))
47+
if (showInlineToolbarValue && !isScrubbing && toolbar.txt.editor.mainCursor() === cursor)
4848
toolbarElement = (
4949
<MoveToViewport>
5050
<CaretToolbar

src/json-crdt-peritext-ui/plugins/toolbar/state/index.tsx

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ export class ToolbarState implements UiLifeCycles {
369369
name: 'HTML',
370370
text: action + ' html',
371371
icon,
372-
right: iconHtml,
372+
right: iconHtml,
373373
onSelect: () => {
374374
et.buffer({...ctx.onBeforeAction?.(htmlAction, action), action, format: 'html'});
375375
},
@@ -462,7 +462,7 @@ export class ToolbarState implements UiLifeCycles {
462462
name: 'HTML',
463463
text: 'paste html',
464464
icon,
465-
right: iconHtml,
465+
right: iconHtml,
466466
onSelect: () => {
467467
et.buffer({...ctx.onBeforeAction?.(htmlAction, 'paste'), action: 'paste', format: 'html'});
468468
},
@@ -533,10 +533,7 @@ export class ToolbarState implements UiLifeCycles {
533533
et.buffer({...ctx.onBeforeAction?.(copyTextOnlyAction, 'copy'), action: 'copy', format: 'text'});
534534
},
535535
};
536-
const children: MenuItem[] = [
537-
copyAction,
538-
copyTextOnlyAction,
539-
];
536+
const children: MenuItem[] = [copyAction, copyTextOnlyAction];
540537
if (!ctx.hideStyleActions) {
541538
const copyStyleAction: MenuItem = {
542539
name: 'Copy style',
@@ -580,11 +577,7 @@ export class ToolbarState implements UiLifeCycles {
580577
name: 'Cut',
581578
icon: () => <Iconista width={16} height={16} set="tabler" icon="scissors" />,
582579
expand: 5,
583-
children: [
584-
cutAction,
585-
cutTextAction,
586-
this.copyAsMenu('cut', ctx),
587-
],
580+
children: [cutAction, cutTextAction, this.copyAsMenu('cut', ctx)],
588581
};
589582
};
590583

@@ -604,10 +597,7 @@ export class ToolbarState implements UiLifeCycles {
604597
et.buffer({...ctx.onBeforeAction?.(pasteTextAction, 'paste'), action: 'paste', format: 'text'});
605598
},
606599
};
607-
const children: MenuItem[] = [
608-
pasteAction,
609-
pasteTextAction,
610-
];
600+
const children: MenuItem[] = [pasteAction, pasteTextAction];
611601
if (!ctx.hideStyleActions) {
612602
const pasteStyleAction: MenuItem = {
613603
name: 'Paste style',
@@ -639,11 +629,7 @@ export class ToolbarState implements UiLifeCycles {
639629
icon: () => <Iconista width={16} height={16} set="lucide" icon="copy" />,
640630
expand: 0,
641631
sepBefore: true,
642-
children: [
643-
copyMenu,
644-
cutMenu,
645-
pasteMenu,
646-
],
632+
children: [copyMenu, cutMenu, pasteMenu],
647633
};
648634
};
649635

@@ -1504,24 +1490,24 @@ export class ToolbarState implements UiLifeCycles {
15041490
name: 'Select block',
15051491
icon: () => <Iconista width={16} height={16} set="bootstrap" icon="cursor-text" />,
15061492
onSelect: () => {
1507-
let start = block.start.clone();
1493+
const start = block.start.clone();
15081494
if (!start.isAbsStart()) start.step(1);
15091495
et.cursor({at: [start, block.end]});
15101496
},
15111497
},
15121498
this.clipboardMenu({
15131499
hideStyleActions: true,
15141500
onBeforeAction: (item, action) => {
1515-
let start = block.start.clone();
1516-
if (!start.isAbsStart() && (action === 'paste')) start.step(1);
1501+
const start = block.start.clone();
1502+
if (!start.isAbsStart() && action === 'paste') start.step(1);
15171503
return {
15181504
at: [start, block.end],
15191505
};
15201506
},
15211507
}),
15221508
],
15231509
},
1524-
1510+
15251511
secondBrain(),
15261512
],
15271513
};
@@ -1535,5 +1521,5 @@ export interface LeafBlockMenuCtx {
15351521

15361522
export interface ClipboardMenuCtx {
15371523
hideStyleActions?: boolean;
1538-
onBeforeAction?: (item: MenuItem, action: 'cut' | 'copy' | 'paste') => (void | Partial<BufferDetail>);
1524+
onBeforeAction?: (item: MenuItem, action: 'cut' | 'copy' | 'paste') => void | Partial<BufferDetail>;
15391525
}

src/json-crdt-peritext-ui/web/dom/CursorController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export class CursorController implements UiLifeCycles, Printable {
127127
ev.preventDefault();
128128
et.move([
129129
['anchor', 'word', -1],
130-
['focus', 'word', 1],
130+
['focus', 'word', 1],
131131
]);
132132
break;
133133
case 3:

src/json-crdt-peritext-ui/web/react/BlockView.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ export const BlockView: React.FC<BlockViewProps> = React.memo(
5151
const key = cursorEnd.end.key() + '-b';
5252
let element: React.ReactNode;
5353
if (cursorEnd.isEndFocused()) {
54-
if (cursorEnd.isCollapsed()) element = <CaretView key={key} italic={!!italic} point={cursorEnd.start} cursor={cursorEnd} />;
54+
if (cursorEnd.isCollapsed())
55+
element = <CaretView key={key} italic={!!italic} point={cursorEnd.start} cursor={cursorEnd} />;
5556
else
5657
element = (
5758
<FocusView

0 commit comments

Comments
 (0)