Skip to content

Instantly share code, notes, and snippets.

@Actine
Last active August 19, 2021 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Actine/b2520f558a2050ca63051f23168573da to your computer and use it in GitHub Desktop.
Save Actine/b2520f558a2050ca63051f23168573da to your computer and use it in GitHub Desktop.
{
"type": "ranges", // Means it's a rich text object
"ranges": {
"text": "1 pinch sugar\n2 pounds salt \n3 oz flour", // Character data. See how it's just text with newlines, no formatting
"objects": [ // If the text contains any links (row references, URLs, images, pages etc),
// those will appear in the "objects" array
{
"start": 28, // e.g. this one means there's a page link to a page "Uncheck" (/_suvou)
"end": 29, // inserted in place of characters 28-29 of the "text" above (where the space is)
"info": {
"id": "rv-u2mDt-wqy5",
"type": "structuredValue",
"value": {
"type": "urlref",
"url": "Uncheck_suvou",
"name": ""
}
}
}
],
"spans": [ // Character level formatting is saved in the array of spans:
{ // Characters 0-33 (0 incl., 33 excl.) — no formatting
"start": 0,
"end": 33,
"classes": {}
},
{ // Characters 33-35 — bold
"start": 33,
"end": 35,
"classes": {
"weight": "kr-bold"
}
},
{ // Characters 35-41 — again no formatting.
"start": 35, // Spans must always be contiguous and cover the whole length of "text"
"end": 41,
"classes": {}
}
],
"regions": [], // Not sure what this is for, never saw it used tbh
"lines": [ // Paragraph level formatting is stored in the array of lines:
{
"id": "lines-0",
"listType": "kr-boxlist", // This line is a checkbox
"listLevel": 1, // No nesting (level 1)
"noGlyph": false, // unused for now
"isChecked": false // Unchecked
},
{
"id": "lines-1",
"listType": "kr-boxlist", // This line is also a checkbox
"listLevel": 2, // Nested by one indent
"noGlyph": false,
"isChecked": true // Checked
},
{
"id": "lines-2",
"listType": "kr-ulist", // This line is a bullet list
"listLevel": 1, // Not nested again
"noGlyph": false
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment