vzcode 0.18.0 → 0.19.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
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
href="https://unpkg.com/bootstrap@5.3.0/dist/css/bootstrap.min.css"
|
|
29
29
|
rel="stylesheet"
|
|
30
30
|
/>
|
|
31
|
-
<script type="module" crossorigin src="/assets/index-
|
|
31
|
+
<script type="module" crossorigin src="/assets/index-34134182.js"></script>
|
|
32
32
|
<link rel="stylesheet" href="/assets/index-0053b846.css">
|
|
33
33
|
</head>
|
|
34
34
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vzcode",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "Multiplayer code editor system",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"react-bootstrap": "^2.8.0",
|
|
69
69
|
"react-dom": "^18.2.0",
|
|
70
70
|
"react-select": "^5.7.4",
|
|
71
|
-
"sharedb": "^4.0.
|
|
72
|
-
"sharedb-client-browser": "^4.3.
|
|
71
|
+
"sharedb": "^4.0.1",
|
|
72
|
+
"sharedb-client-browser": "^4.3.1",
|
|
73
73
|
"ot-json1": "^1.0.2",
|
|
74
74
|
"ws": "^8.13.0"
|
|
75
75
|
},
|
|
@@ -13,16 +13,30 @@ export const SplitPaneResizeContext = createContext<{
|
|
|
13
13
|
setIsDragging: (a: boolean) => void;
|
|
14
14
|
}>(null);
|
|
15
15
|
|
|
16
|
+
// The amount of time to wait idle before writing to localStorage.
|
|
17
|
+
// This is to avoid writing to localStorage on every resize event.
|
|
18
|
+
// MS = milliseconds
|
|
16
19
|
const localStorageWriteDebounceMS = 800;
|
|
17
20
|
|
|
18
21
|
const localStoragePropertyName = 'vizHubCodeEditorWidth';
|
|
19
|
-
|
|
20
|
-
localStoragePropertyName,
|
|
21
|
-
);
|
|
22
|
-
// const initialWidthPercentage = window.innerWidth / 3;
|
|
22
|
+
|
|
23
23
|
const initialWidthDefault = 220;
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
let initialWidth: number = initialWidthDefault;
|
|
25
|
+
|
|
26
|
+
// If we're in the browser,
|
|
27
|
+
if (typeof window !== 'undefined') {
|
|
28
|
+
//check localStorage for a previously stored width.
|
|
29
|
+
const initialWidthFromLocalStorage: string | null =
|
|
30
|
+
window.localStorage.getItem(localStoragePropertyName);
|
|
31
|
+
|
|
32
|
+
// If there is a previously stored width,
|
|
33
|
+
if (initialWidthFromLocalStorage !== null) {
|
|
34
|
+
// use it as the initial width.
|
|
35
|
+
initialWidth = +initialWidthFromLocalStorage;
|
|
36
|
+
}
|
|
37
|
+
} else {
|
|
38
|
+
// If we're not in the browser, use the default initial width.
|
|
39
|
+
}
|
|
26
40
|
|
|
27
41
|
const add = (a: number, b: number) => a + b;
|
|
28
42
|
|
|
@@ -36,7 +50,7 @@ export const SplitPaneResizeProvider = ({ children }) => {
|
|
|
36
50
|
useEffect(() => {
|
|
37
51
|
if (codeEditorWidth !== initialWidth) {
|
|
38
52
|
const timeout = setTimeout(() => {
|
|
39
|
-
localStorage.setItem(
|
|
53
|
+
window.localStorage.setItem(
|
|
40
54
|
localStoragePropertyName,
|
|
41
55
|
'' + codeEditorWidth,
|
|
42
56
|
);
|