1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-19 06:35:03 +01:00
Ian Storm Taylor 6c42f6c9c3 Rename Range to Leaf, and Selection to Range (#1231)
* rename Range to Leaf

* rename Selection to Range

* add findDOMRange, findNode, findRange helpers

* refactor to remove findDropPoint util

* revert findDOMNode to throwing errors

* export new helpers, fix linter

* update docs

* update examples
2017-10-14 15:36:27 -07:00

212 lines
4.6 KiB
JSON

{
"document": {
"nodes": [
{
"kind": "block",
"type": "paragraph",
"nodes": [
{
"kind": "text",
"leaves": [
{
"text": "There are certain behaviors that require rendering dynamic marks on string of text, like rendering code highlighting. For example:"
}
]
}
]
},
{
"kind": "block",
"type": "code",
"data": {
"language": "js"
},
"nodes": [
{
"kind": "block",
"type": "code_line",
"nodes": [
{
"kind": "text",
"leaves": [
{
"text": "// A simple FizzBuzz implementation."
}
]
}
]
},
{
"kind": "block",
"type": "code_line",
"nodes": [
{
"kind": "text",
"leaves": [
{
"text": "for (var i = 1; i <= 100; i++) {"
}
]
}
]
},
{
"kind": "block",
"type": "code_line",
"nodes": [
{
"kind": "text",
"leaves": [
{
"text": " if (i % 15 == 0) {"
}
]
}
]
},
{
"kind": "block",
"type": "code_line",
"nodes": [
{
"kind": "text",
"leaves": [
{
"text": " console.log('Fizz Buzz');"
}
]
}
]
},
{
"kind": "block",
"type": "code_line",
"nodes": [
{
"kind": "text",
"leaves": [
{
"text": " } else if (i % 5 == 0) {"
}
]
}
]
},
{
"kind": "block",
"type": "code_line",
"nodes": [
{
"kind": "text",
"leaves": [
{
"text": " console.log('Buzz');"
}
]
}
]
},
{
"kind": "block",
"type": "code_line",
"nodes": [
{
"kind": "text",
"leaves": [
{
"text": " } else if (i % 3 == 0) {"
}
]
}
]
},
{
"kind": "block",
"type": "code_line",
"nodes": [
{
"kind": "text",
"leaves": [
{
"text": " console.log('Fizz');"
}
]
}
]
},
{
"kind": "block",
"type": "code_line",
"nodes": [
{
"kind": "text",
"leaves": [
{
"text": " } else {"
}
]
}
]
},
{
"kind": "block",
"type": "code_line",
"nodes": [
{
"kind": "text",
"leaves": [
{
"text": " console.log(i);"
}
]
}
]
},
{
"kind": "block",
"type": "code_line",
"nodes": [
{
"kind": "text",
"leaves": [
{
"text": " }"
}
]
}
]
},
{
"kind": "block",
"type": "code_line",
"nodes": [
{
"kind": "text",
"leaves": [
{
"text": "}"
}
]
}
]
}
]
},
{
"kind": "block",
"type": "paragraph",
"nodes": [
{
"kind": "text",
"leaves": [
{
"text": "Try it out for yourself!"
}
]
}
]
}
]
}
}