braid-text 0.2.54 → 0.2.56

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/README.md CHANGED
@@ -165,7 +165,7 @@ var simpleton = simpleton_client(url, {
165
165
  })
166
166
  ```
167
167
 
168
- See [editor.html](https://github.com/braid-org/braid-text/blob/master/editor.html) for a complete example with CodeMirror integration.
168
+ See [editor.html](https://github.com/braid-org/braid-text/blob/master/editor.html) for a complete example.
169
169
 
170
170
  ## Client API
171
171
 
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.54",
3
+ "version": "0.2.56",
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 = []
@@ -194,6 +195,7 @@ function simpleton_client(url, {
194
195
  throw e
195
196
  }
196
197
  outstanding_changes--
198
+ if (on_ack && !outstanding_changes) on_ack()
197
199
  }
198
200
  }
199
201
  }