* When the parameter passed to `isInEditor` is a text node use its parent if the parent exists
* Add comment on `parentElement` text node browser compatibility
Old implementation was far too slow if a selection included many nodes.
The performance hit occurred when converting each and every text node
into a block. This is now avoided by using the same logic as
getTextsAtRangeAsArray for getBlocksAtRangeAsArray, but using blocks
directly.
* putting in the correct type pseudo-symbols
* getting the pseudo symbols everywhere that the instance of's are
* Making Ian's suggestions on checking types with static methods
* cleaning up leftover hard checks
* adding in slate proptypes, cleaning up unneeded whitespace
* updating documentation, moving keys to prototypes finally, al tests passing
* organizing types, prop-types, more succint type names
* eslint fix
* fixing model-types bug, changing proptype names
* imported babel-polyfill to make examples run in IE
* Fix for HTML pasting not working in IE
* Revert "imported babel-polyfill to make examples run in IE"
This reverts commit a8405075d6a44de8cae8092e3773829b56dadd93.
* Refactored and corrected comments of fix: HTML pasting not working in IE
* Removed handleData and tuned getTransferData call of fix: HTML pasting not working in IE
I noticed that the file size badge didn't change when Cheerio was removed in 0.21.0. Because I stupidly pinned it to version 0.19.0 😳 - this will now always show the gzip size of the latest release
* Replace cheerio with parse5
* Convert to dependency injection for HTML parser
* Add options.domParser to HTML serializer
* Fallback to native DOMParser if present and no option provided
* Error if no DOM parser is available (option or native)
* Update tests to pass parse5 as config option
* Update test so it passes.
Cheerio interprets `<p><hr /></p>` as one `p` node with a child `hr`
node, but both parse5 and native DOMParser interpret it as 3 nodes: a
blank `p` node, `hr` node, and second blank `p` node. Update test
expectation to match new API.
* Remove cheerio-esque compatibility conversion.
* Use `application/xml` in native DOMParser
Using `text/html` causes it to wrap the fragment in html, body, etc
* Change error message to single line.
Was inserting an undesired newline char
* Add documentation for new `domParser` option to html serializer
Also boyscout missing documentation for `defaultBlockType` option
* Rename `domParser` option to `parseHtml`
Rename the option to make it clearer what it does, since it accepts a
function and not a `DOMParser` analogue object.
* Allow HTML serializer to deserialize an empty document
This specially handles the case where the HTML is empty.
Test by running:
```
const html = new HTML()
html.deserialize('')
```
Closes#539
* Use defaultBlockType in HTML serializer
* Add test case for deserialising empty string
* Use fixtures
* Fix Edge doctype warning
* Remove getData() calls in onDragOver
Access to data within ondragover is prohibited
* Handle Edge errors accessing `dataTransfer.dropEffect`
* Work around Edge not supporting custom data in drag events
If unable to use `setData()` with custom type, then uses JSON obj to store data in 'text/plain'
* Fix more Edge errors
Edge sometimes throws 'NotSupportedError' whena accessing `items` property on `dataTransfer`
* Fix linting errors
* Fix formatting
* Add `data` field to editor `State`.
Plugins can use it to store their own internal state.
* Remove `serialize` and `deserialize` plugin methods.
* Add operation to set `data` on a state.
* Add `setDataOperation` tests.
* Remove the possibility to use keys different from strings.
Add `preserveData` option to `raw.serialize`.
Rewrite `set-data` test exploiting the new option.
* Add property isEmpty to State
* Update hovering menu example
* Document isEmpty
* Improve perf of isEmpty with @Soreine 's suggestion
* Fix return of isEmpty
I tried using the exact code from the example to be met by errors.
The order of arguments in the function example is wrong, it should be use the API described in the [docs](https://docs.slatejs.org/reference/plugins/plugin.html#onbeforeinput).
```
Function onBeforeInput(event: Event, data: Object, state: State, editor: Editor) => State || Void
```