1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-15 20:55:24 +01:00

414 Commits

Author SHA1 Message Date
Ian Storm Taylor
d2f6e06a66 update setters and docs 2018-08-03 15:08:20 -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
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
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
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
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
Dylan Phelan
09c93a6cd4 Initial fixes for IE compat of cloneFragment (#1943)
* Initial fixes for IE compat of cloneFragment

* Used prettier to fix styling

* Removed solutions that can be polyfilled; added COMPAT comment

* Updated FAQ to reflect ideology towards IE

* Update faq.md

* Update faq.md

* Update faq.md
2018-07-19 12:53:38 -07:00
Wout Mertens
eab4361d92 plugins reference: update available properties (#1957) 2018-07-19 12:10:09 -07:00
Enzo Ferey
939787969b Improved slate-simulator docs. (#1972)
* Improved slate-simulator docs.

* Update index.md
2018-07-19 12:08:31 -07:00
Enzo Ferey
31ca817f18 Added onKeyUp event suppor to slate-simulator and updated docs. (#1973) 2018-07-19 12:00:32 -07:00
Enzo Ferey
39d50b39e5 Added slate-instante-replace plugin to docs and direct links to NPM and Yarn for slate plugins. (#1968) 2018-07-19 11:57:26 -07:00
Samy Pessé
0ceefea2e7 Add prop "isFocused" / "isSelected" for custom nodes (#1950)
* Change the definition of isSelected and add isFocused

* Document prop "isFocused"

* Add unit tests for isFocused / isSelected

* Adapt examples

* Lint
2018-07-03 16:07:38 -07:00
Ian Storm Taylor
37418643e2
add start of glossary (#1946)
This is the start of a glossary in the docs for terms that folks might not know when first learning Slate. Hopefully it makes it easier to learn. If anyone wants to help fill it out, that would be amazing. Thanks!
2018-07-02 10:27:35 -06:00
Enzo Ferey
a698d4a74e Added missing paste event handler. (#1942)
Acording to https://github.com/ianstormtaylor/slate/blob/master/packages/slate-simulator/src/index.js onPaste event is suported by slate-simulator.
2018-07-01 15:15:36 -06:00
Ian Storm Taylor
1923888af1
Update resources.md 2018-06-30 15:08:28 -07:00
Jan Vlcek
6518afc83e Update schema rule marks documentation (#1931) 2018-06-23 06:20:28 -07:00
David Chang
2652680850 [core/models] add replaceMark method on Change, tests, docs (#1910)
* [core/models/change] add replaceMark method on Change, tests, docs

* Update change.md
2018-06-21 19:46:40 -07:00
Rik
270321b5dc docs: call correct changes function (#1921) 2018-06-21 19:31:37 -07:00
Ian Storm Taylor
518d299600
Update resources.md 2018-06-19 12:14:53 -07:00
Ian Storm Taylor
91a8f5b393
Update resources.md 2018-06-19 12:14:33 -07:00
Ian Storm Taylor
0d594fe226
Update resources.md 2018-06-19 12:11:21 -07:00
Ian Storm Taylor
93052ca3b9
Update resources.md 2018-06-19 11:56:20 -07:00
Ian Storm Taylor
c3b44dbe57
Update resources.md 2018-06-19 11:54:38 -07:00
Ian Storm Taylor
62240ff484
Update resources.md 2018-06-19 11:53:11 -07:00
Ian Storm Taylor
c8534283e1
Update resources.md 2018-06-19 11:51:40 -07:00
Ian Storm Taylor
efefe6f1db
Update resources.md 2018-06-19 11:51:26 -07:00
Guy Edwards
1385e5c837 Move data desc below data (#1900) 2018-06-14 18:17:15 -07:00
David Chang
844a4c0221 [docs] add Change.normalize into the docs, add some caveats about perf (#1898) 2018-06-13 16:45:37 -07:00
David Chang
73daa94c0a [docs] Add slate-mark-hotkeys plugin to list of plugins (#1885)
* Add slate-mark-hotkeys plugin to list of plugins

* run npm run prettier
2018-06-12 10:42:35 -07:00
David Chang
bcf41a96b4 Update docs (#1893) 2018-06-12 10:42:09 -07:00
Dominic Eden
5b03db6e36 [fix/add-image-details-to-changes-guide] add extra details on how to … (#1870)
* [fix/add-image-details-to-changes-guide] add extra details on how to insert an image into a Slate Value.

* [fix/add-image-details-to-changes-guide] fix linting errors with Prettier

* Update changes.md

* Update changes.md
2018-06-10 16:59:35 -07:00
Dominic Eden
fbd76895b5 [fix/html-serializer-docs-add-class-name-example] add example to the … (#1863)
* [fix/html-serializer-docs-add-class-name-example] add example to the HTML serializer docs on how to use element attributes when serializing and deserializing. I spent a lot of time figuring this out myself so hopefully will save others from having to go through the same process!

* [fix/html-serializer-docs-add-class-name-example] Fix linting errors with Prettier
2018-06-10 16:41:03 -07:00
Sunny Hirai
360c522a45 Update change.md to include setValue (#1670)
* Update change.md

* Update change.md

* Update change.md

* Update change.md

* Update change.md
2018-04-27 15:55:08 -07:00
Jinxuan Zhu
6e6e9cf710 Fix spell check bug (#1753)
* Fix spell check bug by add data-text:true

* Fix spell check bug by spell check add length to a leaf

* Fix tests to use data-text:true for marks

* Rename data-text to data-slate-leaf; Remove setRef; unlift attributes in leaf

* Update examples with data-*

* Add attributes to document

* Fix renderMark in all documents

* Prettier markdown
2018-04-27 14:06:24 -07:00
Nima Mehanian
2dd77c00f1 Update adding-event-handlers.md (#1751)
* Update adding-event-handlers.md

Make clarifying changes to sentence structure and code sample syntax

* Revert to React.Component declaration

* Update adding-event-handlers.md
2018-04-27 14:01:17 -07:00
DamareYoh
a943eada85 added documentation for wrapNodeByKey (#1774)
* added documentation for wrapNodeByKey

* remove extraneous newline

* fixed weird typo!
2018-04-15 17:40:55 +01:00
Mitchel Humpherys
30143adf60 docs: walkthroughs: saving: Fix grammar (#1766)
Should be possessive (you're => your)
2018-04-10 14:59:21 +01:00
Mateo Ochoa
0a2d68a97f Update faq.md (#1750) 2018-04-03 11:31:20 +01:00
Nikolay Kazakov
d2eb362234 Fixed syntax mismatch at normalize method (#1737)
`switch` operator was wrapped around `case` statements
2018-03-28 09:15:12 -07:00
Lars Karbo
c071df36ea add js to markdown ``` code syntax (#1727) 2018-03-26 07:08:28 -07:00
Gabin Aureche
29901f0888 Add missing documentation for rule.marks (#1717) 2018-03-22 14:17:00 -07:00
Francesco Agnoletto
6ad3aada5b Make serialize/deserialize friendlier (#1705) 2018-03-21 15:34:20 -07:00
徐凯
09b15adb96 fix applying-custom-formatting.md demo (#1715) 2018-03-21 14:09:51 -07:00
dmitrizzle
67afc010c3 Added another editor package built on top of Slate (#1707) 2018-03-21 13:15:55 -07:00
Andrew Fleming
6678245fba Fix broken link in schema.md (#1684)
Correct broken link to `slate-schema-violations`
2018-03-03 19:01:40 -05:00
Andrew Fleming
7238c6a82e Improve grammar in schemas.md (#1685)
Grammar correction
2018-03-03 18:59:14 -05:00
Andrew Fleming
91101465fa Update data-model.md (#1682)
Typo corrected
2018-03-03 18:58:30 -05:00