1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-15 12:44:38 +01:00

2521 Commits

Author SHA1 Message Date
Eric Edem
6dc8b4baa5 docs(plugins): update signature docs (#2057)
`onChange()` also receives the editor as an argument.
2018-09-27 23:37:01 -07:00
Ian Storm Taylor
e7ab7f8279 cleanup object type checking and interface 2018-09-27 16:36:37 -07:00
Ian Storm Taylor
aba8f19d0e Publish
- slate-base64-serializer@0.2.68
 - slate-html-serializer@0.7.7
 - slate-hyperscript@0.10.7
 - slate-plain-serializer@0.6.7
 - slate-prop-types@0.4.66
 - slate-react@0.18.10
 - slate-simulator@0.4.66
 - slate@0.41.2
slate@0.41.2 slate-simulator@0.4.66 slate-react@0.18.10 slate-prop-types@0.4.66 slate-plain-serializer@0.6.7 slate-hyperscript@0.10.7 slate-html-serializer@0.7.7 slate-base64-serializer@0.2.68
2018-09-26 13:20:34 -07:00
Ian Storm Taylor
7b4eca5e16 Merge branch 'master' of github.com:ianstormtaylor/slate 2018-09-26 13:12:42 -07:00
Ian Storm Taylor
af8432f639 fix onClick when not finding a node 2018-09-26 13:12:35 -07:00
Bryan Haakman
6813ac41b5 Add a version example (#2205)
* add a versions example, first try

* lint fixes

* set version to latest on mount
2018-09-25 13:33:11 -07:00
Eric Edem
f60100bd93 Update products to include Cake (#2207)
Now that Cake is coming out of invite only mode, figured it was a good time to add it. :)
2018-09-25 13:29:15 -07:00
Nick Quaranto
237dd8395f Update resources with Chatterslate (#2204)
Just a quick update here with a link to https://github.com/chatterbugapp/chatterslate !
2018-09-25 11:27:39 -07:00
Grey Osten
329dac72d3 Normalize copying void inline nodes (#2198)
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.
2018-09-22 11:13:22 -07:00
Alan Christopher Thomas
0f5d95e98e Merge decorations from multiple plugins (#2197)
* 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)
2018-09-22 11:12:12 -07:00
Ian Storm Taylor
bf9b03e634 Publish
- slate-base64-serializer@0.2.67
 - slate-html-serializer@0.7.6
 - slate-hyperscript@0.10.6
 - slate-plain-serializer@0.6.6
 - slate-prop-types@0.4.65
 - slate-react@0.18.9
 - slate-simulator@0.4.65
 - slate@0.41.1
slate@0.41.1 slate-simulator@0.4.65 slate-react@0.18.9 slate-prop-types@0.4.65 slate-plain-serializer@0.6.6 slate-hyperscript@0.10.6 slate-html-serializer@0.7.6 slate-base64-serializer@0.2.67
2018-09-21 15:09:49 -07:00
Ian Storm Taylor
75ef8a5232 simplify parent dirty key logic 2018-09-21 15:03:16 -07:00
Ian Storm Taylor
4e9d262f9b fix normalization for non-node operations 2018-09-21 15:01:17 -07:00
Ian Storm Taylor
ca6920a88f Publish
- slate-base64-serializer@0.2.66
 - slate-html-serializer@0.7.5
 - slate-hyperscript@0.10.5
 - slate-plain-serializer@0.6.5
 - slate-prop-types@0.4.64
 - slate-react@0.18.8
 - slate-simulator@0.4.64
 - slate@0.41.0
slate@0.41.0 slate-simulator@0.4.64 slate-react@0.18.8 slate-prop-types@0.4.64 slate-plain-serializer@0.6.5 slate-hyperscript@0.10.5 slate-html-serializer@0.7.5 slate-base64-serializer@0.2.66
2018-09-21 11:19:48 -07:00
Ian Storm Taylor
c9cf16d019
refactor normalization to be operations-based (#2193)
#### 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: #1363
Fixes: #2134
Fixes: #2135
Fixes: #2136
Fixes: #1579
Fixes: #2132
Fixes: #1657
2018-09-21 11:15:04 -07:00
Ian Storm Taylor
da93937b19 fix benchmarks 2018-09-21 09:56:20 -07:00
Ian Storm Taylor
fd1832c73f Publish
- slate-base64-serializer@0.2.65
 - slate-hotkeys@0.2.5
 - slate-html-serializer@0.7.4
 - slate-hyperscript@0.10.4
 - slate-plain-serializer@0.6.4
 - slate-prop-types@0.4.63
 - slate-react@0.18.7
 - slate-simulator@0.4.63
 - slate@0.40.4
slate@0.40.4 slate-simulator@0.4.63 slate-react@0.18.7 slate-prop-types@0.4.63 slate-plain-serializer@0.6.4 slate-hyperscript@0.10.4 slate-html-serializer@0.7.4 slate-hotkeys@0.2.5 slate-base64-serializer@0.2.65
2018-09-21 09:43:39 -07:00
Ian Storm Taylor
fd87c746f8 fix versions... 2018-09-21 09:42:05 -07:00
Jinxuan Zhu
9d4d00e299 Codecov: Only test slate, slate-html-serializer and slate-plain-serializer (#2186)
* Only test slate models

* test slate-plain and slate-html models

* Fix travis
2018-09-19 11:39:02 -07:00
Maulik
ebc72bf38f Updating function in readme.md (#2185)
Typo in function definition
2018-09-19 11:38:27 -07:00
Eric Edem
2a99679753 debt(codecov): disable code coverage in builds (#2183)
Right now code coverage results in a lot of false positives for failing builds. This makes it really difficult to tell at a glance whether PRs are passing / failing something more important like linting or tests.

Disabling for now until we can find a better approach.
2018-09-18 12:10:41 -07:00
Ian Storm Taylor
018ada8b88 fix selection.marks preservation from #2181 2018-09-18 10:08:33 -07:00
Nicolas Gaborit
4749cfc8b1 Actually fix marks being cleared on selection events (#2181)
* Fix marks being cleared on selection events

* Fix mistake
2018-09-18 09:49:18 -07:00
Bjørge Næss
3e7116dce1 Gracefully handle permission denied error when checking for element.nodeType (#2178) 2018-09-17 18:38:49 -07:00
Nicolas Gaborit
ea950ac1af Fix marks being cleared on selection events (#2158) 2018-09-17 18:33:01 -07:00
Per-Kristian Nordnes
f75a274c0e Fix deprecated .move > .moveForward in the after plugin (#2179) 2018-09-17 18:28:22 -07:00
Eric Edem
462244600d fix(example/links): a few fixes for the links example (#2175)
* Correctly use the selection
* check whether the user cancelled the prompt
* use `moveFocusBackward`
2018-09-17 18:27:37 -07:00
Damien Erambert
222f746e85 Avoid crash in updateSelection() in content when window.getSelection() returns null (#2163) 2018-09-17 18:27:10 -07:00
Florian
dbf35f2565 Add info on how to use schema (#2156) 2018-09-17 18:26:18 -07:00
Alan Christopher Thomas
fa51558ede Remove stale docs for shouldNodeComponentUpdate (#2160) 2018-09-17 18:24:06 -07:00
Eric Edem
ebea68d0ac fix(change.md): correct setOperationFlag() signature (#2161) 2018-09-15 17:30:25 -07:00
Per-Kristian Nordnes
6340469266
Fix deprecated moveToStartOf and moveToEndOf (#2155)
In slate-react module (get-event-range)
2018-09-08 01:34:12 +02:00
Charley DAVID
405cef0225 Add support for validating functions inside schema's rules (#2151)
* Add specs, defaults, and documentation to next/previous rule properties

* Add comparator function support for kind/object, type, data, and mark
2018-09-04 13:14:20 -07:00
Ian Storm Taylor
6369d0523a Publish
- slate-react@0.18.5
slate-react@0.18.5
2018-09-04 12:00:41 -07:00
Eric Edem
3db717761e fix(content): attach the right onNativeSelectionChange. (#2150)
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.
2018-09-04 10:36:48 -07:00
Eric Edem
a8cd10ba63 fix(markdown-shortcuts): moveFocusToStartOf -> moveFocusToStartOfNode (#2146)
This got a bit mangled during find and replace in 08f270dc1b
2018-09-04 09:53:46 -07:00
Ian Storm Taylor
54611b7dd7 Publish
- slate-react@0.18.4
slate-react@0.18.4
2018-08-29 14:03:31 -07:00
Eric Edem
9d0546fad3 fix(content): use handlers that actually exist in event listeners (#2131)
* 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 #2125
Fixes #2129

* fix(content): also fix removeEventListeners
2018-08-29 12:32:48 -07:00
Arda Beyazoğlu
ec42b18108 Change source code url to be up-to-date (#2127)
Previous ".src" path no longer exists and throws 404.
2018-08-26 10:24:43 -07:00
Ian Storm Taylor
ba9b79112e Publish
- slate-base64-serializer@0.2.63
 - slate-html-serializer@0.7.2
 - slate-hyperscript@0.10.2
 - slate-plain-serializer@0.6.2
 - slate-prop-types@0.4.61
 - slate-react@0.18.3
 - slate-simulator@0.4.61
 - slate@0.40.2
slate@0.40.2 slate-simulator@0.4.61 slate-react@0.18.3 slate-prop-types@0.4.61 slate-plain-serializer@0.6.2 slate-hyperscript@0.10.2 slate-html-serializer@0.7.2 slate-base64-serializer@0.2.63
2018-08-24 09:01:31 -07:00
Irwan Fario Subastian
dfc41d1697 Fix incorrect history stack (#2122)
* update yarn.lock

* fix typo that cause select operation clearing redo
2018-08-24 08:30:37 -07:00
Ian Storm Taylor
7c22e93f97 Merge branch 'master' of github.com:ianstormtaylor/slate 2018-08-23 13:55:47 -07:00
Ian Storm Taylor
584ffec626 Publish
- slate-base64-serializer@0.2.62
 - slate-html-serializer@0.7.1
 - slate-hyperscript@0.10.1
 - slate-plain-serializer@0.6.1
 - slate-prop-types@0.4.60
 - slate-react@0.18.2
 - slate-simulator@0.4.60
 - slate@0.40.1
slate@0.40.1 slate-simulator@0.4.60 slate-react@0.18.2 slate-prop-types@0.4.60 slate-plain-serializer@0.6.1 slate-hyperscript@0.10.1 slate-html-serializer@0.7.1 slate-base64-serializer@0.2.62
2018-08-23 13:54:58 -07:00
Ian Storm Taylor
8409e490c9 tweak maximum schema iterations logic, addresses #2118 2018-08-23 13:53:29 -07:00
Fiyaz Bin Hasan
c87900b29e small typo and broken link for range doc fixed (#2120) 2018-08-23 13:43:24 -07:00
Ian Storm Taylor
8358d3777f Publish
- slate-react@0.18.1
slate-react@0.18.1
2018-08-23 11:34:31 -07:00
Ian Storm Taylor
5d0f53da3f fix assertPathByKey, fixes #2119 2018-08-23 11:32:30 -07:00
Ian Storm Taylor
729727d91e Publish
- slate-base64-serializer@0.2.61
 - slate-dev-warning@0.0.1
 - slate-html-serializer@0.7.0
 - slate-hyperscript@0.10.0
 - slate-plain-serializer@0.6.0
 - slate-prop-types@0.4.59
 - slate-react@0.18.0
 - slate-simulator@0.4.59
 - slate@0.40.0
slate@0.40.0 slate-simulator@0.4.59 slate-react@0.18.0 slate-prop-types@0.4.59 slate-plain-serializer@0.6.0 slate-hyperscript@0.10.0 slate-html-serializer@0.7.0 slate-dev-warning@0.0.1 slate-base64-serializer@0.2.61
2018-08-22 18:31:50 -07:00
Ian Storm Taylor
36ed4397d8
Remove deprecations (#2113)
#### 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: #1922 
Fixes: #2105
Fixes: #646 
Fixes: #2109
Fixes: #2107 
Fixes: #2018
2018-08-22 18:22:40 -07:00
Ian Storm Taylor
3d48f7a3e0 Publish
- slate-base64-serializer@0.2.60
 - slate-html-serializer@0.6.32
 - slate-hyperscript@0.9.3
 - slate-plain-serializer@0.5.41
 - slate-prop-types@0.4.58
 - slate-react@0.17.3
 - slate-schema-violations@0.1.39
 - slate-simulator@0.4.58
 - slate@0.39.3
slate@0.39.3 slate-simulator@0.4.58 slate-schema-violations@0.1.39 slate-react@0.17.3 slate-prop-types@0.4.58 slate-plain-serializer@0.5.41 slate-hyperscript@0.9.3 slate-html-serializer@0.6.32 slate-base64-serializer@0.2.60
2018-08-22 15:43:19 -07:00