Skip to content

Commit 586b463

Browse files
committed
Run prettier
1 parent e00864a commit 586b463

18 files changed

Lines changed: 632 additions & 598 deletions

postcss.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ export default {
33
tailwindcss: {},
44
autoprefixer: {},
55
},
6-
}
6+
};

src/App.tsx

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -91,38 +91,45 @@ function App() {
9191
onSelectionUpdate({ editor }) {
9292
const { from, to } = editor.view.state.selection;
9393
setSelection(editor.view.state.doc.textBetween(from, to));
94-
}
94+
},
9595
});
9696

9797
const handleReferenceClicked = (reference: ReferenceItem) => {
98-
editor?.commands.insertContentAt(editor.state.selection.head, { type: ReferenceNode.name, attrs: { id: reference.id } });
99-
}
98+
editor?.commands.insertContentAt(editor.state.selection.head, {
99+
type: ReferenceNode.name,
100+
attrs: { id: reference.id },
101+
});
102+
};
100103

101104
return (
102105
<PanelGroup
103106
autoSaveId="ref-studio"
104107
direction="horizontal"
105108
style={{ height: '100vh' }}
106109
>
107-
<Panel defaultSize={20} style={{ padding: "0.75rem", overflow: 'scroll' }}>
110+
<Panel
111+
defaultSize={20}
112+
style={{ padding: '0.75rem', overflow: 'scroll' }}
113+
>
108114
<FoldersView />
109115
</Panel>
110116
<VerticalResizeHandle />
111117

112-
<Panel defaultSize={60} style={{ padding: "0.75rem", overflow: 'scroll' }}>
113-
{editor && <EditorView
114-
editor={editor}
115-
/>}
118+
<Panel
119+
defaultSize={60}
120+
style={{ padding: '0.75rem', overflow: 'scroll' }}
121+
>
122+
{editor && <EditorView editor={editor} />}
116123
</Panel>
117124

118125
<VerticalResizeHandle />
119126
<Panel>
120127
<PanelGroup direction="vertical">
121-
<Panel style={{ padding: "0.75rem", overflow: 'scroll' }}>
128+
<Panel style={{ padding: '0.75rem', overflow: 'scroll' }}>
122129
<ReferencesView onRefClicked={handleReferenceClicked} />
123130
</Panel>
124131
<HorizontalResizeHandle />
125-
<Panel style={{ padding: "0.75rem", overflow: 'scroll' }}>
132+
<Panel style={{ padding: '0.75rem', overflow: 'scroll' }}>
126133
<AIView selection={debouncedSelection} />
127134
</Panel>
128135
</PanelGroup>
@@ -132,15 +139,11 @@ function App() {
132139
}
133140

134141
function VerticalResizeHandle() {
135-
return (
136-
<PanelResizeHandle className="resizeHandle verticalHandle" />
137-
);
142+
return <PanelResizeHandle className="resizeHandle verticalHandle" />;
138143
}
139144

140145
function HorizontalResizeHandle() {
141-
return (
142-
<PanelResizeHandle className="resizeHandle horizontalHandle" />
143-
);
146+
return <PanelResizeHandle className="resizeHandle horizontalHandle" />;
144147
}
145148

146149
export default App;

src/CollapsibleBlock/CollapsibleBlock.tsx

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,41 @@ import './styles.css';
55

66
// The attributes in this interface must correspond to the attributes defined in the `addAttributes` method of CollapsibleBlockNode
77
export interface CollapsibleBlockProps {
8-
updateAttributes: (attributes: CollapsibleBlockNodeAttributes) => void
9-
node: Node & { attrs: CollapsibleBlockNodeAttributes }
8+
updateAttributes: (attributes: CollapsibleBlockNodeAttributes) => void;
9+
node: Node & { attrs: CollapsibleBlockNodeAttributes };
1010
}
1111

1212
export const CollapsibleBlock = (props: CollapsibleBlockProps) => {
13-
const handleButtonClick = () => {
14-
props.updateAttributes({
15-
folded: !props.node.attrs.folded,
16-
});
17-
};
18-
return (
19-
<NodeViewWrapper>
20-
<div className='draggable-item collapsible-block' style={{ display: 'flex', flexDirection: 'row', alignItems: 'flex-start' }}>
21-
<div
22-
className="drag-handle"
23-
contentEditable="false"
24-
draggable="true"
25-
data-drag-handle
26-
/>
27-
<button className={props.node.attrs.folded ? '' : 'open'} onClick={handleButtonClick} />
13+
const handleButtonClick = () => {
14+
props.updateAttributes({
15+
folded: !props.node.attrs.folded,
16+
});
17+
};
18+
return (
19+
<NodeViewWrapper>
20+
<div
21+
className="draggable-item collapsible-block"
22+
style={{
23+
display: 'flex',
24+
flexDirection: 'row',
25+
alignItems: 'flex-start',
26+
}}
27+
>
28+
<div
29+
className="drag-handle"
30+
contentEditable="false"
31+
draggable="true"
32+
data-drag-handle
33+
/>
34+
<button
35+
className={props.node.attrs.folded ? '' : 'open'}
36+
onClick={handleButtonClick}
37+
/>
2838

29-
<NodeViewContent className={`content ${props.node.attrs.folded ? "folded" : ""}`} />
30-
</div>
31-
</NodeViewWrapper>
32-
)
33-
}
39+
<NodeViewContent
40+
className={`content ${props.node.attrs.folded ? 'folded' : ''}`}
41+
/>
42+
</div>
43+
</NodeViewWrapper>
44+
);
45+
};
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { mergeAttributes, Node } from "@tiptap/core";
1+
import { mergeAttributes, Node } from '@tiptap/core';
22

33
export const CollapsibleBlockContentNode = Node.create({
4-
name: "collapsibleContent",
5-
group: "block",
6-
content: "block+",
4+
name: 'collapsibleContent',
5+
group: 'block',
6+
content: 'block+',
77

88
parseHTML() {
99
return [
@@ -16,4 +16,4 @@ export const CollapsibleBlockContentNode = Node.create({
1616
renderHTML({ HTMLAttributes }) {
1717
return ['collapsible-content', mergeAttributes(HTMLAttributes), 0];
1818
},
19-
});
19+
});

src/CollapsibleBlock/nodes/CollapsibleBlockNode.ts

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ReactNodeViewRenderer } from '@tiptap/react';
33
import { CollapsibleBlock } from '../CollapsibleBlock';
44

55
export interface CollapsibleBlockNodeAttributes {
6-
folded: boolean
6+
folded: boolean;
77
}
88

99
export const CollapsibleBlockNode = Node.create<{}, {}>({
@@ -12,37 +12,47 @@ export const CollapsibleBlockNode = Node.create<{}, {}>({
1212
group: 'block',
1313

1414
content: 'collapsibleSummary collapsibleContent',
15-
draggable:true,
15+
draggable: true,
1616

1717
parseHTML() {
1818
return [
1919
{
2020
tag: 'collapsible-block',
2121
},
22-
]
22+
];
2323
},
2424

2525
addKeyboardShortcuts() {
2626
return {
2727
'Mod-Enter': () => {
28-
return this.editor.chain().insertContentAt(this.editor.state.selection.head, { type: this.type.name }).focus().run()
28+
return this.editor
29+
.chain()
30+
.insertContentAt(this.editor.state.selection.head, {
31+
type: this.type.name,
32+
})
33+
.focus()
34+
.run();
2935
},
30-
}
36+
};
3137
},
3238

3339
renderHTML({ HTMLAttributes }) {
34-
return ['collapsible-block', mergeAttributes(HTMLAttributes), 0]
40+
return ['collapsible-block', mergeAttributes(HTMLAttributes), 0];
3541
},
3642

37-
addAttributes(): {[K in keyof CollapsibleBlockNodeAttributes]: { default: CollapsibleBlockNodeAttributes[K] }} {
43+
addAttributes(): {
44+
[K in keyof CollapsibleBlockNodeAttributes]: {
45+
default: CollapsibleBlockNodeAttributes[K];
46+
};
47+
} {
3848
return {
3949
folded: {
4050
default: true,
41-
}
42-
}
51+
},
52+
};
4353
},
4454

4555
addNodeView() {
46-
return ReactNodeViewRenderer(CollapsibleBlock)
56+
return ReactNodeViewRenderer(CollapsibleBlock);
4757
},
48-
})
58+
});

src/CollapsibleBlock/nodes/CollapsibleBlockSummary.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ export const CollapsibleBlockSummaryNode = Node.create({
1212
{
1313
tag: 'collapsible-summary',
1414
},
15-
]
15+
];
1616
},
1717

1818
renderHTML({ HTMLAttributes }) {
1919
return ['collapsible-summary', mergeAttributes(HTMLAttributes), 0];
2020
},
21-
})
21+
});

src/CollapsibleBlock/styles.css

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
/* Basic editor styles */
22
.ProseMirror {
3-
> * + * {
4-
margin-top: 0.75em;
5-
}
3+
> * + * {
4+
margin-top: 0.75em;
65
}
6+
}
77

88
.draggable-item {
99
display: flex;
1010
padding: 0.5rem;
1111
margin: 0.5rem 0;
1212
border-radius: 0.5rem;
1313
background: white;
14-
box-shadow:
15-
0 0 0 1px rgba(0, 0, 0, 0.05),
16-
0px 10px 20px rgba(0, 0, 0, 0.1),
17-
;
14+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05), 0px 10px 20px rgba(0, 0, 0, 0.1);
1815
border: gray;
1916
}
2017

@@ -32,32 +29,32 @@
3229
}
3330

3431
.collapsible-block {
35-
display: flex;
36-
margin: 1rem 0;
37-
border: 1px solid black;
38-
border-radius: 0.5rem;
39-
padding: 0.5rem;
32+
display: flex;
33+
margin: 1rem 0;
34+
border: 1px solid black;
35+
border-radius: 0.5rem;
36+
padding: 0.5rem;
4037
}
4138

42-
.collapsible-block>button {
39+
.collapsible-block > button {
4340
display: flex;
4441
cursor: pointer;
4542
background: transparent;
4643
border: none;
4744
padding: 0;
4845
}
4946

50-
.collapsible-block>button:before {
51-
content: "\25b6";
52-
display: flex;
53-
justify-content: center;
54-
align-items: center;
55-
width: 1.5em;
56-
height: 1.5em;
47+
.collapsible-block > button:before {
48+
content: '\25b6';
49+
display: flex;
50+
justify-content: center;
51+
align-items: center;
52+
width: 1.5em;
53+
height: 1.5em;
5754
}
5855

59-
.collapsible-block>button.open:before{
60-
content: "\25bc";
56+
.collapsible-block > button.open:before {
57+
content: '\25bc';
6158
}
6259

6360
.collapsible-block .content {
@@ -76,4 +73,4 @@
7673

7774
.folded collapsible-content {
7875
display: none;
79-
}
76+
}

src/Reference/ReferenceNode.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import Mention from "@tiptap/extension-mention";
2-
import { suggestion } from "./suggestion";
1+
import Mention from '@tiptap/extension-mention';
2+
import { suggestion } from './suggestion';
33

44
export const ReferenceNode = Mention.configure({
5-
HTMLAttributes: {
6-
class: 'reference',
7-
},
8-
renderLabel({node}) {
9-
return `[${node.attrs.label ?? node.attrs.id}]`;
10-
},
11-
suggestion,
12-
});
5+
HTMLAttributes: {
6+
class: 'reference',
7+
},
8+
renderLabel({ node }) {
9+
return `[${node.attrs.label ?? node.attrs.id}]`;
10+
},
11+
suggestion,
12+
});

src/Reference/ReferencesList.css

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
.items {
2-
background: #fff;
3-
border-radius: 0.5rem;
4-
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05), 0px 10px 20px rgba(0, 0, 0, 0.1);
5-
color: rgba(0, 0, 0, 0.8);
6-
font-size: 0.9rem;
7-
overflow: hidden;
8-
padding: 0.2rem;
9-
position: relative;
2+
background: #fff;
3+
border-radius: 0.5rem;
4+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05), 0px 10px 20px rgba(0, 0, 0, 0.1);
5+
color: rgba(0, 0, 0, 0.8);
6+
font-size: 0.9rem;
7+
overflow: hidden;
8+
padding: 0.2rem;
9+
position: relative;
1010
}
11-
11+
1212
.item {
13-
background: transparent;
14-
border: 1px solid transparent;
15-
border-radius: 0.4rem;
16-
display: block;
17-
margin: 0;
18-
padding: 0.2rem 0.4rem;
19-
text-align: left;
20-
width: 100%;
21-
}
13+
background: transparent;
14+
border: 1px solid transparent;
15+
border-radius: 0.4rem;
16+
display: block;
17+
margin: 0;
18+
padding: 0.2rem 0.4rem;
19+
text-align: left;
20+
width: 100%;
21+
}
2222

2323
.is-selected {
24-
border-color: #000;
25-
}
24+
border-color: #000;
25+
}

0 commit comments

Comments
 (0)