* Fix undo after a selection snapshot
* Add a test to cover the text deletion case
* Fix lint
* Use the new whitoutMerging flag instead
* cleanup + fix function call
#### Is this adding or improving a _feature_ or fixing a _bug_?
Fix.
#### What's the new behavior?
The dirty paths in a change are now transformed against incoming operations, such that they don't get out of sync as normalizations occur. This is a rough pass to get correctness and the bug fixed, and we can later optimize lots of the little details for performance.
#### Have you checked that...?
<!--
Please run through this checklist for your pull request:
-->
* [x] The new code matches the existing patterns and styles.
* [x] The tests pass with `yarn test`.
* [x] The linter passes with `yarn lint`. (Fix errors with `yarn prettier`.)
* [x] The relevant examples still work. (Run examples with `yarn watch`.)
#### Does this fix any issues or need any specific reviewers?
Fixes: #2211Fixes: #2215Fixes: #2194
When a void inline nodes is selected along with other text/content it can be copied to the clipboard. When it’s the only thing selected it is ignored because anything marked contentedtiable=false is.
Updated isInEditor to return true if a contenteditable=false has a parent that is a void inline node.
* Merge decorations from multiple plugins
Previously, `decorateNode` would search the plugin stack for the first
`decorateNode` handler that returned a value. Now, it will call the
`decorateNode` handler on every plugin in the stack and merge their results
together.
* Call List() to instantiate empty list instead of using new keyword
* Fix linting errors and use Immutable's flatten()
* Use boolean flatten() argument for clarity (shallow flatten)
#### Is this adding or improving a _feature_ or fixing a _bug_?
Improvement.
#### What's the new behavior?
This changes the normalization logic to be operations (and `key`) based, instead of the current logic which is more haphazard, and which has bugs that lead to non-normalized documents in certain cases.
#### How does this change work?
Now, every time a change method is called, after it applies its operations, those operations will be normalized. Based on each operation we can know exactly which nodes are "dirty" and need to be re-validated.
This change also makes it easy for the `withoutNormalizing` (previously `withoutNormalization`) helper to be much more performant, and only normalize the "dirty" nodes instead of being forced to handle the entire document.
To accommodate this new behavior, the old "operation flags" have been removed, replaced with a set of more consistent helpers:
- `withoutNormalizing`
- `withoutSaving`
- `withoutMerging`
All of them take functions that will be run with the desired behavior in scope, similar to how Immutable.js's own `withMutations` works. Previously this was done with a more complex set of flags, which could be set and unset in a confusing number of different ways, and it was generally not very well thought out. Hopefully this cleans it up, and makes it more approachable for people.
We also automatically use the `withoutNormalizing` helper function for all of the changes that occur as part of schema `normalize` functions. Previously people had to use `{ normalize: false }` everywhere in those functions which was error-prone.
With this new architecture, you sure almost never need to think about normalization. Except for cases where you explicitly want to move through an interim state that is invalid according to Slate's default schema or your own custom schema. In which case you'd use `withoutNormalizing` to allow the invalid interim state to be moved through.
#### Have you checked that...?
* [x] The new code matches the existing patterns and styles.
* [x] The tests pass with `yarn test`.
* [x] The linter passes with `yarn lint`. (Fix errors with `yarn prettier`.)
* [x] The relevant examples still work. (Run examples with `yarn watch`.)
#### Does this fix any issues or need any specific reviewers?
Fixes: #1363Fixes: #2134Fixes: #2135Fixes: #2136Fixes: #1579Fixes: #2132Fixes: #1657
This undoes a recent change https://github.com/ianstormtaylor/slate/pull/2131
Which hooked up `this.handlers.onNativeSelectionChange` to `'selectionchange'` as well as `this.handlers.onBeforeInput` to `'beforeinput'`.
It turns out that in order to fix the iOS issues, we only needed the change to `onBeforeInput`. The corect handler for `'selectionchange'` is the instance method `this.onNativeSelectionChange`. This broke a whole bunch of focus related issues.
* fix(content): use handlers that actually exist in event listeners
In a recent change, handlers now only exist in `Content#handlers`, but there were still a couple of places where they were being dereferenced directly from the instance. This was causing some side effects in iOS.
Fixes#2125Fixes#2129
* fix(content): also fix removeEventListeners
#### Is this adding or improving a _feature_ or fixing a _bug_?
Debt.
#### What's the new behavior?
This removes almost all existing deprecations from previous API changes, to save on filesize and reduce complexity in the codebase going forward.
It also changes from using the `slate-dev-logger` to using the Facebook-inspired `slate-dev-warning` which can be compiled out of production builds with [`babel-plugin-dev-expression`](https://github.com/4Catalyzer/babel-plugin-dev-expression) to save even further on file size.
The only deprecations it keeps are in the `fromJSON` methods for data model changes like `.kind` and `.leaves` which may still may not have been migrated in databases, since this is a bigger pain point.
#### Have you checked that...?
* [x] The new code matches the existing patterns and styles.
* [x] The tests pass with `yarn test`.
* [x] The linter passes with `yarn lint`. (Fix errors with `yarn prettier`.)
* [x] The relevant examples still work. (Run examples with `yarn watch`.)
#### Does this fix any issues or need any specific reviewers?
Fixes: #1922Fixes: #2105Fixes: #646Fixes: #2109Fixes: #2107Fixes: #2018