1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-13 19:57:00 +01:00

2383 Commits

Author SHA1 Message Date
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 (#2053)
* 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 (#2046)
* 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 (#2048) 2018-08-07 15:58:33 -07:00
Slapbox
3eabdea8d6 Adds Unicode LF character to line endings for clipboard plaintext (#2040)
* 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 (#1859)
* 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 (#2037)
* 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 (#2016)
Closes #1999
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 (#2035)
* 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 (#2027)
* 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 (#2026) 2018-08-03 14:19:00 -07:00
Ian Storm Taylor
de3420b0f1
add Node.createRange for range resolution (#2025)
#### 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: #2011
2018-08-03 14:16:47 -07:00
Florian
8a1d75025a Fix typo: "the your" -> "your" (#2032) 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 (#2023)
#### 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: #2006
2018-08-01 11:55:45 -07:00
Ian Storm Taylor
1748a4b0c1
Refactor tests (#2021)
* add slate-dev-test-utils, refactor tests to use fixtures util

* cleanup top-level test files

* tweaks
2018-08-01 09:16:02 -07:00
Florian
f7fd0b7a4e Docs: Remove leading semicolon in code snippet (#2020)
* Remove leading semicolon in code snippet

* Update changes.md
2018-08-01 09:04:12 -07:00
Cheng Zheng
142d9a82f6 Add Products: Taskade (#2008)
* Add Products: Taskade

* Alphabet order

* remove empty line
2018-07-31 22:39:32 -07:00
Martti Laine
1ff1dfa4b8 Add slate-react to the bundled source guide (#2010) 2018-07-31 16:46:30 -07:00
Ian Storm Taylor
64000a97aa Publish
- slate-base64-serializer@0.2.44
 - slate-html-serializer@0.6.16
 - slate-hyperscript@0.6.2
 - slate-plain-serializer@0.5.25
 - slate-prop-types@0.4.42
 - slate-react@0.14.2
 - slate-schema-violations@0.1.23
 - slate-simulator@0.4.42
 - slate@0.36.1
slate@0.36.1 slate-simulator@0.4.42 slate-schema-violations@0.1.23 slate-react@0.14.2 slate-prop-types@0.4.42 slate-plain-serializer@0.5.25 slate-hyperscript@0.6.2 slate-html-serializer@0.6.16 slate-base64-serializer@0.2.44
2018-07-31 16:31:54 -07:00
Ian Storm Taylor
06bca539dc
fix getFragmentAtRange to use paths properly (#2012)
#### Is this adding or improving a _feature_ or fixing a _bug_?

Bug.

#### What's the new behavior?

Fixes `Node.getFragmentAtRange` to use the proper argument signature when calling `Node.splitNode`, and refactors it to use paths for all of its logic.

#### 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: #2009
2018-07-31 16:26:52 -07:00
Ian Storm Taylor
638d3e8e61 Publish
- slate-base64-serializer@0.2.43
 - slate-dev-logger@0.1.41
 - slate-html-serializer@0.6.15
 - slate-hyperscript@0.6.1
 - slate-plain-serializer@0.5.24
 - slate-prop-types@0.4.41
 - slate-react@0.14.1
 - slate-schema-violations@0.1.22
 - slate-simulator@0.4.41
 - slate@0.36.0
slate@0.36.0 slate-simulator@0.4.41 slate-schema-violations@0.1.22 slate-react@0.14.1 slate-prop-types@0.4.41 slate-plain-serializer@0.5.24 slate-hyperscript@0.6.1 slate-html-serializer@0.6.15 slate-dev-logger@0.1.41 slate-base64-serializer@0.2.43
2018-07-27 15:50:29 -07:00
Ian Storm Taylor
46a6086968 fix lint 2018-07-27 15:46:35 -07:00
Ian Storm Taylor
d461fdae72 fix sibling validation error names 2018-07-27 15:45:27 -07:00
Ian Storm Taylor
2092981e0c update changelog 2018-07-27 15:40:07 -07:00
Ian Storm Taylor
49ee734241 update changelog 2018-07-27 15:34:40 -07:00
Ian Storm Taylor
764cd12dec update changelog 2018-07-27 15:34:31 -07:00
Ian Storm Taylor
9a6372ca4e update changelog 2018-07-27 15:32:50 -07:00
Ian Storm Taylor
ded82812b0
Refactor schema (#1993)
#### Is this adding or improving a _feature_ or fixing a _bug_?

Improvement.

#### What's the new behavior?

- Tweaking the declarative schema definition syntax to make it easier to represent more complex states, as well as enable it to validate previously impossible things.
- Rename `validateNode` to `normalizeNode` for clarity.
- Introduce `validateNode`, `checkNode`, `assertNode` helpers for more advanced use cases, like front-end API validation of "invalid" fields that need to be fixed before they are sent to the server.

#### How does this change work?

The `schema.blocks/inlines/document` entries are now a shorthand for a more powerful `schema.rules` syntax. For example, this now allows for declaratively validating by a node's data, regardless of type:

```js
{
  rules: [
    {
      match: {
        data: { id: '2kd293lry' },
      },
      nodes: [
        { match: { type: 'paragraph' }},
        { match: { type: 'image' }},
      ]
    }
  ]
}
```

Previously you'd have to use `validateNode` for this, since the syntax wasn't flexible enough to validate nodes without hard-coding their `type`.

This also simplifies the "concatenation" of schema rules, because under the covers all of them are implemented using the `schema.rules` array, so they simply take effect in order, just like everything else in plugins.

#### 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: #1842
Fixes: #1923
2018-07-27 15:27:07 -07:00
Germán Méndez Bravo
d01c441f68 Accept legacy "ranges" additionally to "leaves" (#1990)
* Accept ranges additionally to leaves

For compatibility with older slate JSON documents, additionally to
the new "leaves" property, also accept "ranges" with a deprecation
warning.

* Fix accepting JSON arrays for "ranges" compatibility
2018-07-27 15:13:32 -07:00
Jinxuan Zhu
c64c2ff025 Ensure no deprecate exists in slate-core development (#1991)
* Throw error in test mode

* Ensure process

* Allow deprecate with user config

* Style fix

* fix grammer typo
2018-07-27 15:01:35 -07:00
Ian Storm Taylor
8deecc4461 Publish
- slate-base64-serializer@0.2.42
 - slate-dev-benchmark@0.0.3
 - slate-dev-environment@0.1.3
 - slate-dev-logger@0.1.40
 - slate-hotkeys@0.1.3
 - slate-html-serializer@0.6.14
 - slate-hyperscript@0.6.0
 - slate-plain-serializer@0.5.23
 - slate-prop-types@0.4.40
 - slate-react@0.14.0
 - slate-schema-violations@0.1.21
 - slate-simulator@0.4.40
 - slate@0.35.0
slate@0.35.0 slate-simulator@0.4.40 slate-schema-violations@0.1.21 slate-react@0.14.0 slate-prop-types@0.4.40 slate-plain-serializer@0.5.23 slate-hyperscript@0.6.0 slate-html-serializer@0.6.14 slate-hotkeys@0.1.3 slate-dev-logger@0.1.40 slate-dev-environment@0.1.3 slate-dev-benchmark@0.0.3 slate-base64-serializer@0.2.42
2018-07-27 12:42:43 -07:00
Ian Storm Taylor
01405be31b
add paths to ranges (#1997)
#### Is this adding or improving a _feature_ or fixing a _bug_?

Feature.

#### What's the new behavior?

This pull request adds paths to `Range` objects, including the selection. The paths and keys are kept in sync automatically, so that you can use whichever is ideal for your use case.

This should allow us to use paths for lots of the internal logic, which are much quicker to work with than keys since they avoid having to lookup the key in the document and can just traverse right to the node in question.

#### How does this change work?

`Range` objects have two new properties:

```js
range.anchorPath
range.focusPath
```

(Eventually these will be `range.anchor.path` and `range.focus.path` when points are introduced.)

When operations occur and whenever ranges are created/normalized, the paths are updated and kept in sync with the keys.

#### 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/1408
Fixes: https://github.com/ianstormtaylor/slate/issues/1567
2018-07-27 12:40:04 -07:00