Skip to content

Commit f3cd5e7

Browse files
generate and format
1 parent 903d10e commit f3cd5e7

File tree

9 files changed

+55
-42
lines changed

9 files changed

+55
-42
lines changed

typescript/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,12 @@ b7b30c1 : Make more typesafe
274274
You can choose a different version from the list or create new one. But bumpp is smart enough to use appropriate next version.
275275

276276
3. Verify and confirm
277-
4. Push commit and tag
277+
4. Push commit and tag
278278

279279
```
280280
git push --follow-tags
281281
```
282+
282283
5. The new tag will trigger a release on github actions.
283284
6. Go to github and create release using the new tag. Make sure you set the correct previous tag prefixed with `typescript-v`
284285

@@ -317,6 +318,7 @@ git push --follow-tags
317318
- [ ] validate page prop somehow. not clear how to do yet. we can't use the /schema because it's HUGE and also because it's outside of /typescript. Will need to think about this.
318319

319320
maybe do something like this?
321+
320322
```
321323
import type { Page } from "../models/generated/page/page";
322324
import { isPage } from "../models/generated/essential-types";
@@ -353,4 +355,4 @@ export function validatePageWithError(obj: unknown): {
353355

354356
will require us to write a validator and we won't benefit from the defined schema jsons.
355357

356-
- [ ] make error boundary catch errors in JsonDocRenderer.tsx body
358+
- [ ] make error boundary catch errors in JsonDocRenderer.tsx body

typescript/src/models/generated/block/types/equation/equation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { Block } from "../../block";
1+
import type { BlockBase } from "../../base";
22

3-
export type EquationBlock = Block & {
3+
export type EquationBlock = BlockBase & {
44
type: "equation";
55
equation: {
66
expression: string;

typescript/src/renderer/JsonDocRenderer.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,15 @@ export const JsonDocRenderer = ({
100100
);
101101

102102
return (
103-
<div className={`jsondoc-theme-${theme}`}>
103+
<div
104+
className={`jsondoc-theme-${theme}`}
105+
data-testid="jsondoc-renderer-root"
106+
>
104107
<GlobalErrorBoundary onError={onError}>
105108
<RendererProvider value={{ devMode, resolveImageUrl }}>
106-
<div className={`json-doc-renderer ${className}`}>
109+
<div
110+
className={`json-doc-renderer${className ? " " + className : ""}`}
111+
>
107112
{viewJson ? (
108113
<div className="flex h-screen">
109114
<JsonViewPanel data={page} />

typescript/src/renderer/components/blocks/EquationBlockRenderer.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ export const EquationBlockRenderer: React.FC<EquationBlockRendererProps> = ({
2323
katex.render(equationData.expression, containerRef.current, {
2424
displayMode: true,
2525
throwOnError: false,
26-
errorColor: '#cc0000',
27-
strict: 'warn'
26+
errorColor: "#cc0000",
27+
strict: "warn",
2828
});
2929
} catch (error) {
30-
console.warn('KaTeX render error:', error);
30+
console.warn("KaTeX render error:", error);
3131
if (containerRef.current) {
3232
containerRef.current.textContent = equationData.expression;
3333
}
@@ -43,10 +43,7 @@ export const EquationBlockRenderer: React.FC<EquationBlockRendererProps> = ({
4343
>
4444
<div>
4545
<div className="notion-equation-display">
46-
<div
47-
className="notion-equation-content"
48-
ref={containerRef}
49-
/>
46+
<div className="notion-equation-content" ref={containerRef} />
5047
</div>
5148
</div>
5249
</div>

typescript/src/renderer/components/blocks/ImageBlockRenderer.tsx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,11 @@ export const ImageBlockRenderer: React.FC<ImageBlockRendererProps> = ({
8989
}, [inView, imageUrl, resolveImageUrl]);
9090

9191
useEffect(() => {
92-
if (captionRef.current && imageData?.caption && imageData.caption.length > 0) {
92+
if (
93+
captionRef.current &&
94+
imageData?.caption &&
95+
imageData.caption.length > 0
96+
) {
9397
const element = captionRef.current;
9498
const isOverflowing = element.scrollHeight > element.clientHeight;
9599
setNeedsTruncation(isOverflowing);
@@ -149,14 +153,21 @@ export const ImageBlockRenderer: React.FC<ImageBlockRendererProps> = ({
149153
<span className="btn-text">
150154
{showFullCaption ? "Show less" : "Show more"}
151155
</span>
152-
<svg
153-
className={`btn-icon ${showFullCaption ? 'rotated' : ''}`}
154-
width="12"
155-
height="12"
156-
viewBox="0 0 12 12"
156+
<svg
157+
className={`btn-icon ${showFullCaption ? "rotated" : ""}`}
158+
width="12"
159+
height="12"
160+
viewBox="0 0 12 12"
157161
fill="currentColor"
158162
>
159-
<path d="M3 4.5L6 7.5L9 4.5" stroke="currentColor" strokeWidth="1.5" fill="none" strokeLinecap="round" strokeLinejoin="round"/>
163+
<path
164+
d="M3 4.5L6 7.5L9 4.5"
165+
stroke="currentColor"
166+
strokeWidth="1.5"
167+
fill="none"
168+
strokeLinecap="round"
169+
strokeLinejoin="round"
170+
/>
160171
</svg>
161172
</button>
162173
)}

typescript/src/renderer/components/blocks/ToDoBlockRenderer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const ToDoBlockRenderer: React.FC<ToDoBlockRendererProps> = ({
3030
<div className="pseudoHover pseudoActive">
3131
<input className="check" type="checkbox" checked={isChecked} readOnly />
3232
</div>
33-
<div className={`notranslate ${isChecked ? 'checked' : ''}`.trim()}>
33+
<div className={`notranslate ${isChecked ? "checked" : ""}`.trim()}>
3434
<RichTextRenderer richText={todoData?.rich_text || []} />
3535
</div>
3636

typescript/src/renderer/components/dev/DevOverlay.tsx

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export const DevOverlay: React.FC<DevOverlayProps> = ({
143143
try {
144144
await navigator.clipboard.writeText(JSON.stringify(block, null, 2));
145145
} catch (err) {
146-
console.error('Failed to copy to clipboard:', err);
146+
console.error("Failed to copy to clipboard:", err);
147147
}
148148
};
149149

@@ -233,27 +233,27 @@ export const DevOverlay: React.FC<DevOverlayProps> = ({
233233
fill="currentColor"
234234
style={{ opacity: 0.8 }}
235235
>
236-
<path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/>
236+
<path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z" />
237237
</svg>
238238
Copy
239239
</button>
240240
<button
241-
onClick={onClose}
242-
onMouseDown={(e) => e.stopPropagation()} // Prevent drag when clicking close button
243-
style={{
244-
background: "none",
245-
border: "none",
246-
color: "#ffffff",
247-
cursor: "pointer",
248-
fontSize: "16px",
249-
padding: "4px 8px",
250-
borderRadius: "4px",
251-
}}
252-
onMouseEnter={(e) => (e.currentTarget.style.background = "#333")}
253-
onMouseLeave={(e) => (e.currentTarget.style.background = "none")}
254-
>
255-
×
256-
</button>
241+
onClick={onClose}
242+
onMouseDown={(e) => e.stopPropagation()} // Prevent drag when clicking close button
243+
style={{
244+
background: "none",
245+
border: "none",
246+
color: "#ffffff",
247+
cursor: "pointer",
248+
fontSize: "16px",
249+
padding: "4px 8px",
250+
borderRadius: "4px",
251+
}}
252+
onMouseEnter={(e) => (e.currentTarget.style.background = "#333")}
253+
onMouseLeave={(e) => (e.currentTarget.style.background = "none")}
254+
>
255+
×
256+
</button>
257257
</div>
258258
</div>
259259
<pre

typescript/src/serialization/loader.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import {
1212
FileFile,
1313
ObjectType,
1414
Block,
15-
isPage,
16-
isBlock,
1715
ParagraphBlock,
1816
BulletedListItemBlock,
1917
NumberedListItemBlock,

typescript/tests/test-cases.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
- make sure all blocks are rendered
66
- make sure numbered lists are correctly labeled
77
- make sure bad page is gracefully handled
8-
- invalid block type should show error block UI
8+
- invalid block type should show error block UI

0 commit comments

Comments
 (0)