* Allow the dev server to work for non localhost host
* Refactored set-selection-from-dom into utils as prep for Android support
* Show debug onInput at start if triggered
* Added and refactored to use set-text-from-dom-node with improved set selection after input
* Remove unnecessary console.log in set-text-from-dom-node
* Fixes to pass linter
* Adds basic composition to Android API27 including fixing one bug where compositionStart does not fire
* Fix some of the enter handling in API 27 and 28
* Add fixes for API 25
* Add debug for slate:update instead of separate render and updateSelection
* Add API 26 fix for ignoring all but Enter in onKeyDown
* Fix enter on Android 26 and 27
* Revert onSelect bug. Editor API 26 and 27 stable-ish
* Fix enter at beginning and end of word in API 26 and 27
* Fix enter handling at end of line API 26 and 27
* Fix reversion of enter bug when not at end of line
* Rename enter to linefeed which is more accurate
* Fix backspace on Android 27 and 28
* Fix enter at end of line then backspace then enter bug in API 26 and 27
* Refactor to simplify reading code
* Refactor to use executor and fix the suggestion problem
* Fix multi point edit in API 27/28
* Update Android documentation on enter handling
* Fix enter in API 26/27 and document 4 different enter cases
* Refactor partial into SlateSnapshot
* Complete SlateSnapshot refactor
* Remove unnecessary plugin comments
* Add smoke tests
* Rename smoke tests to composition in exmaples
* Fix API28 split join and insertion
* Fix space then backspace in middle of word bug in API 28
* Add text for middle word space and backspace bug
* Add note that the space backspace bug does not exist on API 27
* Fix 'It me. No.' bug in API 26/27
* Fix comments
* Update comments to fit Slate style guide
* Move a debug statement
* Fix zero-width selection placement bug.
* Fix 'it is' then enter in middle of 'it' bug
* Partial fix of enter, backspace, enter in word
* Add and fix comments. Fix selection in zero-width for API26-27
* Fix linting
* Fix documentation
* Remove snapback from packages
* Remove snapback from yarn.lock
* Refactored set-selection-from-dom into utils as prep for Android support
* Added and refactored to use set-text-from-dom-node with improved set selection after input
* Make `placeholder` element compatible with older versions of React
`React.Fragment` is only available in react >= 16.2, which does not
meet the dependency requirements specified by the package (react >=
0.14.0). Updates from `React.Fragment` -> `span` to provide coverage
for older versions of react.
* Update `slate-react` placeholder test case
* Add `editor.hasCommand` method
* Add `editor.hasQuery` method
* Rename directories `hasCommand` and `hasQuery` to kebab case
* Add tests for `editor.hasCommand` of React component
* Add tests for `editor.hasQuery` of React component
* Add `defaultValue` prop to `Editor` component
* Use `defaultValue` prop in the `Read Only` example
* Use `defaultValue` prop in the `Check Lists` example
* Use `defaultValue` prop in the `Code Highlighting` example
* Use `defaultValue` prop in the `Embeds` example
* Use `defaultValue` prop in the `Emojis` example
* Use `defaultValue` prop in the `Forced Layout` example
* Use `defaultValue` prop in the `Huge Document` example
* Use `defaultValue` prop in the `Images` example
* Use `defaultValue` prop in the `Input Tester` example
* Use `defaultValue` prop in the `Markdown Preview` example
* Use `defaultValue` prop in the `Markdown Shortcuts` example
* Use `defaultValue` prop in the `Paste HTML` example
* Use `defaultValue` prop in the `Plain Text` example
* Use `defaultValue` prop in the `Plugins` example
* Use `defaultValue` prop in the `RTL` example
* Use `defaultValue` prop in the `Search Highlighting` example
* Use `defaultValue` prop in the `Tables` example
* When the component unmounts, make sure async commands don't trigger react updates.
* Eslint fix
* Add changes made to shouldNodeComponentUpdate to changelog of slate-react
* add placeholder plugin in slate-react
* remove renderPlaceholder logic
* extract placeholder into a plugin
* remove other old placeholder-based logic
* update changelogs
* Skip operations on child nodes if !node.nodes.size
Avoid running decoration and text decoration related functions on child nodes that don't exist.
* Uses isLeafBlock
* Restores the original order of statements
#### Is this adding or improving a _feature_ or fixing a _bug_?
Improvement / debt.
#### What's the new behavior?
This pull request removes the `Change` object as we know it, and folds all of its behaviors into the new `Editor` controller instead, simplifying a lot of the confusion around what is a "change vs. editor" and when to use which. It makes the standard API a **lot** nicer to use I think.
---
###### NEW
**The `editor.command` and `editor.query` methods can take functions.** Previously they only accepted a `type` string and would look up the command or query by type. Now, they also accept a custom function. This is helpful for plugin authors, who want to accept a "command option", since it gives users more flexibility to write one-off commands or queries. For example a plugin could be passed either:
```js
Hotkey({
hotkey: 'cmd+b',
command: 'addBoldMark',
})
```
Or a custom command function:
```js
Hotkey({
hotkey: 'cmd+b',
command: editor => editor.addBoldMark().moveToEnd()
})
```
###### BREAKING
**The `Change` object has been removed.** The `Change` object as we know it previously has been removed, and all of its behaviors have been folded into the `Editor` controller. This includes the top-level commands and queries methods, as well as methods like `applyOperation` and `normalize`. _All places that used to receive `change` now receive `editor`, which is API equivalent._
**Changes are now flushed to `onChange` asynchronously.** Previously this was done synchronously, which resulted in some strange race conditions in React environments. Now they will always be flushed asynchronously, just like `setState`.
**The `render*` and `decorate*` middleware signatures have changed!** Previously the `render*` and `decorate*` middleware was passed `(props, next)`. However now, for consistency with the other middleware they are all passed `(props, editor, next)`. This way, all middleware always receive `editor` and `next` as their final two arguments.
**The `normalize*` and `validate*` middleware signatures have changed!** Previously the `normalize*` and `validate*` middleware was passed `(node, next)`. However now, for consistency with the other middleware they are all passed `(node, editor, next)`. This way, all middleware always receive `editor` and `next` as their final two arguments.
**The `editor.event` method has been removed.** Previously this is what you'd use when writing tests to simulate events being fired—which were slightly different to other running other middleware. With the simplification to the editor and to the newly-consistent middleware signatures, you can now use `editor.run` directly to simulate events:
```js
editor.run('onKeyDown', { key: 'Tab', ... })
```
###### DEPRECATED
**The `editor.change` method is deprecated.** With the removal of the `Change` object, there's no need anymore to create the small closures with `editor.change()`. Instead you can directly invoke commands on the editor in series, and all of the changes will be emitted asynchronously on the next tick.
```js
editor
.insertText('word')
.moveFocusForward(10)
.addMark('bold')
```
**The `applyOperations` method is deprecated.** Instead you can loop a set of operations and apply each one using `applyOperation`. This is to reduce the number of methods exposed on the `Editor` to keep it simpler.
**The `change.call` method is deprecated.** Previously this was used to call a one-off function as a change method. Now this behavior is equivalent to calling `editor.command(fn)` instead.
---
Fixes: https://github.com/ianstormtaylor/slate/issues/2334
Fixes: https://github.com/ianstormtaylor/slate/issues/2282
https://github.com/ianstormtaylor/slate/issues/1879
When composition starts and the current selection is not collapsed, the
second composition key-down would drop the text wrapping <spans> which
resulted on crash in content.updateSelection after composition ends
(because it cannot find <span> nodes in DOM). This is a workaround that
erases selection as soon as composition starts and preventing <spans>
to be dropped.