vzcode 1.4.0 → 1.5.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-wJsFLYuD.js"></script>
23
+ <script type="module" crossorigin src="/assets/index-D6aZiqme.js"></script>
24
24
  <link rel="stylesheet" crossorigin href="/assets/index-ClPo_hzs.css">
25
25
  </head>
26
26
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vzcode",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Multiplayer code editor system",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",
@@ -8,6 +8,12 @@ import { Annotation, RangeSet } from '@codemirror/state';
8
8
  import ColorHash from 'color-hash';
9
9
  import { Username } from '../../types';
10
10
 
11
+ const debug = false;
12
+
13
+ // TODO: Make this a setting in the UI.
14
+ // See https://github.com/vizhub-core/vzcode/issues/739
15
+ const enableAutoFollow = false;
16
+
11
17
  // Deals with receiving the broadcasted presence cursor locations
12
18
  // from other clients and displaying them.
13
19
  //
@@ -46,11 +52,12 @@ export const json1PresenceDisplay = ({
46
52
  });
47
53
  // Receive remote presence changes.
48
54
  docPresence.on('receive', (id, presence) => {
49
- if (debug)
55
+ if (debug) {
50
56
  console.log(
51
57
  `Received presence for id ${id}`,
52
58
  presence,
53
59
  ); // Debug statement
60
+ }
54
61
  // If presence === null, the user has disconnected / exited
55
62
  // We also check if the presence is for the current file or not.
56
63
  if (presence && pathMatches(path, presence)) {
@@ -136,8 +143,12 @@ export const json1PresenceDisplay = ({
136
143
  annotations: [presenceAnnotation.of(true)],
137
144
  });
138
145
  }, 0);
139
- //call to scroll to the cursor of the other user
140
- this.scrollToCursor(view);
146
+
147
+ // Auto-follow all users when their presence is broadcast
148
+ // by scrolling them into view.
149
+ if (enableAutoFollow) {
150
+ this.scrollToCursor(view);
151
+ }
141
152
  });
142
153
  }
143
154
  // Method to scroll the view to keep the cursor in view