1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-03-05 05:37:08 +01:00

2551 Commits

Author SHA1 Message Date
Ian Storm Taylor
3bfec770e0 fix slate-dev-environment SUPPORTED_EVENTS export 2018-08-16 15:09:40 -07:00
danielsarin
4d31983a94 IE11 html serializer parser fix ()
#### Is this adding or improving a _feature_ or fixing a _bug_?

This should fix `Unable to get property 'childNodes' of undefined or null reference` error in IE11 when using slate-html-serializer and deserializing an empty string (, ).

#### What's the new behavior?

The `defaultParseHtml` now returns an empty body element if the parsed body is null. 

I tested this in the latest Chrome, Firefox and Safari, and they all seemed to work similarly. If the html param was an empty string, `parseFromString` returned a document element, which had a body property which was an empty body element. In IE11 though the body property was null, which caused the undefined or null reference later.

#### 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`.)
2018-08-16 15:05:08 -07:00
Jinxuan Zhu
183a5d36ff Introduce Range.updatePoints ()
* With Mutation

* Use updatePoints

* Remove mapRanges changes

* Remove mapRanges changes

* Remove mapRanges changes
2018-08-16 15:04:05 -07:00
Jinxuan Zhu
e717452f55 Fix key duplication warning and deprecation in benchmark ()
#### Is this adding or improving a _feature_ or fixing a _bug_?

bug

#### What's the new behavior?

Fix key duplication warning and deprecation

#### How does this change work?

<!-- 
If your change is non-trivial, please include a short description of how the new logic works, and why you decided to solve it the way you did. This is incredibly helpful so that reviewers don't have to guess based on the code.
-->

#### 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: https://github.com/ianstormtaylor/slate/issues/2088 https://github.com/ianstormtaylor/slate/issues/2079
Reviewers: @
2018-08-16 15:00:09 -07:00
Jinxuan Zhu
877dea16bf Upgrade to React v16 lifecycle ()
* Trying to use memoization and upgrade to react v16

* Fix error

* Fix error

* Fix handlers error

* Add annotation

* Remove EventHandlers

* No state

* Remove un-necessary polyfill

* Remove un-necessary polyfill

* Remove un-necessary handlers settings

* Early Return

* Fix Early Return

* Fix onChange

* Do not run onChange stack twice on same change

* Update annotation

* Better sense of resolve++

* Cache value in onChange and didMount

* Remove un-necessary rechack

* Renaming

* Remove change in leaf.js

* Handlers as this.handlers

* do not re-initialize change in onChange

* Re-run onChange stack only when change happens

* Update value when stack changes

* Rename to memoize-one

* queue changes

* Unify interface

* Fix bug

* Add document

* Remove id

* Do not use map

* Fix bug

* Fix eslint

* Fix update when props.value changes

* Add annotation

* Fix stack

* Inline queueChange

* Restore onChange

* restore onChange

* Refactor change and onChange

* Use onChange as the single interface for update

* Do not flushChange if inside event

* Give a warning about synchronous editor.change call

* Change isInChange in editor.change

* refactor resolution and tmp logic, cleanup code
2018-08-16 14:59:29 -07:00
Ian Storm Taylor
d05e90e546 Publish
- slate-base64-serializer@0.2.52
 - slate-html-serializer@0.6.24
 - slate-hyperscript@0.8.1
 - slate-plain-serializer@0.5.33
 - slate-prop-types@0.4.50
 - slate-react@0.15.7
 - slate-schema-violations@0.1.31
 - slate-simulator@0.4.50
 - slate@0.37.6
slate@0.37.6 slate-simulator@0.4.50 slate-schema-violations@0.1.31 slate-react@0.15.7 slate-prop-types@0.4.50 slate-plain-serializer@0.5.33 slate-hyperscript@0.8.1 slate-html-serializer@0.6.24 slate-base64-serializer@0.2.52
2018-08-15 18:03:10 -07:00
Ian Storm Taylor
be262b3c73 fix prettier 2018-08-15 18:00:24 -07:00
Ian Storm Taylor
3cf62ef394 add schema text validators to be functions 2018-08-15 17:58:02 -07:00
Ian Storm Taylor
55f09995a3 Publish
- slate-base64-serializer@0.2.51
 - slate-html-serializer@0.6.23
 - slate-hyperscript@0.8.0
 - slate-plain-serializer@0.5.32
 - slate-prop-types@0.4.49
 - slate-react@0.15.6
 - slate-schema-violations@0.1.30
 - slate-simulator@0.4.49
 - slate@0.37.5
slate@0.37.5 slate-simulator@0.4.49 slate-schema-violations@0.1.30 slate-react@0.15.6 slate-prop-types@0.4.49 slate-plain-serializer@0.5.32 slate-hyperscript@0.8.0 slate-html-serializer@0.6.23 slate-base64-serializer@0.2.51
2018-08-15 12:44:46 -07:00
Ian Storm Taylor
1a0979b849 update changelog 2018-08-15 12:42:45 -07:00
David Chang
f37dd21137 [hyperscript] rename decorators option in params to decorations ()
#### Is this adding or improving a _feature_ or fixing a _bug_?

Debt.

#### What's the new behavior?

`createHyperscript` takes an options object that now looks for the `decorations` property instead of the `decorators` property

#### How does this change work?

Pretty straightforward rename of an option, then all of its uses and wherever the term decorators showed up in docs

#### 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: 
Reviewers: @ianstormtaylor
2018-08-15 12:41:39 -07:00
Ian Storm Taylor
acfffe0c2a Publish
- slate-base64-serializer@0.2.50
 - slate-dev-environment@0.1.5
 - slate-dev-logger@0.1.43
 - slate-hotkeys@0.2.1
 - slate-html-serializer@0.6.22
 - slate-hyperscript@0.7.4
 - slate-plain-serializer@0.5.31
 - slate-prop-types@0.4.48
 - slate-react@0.15.5
 - slate-schema-violations@0.1.29
 - slate-simulator@0.4.48
 - slate@0.37.4
slate@0.37.4 slate-simulator@0.4.48 slate-schema-violations@0.1.29 slate-react@0.15.5 slate-prop-types@0.4.48 slate-plain-serializer@0.5.31 slate-hyperscript@0.7.4 slate-html-serializer@0.6.22 slate-hotkeys@0.2.1 slate-dev-logger@0.1.43 slate-dev-environment@0.1.5 slate-base64-serializer@0.2.50
2018-08-15 12:40:25 -07:00
Ian Storm Taylor
aa0ef4d24f
fix schema defaultNormalize to use normalize:false ()
#### Is this adding or improving a _feature_ or fixing a _bug_?

Bug.

#### What's the new behavior?

All normalizing change methods should use `normalize: false` otherwise the normalization can recurse and cause strange errors.

#### 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`.)
2018-08-15 12:34:50 -07:00
Jinxuan Zhu
5c7211e0fe Warn about duplicate keys ()
* Fix duplicate key in insert node

* Add warning on duplicate keys

* A lot of keys are duplicated

* Ensure error logging

* Finally Fixed

* Change PR

* bug fix

* comment fix

* Add getKeysToPathsTable into text

* refactor forbidden interface

* Refactor forbidden function

* Linting

* Change warn message

* Fix doc
2018-08-15 12:27:47 -07:00
Jinxuan Zhu
48e5c6e04b Refactor code with immutable-js in Model ()
* Ugly Commit

* Small Styling issues about immutable-js

* Remove an unnecessary List
2018-08-14 10:19:56 -07:00
Jinxuan Zhu
dc95ad66a5 Do not use requestAnimation if DataTransfer is available ()
*  not to requestAnimationFrame in modern browser

* Fix bugs

* Fix bugs

* Fix bugs

* Use callback
2018-08-10 10:40:14 -07:00
Ian Storm Taylor
1d53c5b1ef
Add input tester example ()
#### Is this adding or improving a _feature_ or fixing a _bug_?

Example.

#### What's the new behavior?

Adds a new example that is an input event logger, for more easily seeing which input/keyboard/selection events are firing when editing in a Slate editor.

![image](https://user-images.githubusercontent.com/311752/43937175-ea9231e2-9c10-11e8-8e29-2cd9a24ca78d.png)

#### 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`.)
2018-08-09 20:30:23 -07:00
Ian Storm Taylor
f812816b7d
refactor native beforeinput handling ()
* refactor native beforeinput handling

* fix lint
2018-08-09 01:06:31 -07:00
Ian Storm Taylor
a396d013ef Publish
- slate-base64-serializer@0.2.49
 - slate-html-serializer@0.6.21
 - slate-hyperscript@0.7.3
 - slate-plain-serializer@0.5.30
 - slate-prop-types@0.4.47
 - slate-react@0.15.4
 - slate-schema-violations@0.1.28
 - slate-simulator@0.4.47
 - slate@0.37.3
slate@0.37.3 slate-simulator@0.4.47 slate-schema-violations@0.1.28 slate-react@0.15.4 slate-prop-types@0.4.47 slate-plain-serializer@0.5.30 slate-hyperscript@0.7.3 slate-html-serializer@0.6.21 slate-base64-serializer@0.2.49
2018-08-08 16:31:10 -07:00
Bryan Haakman
7ff7a89ea7 fix pointForward and pointBackward ()
* fix next being undefined in pointForward. Adds a check that next exists

* fix both pointForward and pointBackward

* fix for lint tests
2018-08-08 15:59:10 -07:00
Ian Storm Taylor
d4b52e3eb5 Publish
- slate-base64-serializer@0.2.48
 - slate-html-serializer@0.6.20
 - slate-hyperscript@0.7.2
 - slate-plain-serializer@0.5.29
 - slate-prop-types@0.4.46
 - slate-react@0.15.3
 - slate-schema-violations@0.1.27
 - slate-simulator@0.4.46
 - slate@0.37.2
slate@0.37.2 slate-simulator@0.4.46 slate-schema-violations@0.1.27 slate-react@0.15.3 slate-prop-types@0.4.46 slate-plain-serializer@0.5.29 slate-hyperscript@0.7.2 slate-html-serializer@0.6.20 slate-base64-serializer@0.2.48
2018-08-07 19:31:35 -07:00
Slapbox
4d97496299 Fixes inability to deleteWordBackward at line start ()
* Adds Unicode LF character to line endings for clipboard plaintext

This addresses https://github.com/ianstormtaylor/slate/issues/1932

* Fixes plaintext/unicode pastes not having line breaks

* Removes stray spaces for Prettier

* Refactors Value creation to save 4 lines

* Allows for Ctrl+Backspace on line start

Previously Ctrl+Backspace would do nothing instead of continuing on to the above block.

* Tests that deleteWordBackwards joins lines properly
2018-08-07 16:21:30 -07:00
Ian Storm Taylor
1efe55602f Publish
- slate-hotkeys@0.2.0
 - slate-react@0.15.2
slate-react@0.15.2 slate-hotkeys@0.2.0
2018-08-07 16:03:20 -07:00
Ian Storm Taylor
fd9243b8f5
refactor slate-hotkeys, fix deleting at start of block () 2018-08-07 15:58:33 -07:00
Slapbox
3eabdea8d6 Adds Unicode LF character to line endings for clipboard plaintext ()
* Adds Unicode LF character to line endings for clipboard plaintext

This addresses https://github.com/ianstormtaylor/slate/issues/1932

* Fixes plaintext/unicode pastes not having line breaks

* Removes stray spaces for Prettier

* Refactors Value creation to save 4 lines
2018-08-07 08:43:17 -07:00
Jinxuan Zhu
2e9b94b481 [Docs] Fix Packages/Readme.md ()
* Fix document

* Fix lint
2018-08-06 13:22:31 -07:00
Ian Storm Taylor
7e0929bd22 Publish
- slate-base64-serializer@0.2.47
 - slate-html-serializer@0.6.19
 - slate-hyperscript@0.7.1
 - slate-plain-serializer@0.5.28
 - slate-prop-types@0.4.45
 - slate-react@0.15.1
 - slate-schema-violations@0.1.26
 - slate-simulator@0.4.45
 - slate@0.37.1
slate@0.37.1 slate-simulator@0.4.45 slate-schema-violations@0.1.26 slate-react@0.15.1 slate-prop-types@0.4.45 slate-plain-serializer@0.5.28 slate-hyperscript@0.7.1 slate-html-serializer@0.6.19 slate-base64-serializer@0.2.47
2018-08-06 13:16:46 -07:00
Ian Storm Taylor
092193a15e fix lint command 2018-08-06 13:13:40 -07:00
Ian Storm Taylor
52fc5611fc fix moveToEndOfPreviousBlock selection methods 2018-08-06 13:10:26 -07:00
Ian Storm Taylor
ffd9ead175 update changes docs, add missing selection changes 2018-08-06 11:46:42 -07:00
Jinxuan Zhu
58c644323f Add coverage test with mocha and codecov ()
* Run mocha test with module alias

* Running test with babel module alias

* Fix model alias

* Fix model alias

* Resolve module alias

* Running test with babel module alias

* Connect to codecov

* add codecov to travis

* stop if yarn test has errors

* Still cannot collect data from slate modules

* Try to check whether it works with codecov

* Move config to nycrc

* Remove nyc require

* Update nyc to use src

* better before_script
2018-08-06 10:31:42 -07:00
Ian Storm Taylor
07d7f51bbc Publish
- slate-base64-serializer@0.2.46
 - slate-html-serializer@0.6.18
 - slate-hyperscript@0.7.0
 - slate-plain-serializer@0.5.27
 - slate-prop-types@0.4.44
 - slate-react@0.15.0
 - slate-schema-violations@0.1.25
 - slate-simulator@0.4.44
 - slate@0.37.0
slate@0.37.0 slate-simulator@0.4.44 slate-schema-violations@0.1.25 slate-react@0.15.0 slate-prop-types@0.4.44 slate-plain-serializer@0.5.27 slate-hyperscript@0.7.0 slate-html-serializer@0.6.18 slate-base64-serializer@0.2.46
2018-08-03 15:41:27 -07:00
Ian Storm Taylor
adfc093e4e add more selection tests 2018-08-03 15:36:43 -07:00
Ian Storm Taylor
ff598bc5a1 update changelog 2018-08-03 15:28:02 -07:00
Ian Storm Taylor
e317892f44 update changelog 2018-08-03 15:27:20 -07:00
Zach Schneider
70d9e7951b Remove the deprecated Character model, and methods that reference it ()
Closes 
2018-08-03 15:24:05 -07:00
Ian Storm Taylor
1695f5a20c update changelog 2018-08-03 15:19:18 -07:00
Ian Storm Taylor
38918c5e1c update changelog 2018-08-03 15:18:02 -07:00
Ian Storm Taylor
ea6c4d9da2 update peerDependencies 2018-08-03 15:11:28 -07:00
Ian Storm Taylor
152a4aeb54 update changelog 2018-08-03 15:10:58 -07:00
Ian Storm Taylor
d2f6e06a66 update setters and docs 2018-08-03 15:08:20 -07:00
Ian Storm Taylor
f6065e9eb8 update changelog 2018-08-03 15:05:43 -07:00
Ian Storm Taylor
08f270dc1b
Add a Point model, and standardize Range/Point logic ()
* add `Node.createRange` for range resolution

* fix lint

* fix range offset defaults to be `null`

* change `isBackward` to be computed from paths

* remove debuggers

* add point model, update range with deprecations, update hyperscript

* got all tests passing

* get tests passing, convert changes

* fix lint

* fix examples

* update deprecations

* update docs

* update slate-react point utils

* fix document.normalizeRange

* fix lint
2018-08-03 14:45:40 -07:00
Ian Storm Taylor
b3535e11df
change isBackward to be computed from paths ()
* change `isBackward` to be computed from paths

* remove debuggers

* fix lint
2018-08-03 14:31:55 -07:00
Ian Storm Taylor
5a539df0f9
fix range offset defaults to be null () 2018-08-03 14:19:00 -07:00
Ian Storm Taylor
de3420b0f1
add Node.createRange for range resolution ()
#### Is this adding or improving a _feature_ or fixing a _bug_?

Improvement.

#### What's the new behavior?

Adds a `Node.createRange` method for more easily creating ranges that are normalized to the current document. As well as a `Node.resolveRange` lower-level method for just doing the normalization on an existing range.

Later we can deprecate `Range.normalize` since it should be on the node instead.

#### 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: 
2018-08-03 14:16:47 -07:00
Florian
8a1d75025a Fix typo: "the your" -> "your" () 2018-08-03 11:39:38 -07:00
Ian Storm Taylor
9b0e061bcf fix normalize docs 2018-08-01 15:53:17 -07:00
Ian Storm Taylor
6fd185e172 Publish
- slate-base64-serializer@0.2.45
 - slate-dev-benchmark@0.0.4
 - slate-dev-environment@0.1.4
 - slate-dev-logger@0.1.42
 - slate-dev-test-utils@0.0.1
 - slate-hotkeys@0.1.4
 - slate-html-serializer@0.6.17
 - slate-hyperscript@0.6.3
 - slate-plain-serializer@0.5.26
 - slate-prop-types@0.4.43
 - slate-react@0.14.3
 - slate-schema-violations@0.1.24
 - slate-simulator@0.4.43
 - slate@0.36.2
slate@0.36.2 slate-simulator@0.4.43 slate-schema-violations@0.1.24 slate-react@0.14.3 slate-prop-types@0.4.43 slate-plain-serializer@0.5.26 slate-hyperscript@0.6.3 slate-html-serializer@0.6.17 slate-hotkeys@0.1.4 slate-dev-test-utils@0.0.1 slate-dev-logger@0.1.42 slate-dev-environment@0.1.4 slate-dev-benchmark@0.0.4 slate-base64-serializer@0.2.45
2018-08-01 12:07:02 -07:00
Ian Storm Taylor
5e6d376501
fix selection operations being duplicated ()
#### Is this adding or improving a _feature_ or fixing a _bug_?

Bug.

#### What's the new behavior?

Fixes selection operations from being duplicated.

#### How does this change work?

Previously the selection properties were compared by reference, but paths are immutable `List` objects, which always show up as having changed, resulting in extra selection operations that without any real changes. We now use `Immutable.is` to remove those duplicates, fixing the undo history stack.

#### 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: 
2018-08-01 11:55:45 -07:00