vzcode 0.50.0 → 0.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.html
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
href="https://unpkg.com/boxicons@2.0.7/css/boxicons.min.css"
|
|
25
25
|
rel="stylesheet"
|
|
26
26
|
/>
|
|
27
|
-
<script type="module" crossorigin src="/assets/index-
|
|
27
|
+
<script type="module" crossorigin src="/assets/index-yk4vJ5U-.js"></script>
|
|
28
28
|
<link rel="stylesheet" crossorigin href="/assets/index-jYtAJn79.css">
|
|
29
29
|
</head>
|
|
30
30
|
<body>
|
package/package.json
CHANGED
package/src/client/VZMiddle.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
1
|
+
import { useContext, useEffect, useState } from 'react';
|
|
2
2
|
import { SplitPaneResizeContext } from './SplitPaneResizeContext';
|
|
3
3
|
import { TabList } from './TabList';
|
|
4
4
|
import { CodeEditor } from './CodeEditor';
|
|
@@ -53,6 +53,13 @@ export const VZMiddle = ({
|
|
|
53
53
|
typeScriptWorker,
|
|
54
54
|
} = useContext(VZCodeContext);
|
|
55
55
|
|
|
56
|
+
// This prevents the CodeEditor from rendering
|
|
57
|
+
// during SSR.
|
|
58
|
+
const [isClient, setIsClient] = useState(false);
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
setIsClient(true);
|
|
61
|
+
}, []);
|
|
62
|
+
|
|
56
63
|
return activeFileId !== null ? (
|
|
57
64
|
<div
|
|
58
65
|
className="middle"
|
|
@@ -67,9 +74,7 @@ export const VZMiddle = ({
|
|
|
67
74
|
closeTabs={closeTabs}
|
|
68
75
|
createFile={createFile}
|
|
69
76
|
/>
|
|
70
|
-
{content &&
|
|
71
|
-
activeFileId &&
|
|
72
|
-
shareDBDoc.data.files[activeFileId] ? (
|
|
77
|
+
{isClient && content && activeFileId && (
|
|
73
78
|
<CodeEditor
|
|
74
79
|
shareDBDoc={shareDBDoc}
|
|
75
80
|
submitOperation={submitOperation}
|
|
@@ -85,8 +90,11 @@ export const VZMiddle = ({
|
|
|
85
90
|
username={username}
|
|
86
91
|
typeScriptWorker={typeScriptWorker}
|
|
87
92
|
/>
|
|
88
|
-
)
|
|
89
|
-
{
|
|
93
|
+
)}
|
|
94
|
+
{isClient &&
|
|
95
|
+
enableAIAssist &&
|
|
96
|
+
content &&
|
|
97
|
+
activeFileId ? (
|
|
90
98
|
<AIAssistWidget
|
|
91
99
|
activeFileId={activeFileId}
|
|
92
100
|
shareDBDoc={shareDBDoc}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { useNavigate } from 'react-router-dom';
|
|
2
|
-
import { TabState } from './vzReducer';
|
|
3
1
|
import { useEffect } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
useNavigate,
|
|
4
|
+
useSearchParams,
|
|
5
|
+
} from 'react-router-dom';
|
|
4
6
|
import { FileId } from '../types';
|
|
7
|
+
import { TabState } from './vzReducer';
|
|
5
8
|
|
|
6
9
|
export interface EditorTabsState {
|
|
7
10
|
// The ID of the file that is currently active.
|
|
@@ -47,9 +50,9 @@ export const decodeTabs = (
|
|
|
47
50
|
};
|
|
48
51
|
|
|
49
52
|
export const useInitialTabs = (): EditorTabsState => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
);
|
|
53
|
+
let [searchParams] = useSearchParams();
|
|
54
|
+
|
|
55
|
+
return decodeTabs(searchParams);
|
|
53
56
|
};
|
|
54
57
|
|
|
55
58
|
export const usePersistTabs = ({
|