vzcode 1.8.0 → 1.9.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
@@ -20,7 +20,7 @@
20
20
  href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap"
21
21
  rel="stylesheet"
22
22
  />
23
- <script type="module" crossorigin src="/assets/index-CU0jqXHm.js"></script>
23
+ <script type="module" crossorigin src="/assets/index-BRLn2sA_.js"></script>
24
24
  <link rel="stylesheet" crossorigin href="/assets/index-BKRpkJER.css">
25
25
  </head>
26
26
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vzcode",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "Multiplayer code editor system",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",
@@ -14,7 +14,7 @@
14
14
  "test-interactive": "cd test/sampleDirectories/kitchenSink && node ../../../src/server/index.js",
15
15
  "prettier": "prettier {*.*,**/*.*} --write",
16
16
  "tsc": "tsc --noEmit",
17
- "dev": "EDITOR_PORT=5173 concurrently \"npm run test-interactive\" \"vite\"",
17
+ "dev": "set EDITOR_PORT=5173 && concurrently \"npm run test-interactive\" \"vite\"",
18
18
  "build": "vite build",
19
19
  "build-release": "vite build --mode release",
20
20
  "preview": "concurrently \"npm run test-interactive\" \"vite preview\"",
@@ -4,6 +4,7 @@ import { syntaxTree } from '@codemirror/language';
4
4
  import { SyntaxNode, SyntaxNodeRef } from '@lezer/common';
5
5
  import { EditorView } from '@codemirror/view';
6
6
  import { EditorState } from '@codemirror/state';
7
+ import { FileId } from '../types';
7
8
 
8
9
  /*
9
10
  The following is a helpful resource for the following Code Mirror Syntax Tree methods below
@@ -170,6 +171,17 @@ export const useKeyboardShortcuts = ({
170
171
  sidebarRef,
171
172
  editorCache,
172
173
  codeEditorRef,
174
+ }: {
175
+ closeTabs: (fileIds: FileId[]) => void;
176
+ activeFileId: FileId | null;
177
+ handleOpenCreateFileModal: () => void;
178
+ setActiveFileLeft: () => void;
179
+ setActiveFileRight: () => void;
180
+ runPrettierRef: React.MutableRefObject<() => void>;
181
+ runCodeRef: React.MutableRefObject<() => void>;
182
+ sidebarRef: React.RefObject<HTMLDivElement>;
183
+ editorCache: Map<string, { editor: EditorView }>;
184
+ codeEditorRef: React.RefObject<HTMLDivElement>;
173
185
  }) => {
174
186
  useEffect(() => {
175
187
  const handleKeyPress = (event: KeyboardEvent) => {
@@ -205,7 +217,9 @@ export const useKeyboardShortcuts = ({
205
217
  // TODO clean this up so we can remove `activeFileId`
206
218
  // as a dependency
207
219
  // TODO closeActiveTab()
208
- closeTabs([activeFileId]);
220
+ if (activeFileId) {
221
+ closeTabs([activeFileId]);
222
+ }
209
223
  return;
210
224
  }
211
225
 
@@ -261,7 +275,8 @@ export const useKeyboardShortcuts = ({
261
275
  const jumpToDefinitionHandler = (
262
276
  event: MouseEvent,
263
277
  ): void => {
264
- // Ensure the current destination node is defined and current cursor position matches highlighted element
278
+ // Ensure the current destination node is defined
279
+ // and current cursor position matches highlighted element
265
280
  if (
266
281
  !definingNode ||
267
282
  (event.target as HTMLSpanElement) !==
@@ -270,6 +285,11 @@ export const useKeyboardShortcuts = ({
270
285
  return;
271
286
  }
272
287
 
288
+ // Don't crash if no active file
289
+ if (!activeFileId) {
290
+ return;
291
+ }
292
+
273
293
  // Move current cursor and center view in the editor to destination node
274
294
  const editor: EditorView =
275
295
  editorCache.get(activeFileId).editor;
@@ -300,6 +320,10 @@ export const useKeyboardShortcuts = ({
300
320
  };
301
321
 
302
322
  const handleMouseOver = (event: MouseEvent) => {
323
+ if (!activeFileId) {
324
+ return;
325
+ }
326
+
303
327
  const editor: EditorView =
304
328
  editorCache.get(activeFileId).editor;
305
329
  const tree = syntaxTree(editor.state);
@@ -18,4 +18,5 @@ export const createInitialState = ({
18
18
  isDocOpen: false,
19
19
  editorWantsFocus: false,
20
20
  username: initialUsername,
21
+ enableAutoFollow: false,
21
22
  });