braid-text 0.2.53 → 0.2.55

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/editor.html CHANGED
@@ -16,11 +16,15 @@
16
16
  texty.disabled = true
17
17
  texty.style.background = '#fee'
18
18
  texty.style.border = '4px solid red'
19
- }
19
+ },
20
+ on_ack: () => texty.style.caretColor = ''
20
21
  });
21
22
 
22
23
  texty.value = "";
23
- texty.oninput = (e) => simpleton.changed();
24
+ texty.oninput = (e) => {
25
+ texty.style.caretColor = 'red'
26
+ simpleton.changed();
27
+ }
24
28
 
25
29
  function diff(before, after) {
26
30
  let diff = diff_main(before, after);
@@ -39,7 +39,9 @@ var simpleton = simpleton_client(location.pathname, {
39
39
  t().disabled = true
40
40
  t().style.background = '#fee'
41
41
  t().style.border = '4px solid red'
42
- }
42
+ },
43
+
44
+ on_ack: () => t().style.caretColor = ''
43
45
  });
44
46
 
45
47
  window.statebus_ready || (window.statebus_ready = []);
@@ -178,6 +180,7 @@ dom.WIKI = function() {
178
180
  }
179
181
  // Bail on edits that try to wipe us out
180
182
  state.source = e.target.value;
183
+ e.target.style.caretColor = 'red'
181
184
  simpleton.changed();
182
185
  return update_markdown_later();
183
186
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "braid-text",
3
- "version": "0.2.53",
3
+ "version": "0.2.55",
4
4
  "description": "Library for collaborative text over http using braid.",
5
5
  "author": "Braid Working Group",
6
6
  "repository": "braid-org/braid-text",
@@ -45,7 +45,8 @@ function simpleton_client(url, {
45
45
  generate_local_diff_update, // DEPRECATED
46
46
  content_type,
47
47
  on_error,
48
- on_res
48
+ on_res,
49
+ on_ack
49
50
  }) {
50
51
  var peer = Math.random().toString(36).substr(2)
51
52
  var current_version = []
@@ -115,8 +116,12 @@ function simpleton_client(url, {
115
116
  if (update.extra_headers &&
116
117
  update.extra_headers["repr-digest"] &&
117
118
  update.extra_headers["repr-digest"].startsWith('sha-256=') &&
118
- update.extra_headers["repr-digest"] !== await get_digest(prev_state))
119
+ update.extra_headers["repr-digest"] !== await get_digest(prev_state)) {
120
+ console.log('repr-digest mismatch!')
121
+ console.log('repr-digest: ' + update.extra_headers["repr-digest"])
122
+ console.log('state: ' + prev_state)
119
123
  throw new Error('repr-digest mismatch')
124
+ }
120
125
 
121
126
  if (on_state) on_state(prev_state)
122
127
  }
@@ -190,6 +195,7 @@ function simpleton_client(url, {
190
195
  throw e
191
196
  }
192
197
  outstanding_changes--
198
+ if (on_ack && !outstanding_changes) on_ack()
193
199
  }
194
200
  }
195
201
  }