braid-text 0.2.58 → 0.2.60
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 +11 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -119,7 +119,7 @@ Here's a basic running example to start:
|
|
|
119
119
|
</script>
|
|
120
120
|
```
|
|
121
121
|
|
|
122
|
-
You should see
|
|
122
|
+
You should see some text in a box if you run this, and if you run it in another tab, you should be able to edit that text collaboratively.
|
|
123
123
|
|
|
124
124
|
### How It Works
|
|
125
125
|
|
|
@@ -135,6 +135,14 @@ This design prevents network congestion and handles disconnections gracefully. F
|
|
|
135
135
|
|
|
136
136
|
For better performance and control, you can work with patches instead of full text:
|
|
137
137
|
|
|
138
|
+
#### Patch Format
|
|
139
|
+
|
|
140
|
+
Each patch is an object with two properties:
|
|
141
|
+
- `range`: `[start, end]` - The range of characters to delete
|
|
142
|
+
- `content`: The text to insert at that position
|
|
143
|
+
|
|
144
|
+
Patches in an array each have positions which refer to the **original text** before any other patches are applied.
|
|
145
|
+
|
|
138
146
|
#### Receiving Patches
|
|
139
147
|
|
|
140
148
|
Instead of receiving complete text updates, you can process individual changes:
|
|
@@ -213,6 +221,8 @@ Creates a new Simpleton client that synchronizes with a Braid-Text server.
|
|
|
213
221
|
```
|
|
214
222
|
If not provided, uses a simple prefix/suffix diff algorithm.
|
|
215
223
|
|
|
224
|
+
**Note:** All patches must reference positions in the original text before any patches are applied.
|
|
225
|
+
|
|
216
226
|
#### Additional Options
|
|
217
227
|
|
|
218
228
|
- `content_type`: <small style="color:lightgrey">[optional]</small> MIME type for `Accept` and `Content-Type` headers
|