braid-text 0.5.13 → 0.5.15

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.
@@ -126,6 +126,7 @@ async function cursor_client(url, { peer, get_text, on_change, headers: custom_h
126
126
  headers: {
127
127
  ...custom_headers,
128
128
  'Content-Type': 'application/text-cursors+json',
129
+ 'Repr-Type': 'application/text-cursors+json',
129
130
  Peer: peer,
130
131
  'Content-Range': 'json [' + JSON.stringify(peer) + ']',
131
132
  },
@@ -86,7 +86,7 @@ function simpleton_client(url, {
86
86
  var channel = reliable_update_channel(url, {
87
87
  reconnect_from_parents: () => client_version.length ? client_version : null,
88
88
  get_headers: { ...headers, ...content_type && {Accept: content_type} },
89
- put_headers: { ...headers, ...content_type && {"Content-Type": content_type} },
89
+ put_headers: { ...headers, ...content_type && {"Content-Type": content_type, "Repr-Type": content_type} },
90
90
  on_update: async update => {
91
91
  update.parents.sort()
92
92
  if (pending_state === null && versions_eq(client_version, update.parents))
@@ -148,12 +148,11 @@ function text_prepare_put(patches, client_state) {
148
148
  // ── UI helpers ─────────────────────────────────────────────────────────
149
149
 
150
150
  function set_acked_state(textarea, on = true) {
151
- if (on)
152
- textarea.style.caretColor = textarea.old_caretColor
153
- else {
154
- textarea.old_caretColor = textarea.style.caretColor
155
- textarea.style.caretColor = 'red'
156
- }
151
+ // Save the normal caret color, if we haven't already
152
+ textarea.saved_caret_color ??= textarea.style.caretColor || ''
153
+
154
+ // Now update it
155
+ textarea.style.caretColor = on ? textarea.saved_caret_color : 'red'
157
156
  }
158
157
 
159
158
  function set_error_state(textarea, on = true) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "braid-text",
3
- "version": "0.5.13",
3
+ "version": "0.5.15",
4
4
  "description": "Library for collaborative text over http using braid.",
5
5
  "author": "Braid Working Group",
6
6
  "repository": "braid-org/braid-text",