Skip to content

Commit

Permalink
Add protocol notes (#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
newsch authored Aug 21, 2023
1 parent 388255d commit ea0ebe0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions PROTOCOL.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,23 @@ following properties:
| Property | Value | Description |
| ------------ | ---------------------- | ---------------------------------------------------------------------------------------------- |
| `title` | String | The title of the document |
| `url` | String | The URL of the document |
| `url` | String | The [host][mdn-host] of the document's url |
| `syntax` | String | _Not used_ |
| `text` | String | The value of the textarea/content |
| `selections` | Array(SelectionObject) | An array of selection objects that describe the user's current cursor selections in the editor |

[mdn-host]: https://developer.mozilla.org/en-US/docs/Web/API/URL/host

#### Selection Object

Selection objects have the following properties:

| Property | Value | Description |
| -------- | ------ | ------------------------------ |
| `start` | Number | 0-index start of the selection |
| `end` | Number | 0-index end of the selection |
| Property | Value | Description |
| -------- | ------ | --------------------------------------------------------------------- |
| `start` | Number | 0-index start of the selection in [UTF-16 code units][mdn-code-units] |
| `end` | Number | 0-index end of the selection in [UTF-16 code units][mdn-code-units] |

[mdn-code-units]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#utf-16_characters_unicode_code_points_and_grapheme_clusters

#### Example

Expand Down

0 comments on commit ea0ebe0

Please sign in to comment.