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

331 Commits

Author SHA1 Message Date
Ian Storm Taylor
8478c0291b Publish
- slate-html-serializer@0.6.0
2018-03-22 14:56:27 -07:00
Ian Storm Taylor
d33e9139c9 update changelog 2018-03-22 14:55:43 -07:00
Justin Weiss
dce7e2c439 Allow null return values, which will skip serializing that node (#1699)
Sometimes, I have nodes that only make sense temporarily, so it
doesn't make sense to serialize them. Following the pattern in React,
explicitly returning `null` from a serialzation rule should result in
that node (and its children) not making it into the serialized document.
2018-03-22 14:54:35 -07:00
Ian Storm Taylor
86af03dd30 Publish
- slate-base64-serializer@0.2.28
 - slate-html-serializer@0.5.9
 - slate-hyperscript@0.5.9
 - slate-plain-serializer@0.5.9
 - slate-prop-types@0.4.26
 - slate-react@0.12.3
 - slate-schema-violations@0.1.7
 - slate-simulator@0.4.26
 - slate@0.33.3
2018-03-22 14:51:41 -07:00
Ben Southgate
804ea5d4d0 fix: ensure that offset is positive in findDomRange (#1719) 2018-03-22 14:48:09 -07:00
Stan Chang Khin Boon
bff3d34a2d Don't stop propagation of drop event (#1716)
Summary:

We mirrored the fix in PR #1278 (meant for #1277) but for drop event.
This fixed an issue I faced with Slate swallowing drop event, kind of breaking compatibility with react-dnd.

/cc @AlbertHilb
2018-03-22 14:22:57 -07:00
urugator
3fe60f3795 Fix node.isEmpty (#1718)
* add test for normalization of nested empty inlines

* fix normalization of nested empty inlines

* add test for normalization of inlines with empty void

* fix normalization of inlines containing empty void

* fix linting errors

* Fix node.isEmpty to work properly with void nodes of zero text length

* Take adavantage of fixed node.isEmpty to simplify normalization of empty inlines

* Fix linting errors
2018-03-22 14:22:03 -07:00
Ian Storm Taylor
b17bf1a7b9 Publish
- slate-base64-serializer@0.2.27
 - slate-html-serializer@0.5.8
 - slate-hyperscript@0.5.8
 - slate-plain-serializer@0.5.8
 - slate-prop-types@0.4.25
 - slate-react@0.12.2
 - slate-schema-violations@0.1.6
 - slate-simulator@0.4.25
 - slate@0.33.2
2018-03-21 16:58:48 -07:00
Ian Storm Taylor
36c7f4fc32 fix peerDependencies in slate packages, closes #1690 2018-03-21 16:56:20 -07:00
Ian Storm Taylor
0587a5f916 Publish
- slate-base64-serializer@0.2.26
 - slate-html-serializer@0.5.7
 - slate-hyperscript@0.5.7
 - slate-plain-serializer@0.5.7
 - slate-prop-types@0.4.24
 - slate-react@0.12.1
 - slate-schema-violations@0.1.5
 - slate-simulator@0.4.24
 - slate@0.33.1
2018-03-21 16:38:29 -07:00
Jinxuan Zhu
c569569729 Perhaps faster normalization: Never visit a descendant twice in normalizaton (#1661)
* Perhaps faster normalization: Never visit a descendant twice in normalizaton

* Change getFirstInvalidaDescendantKey to getFirstInvalidaDescendant

* Add from-JSON-big in benchmark

* Better annotation

* Remove un-used test change
2018-03-21 15:36:25 -07:00
Jinxuan Zhu
ecc165740d Fix skip this in getFurtherstLonelyAncestor (#1628)
* Fix skip this in getFurtherstLonelyAncestor

* export runTest in models/

* Change the path of test getOnlyChildAncestor

* Update index.js

* Update get-furthest-only-child.js

* Fix for linting
2018-03-21 15:26:56 -07:00
vilicvane
44d8021921 Fix #474 (#1700)
e0978a31e9 (commitcomment-28060594)
2018-03-21 14:09:04 -07:00
urugator
edb7c3bd3c Fix normalize empty inline (#1698)
* add test for normalization of nested empty inlines

* fix normalization of nested empty inlines

* add test for normalization of inlines with empty void

* fix normalization of inlines containing empty void

* fix linting errors
2018-03-21 14:08:15 -07:00
nschlehe
8689c671f6 Add key prop to <br /> elements in html-serializer (#1704) 2018-03-21 13:15:29 -07:00
Ian Storm Taylor
257580052d Publish
- slate-base64-serializer@0.2.25
 - slate-html-serializer@0.5.6
 - slate-hyperscript@0.5.6
 - slate-plain-serializer@0.5.6
 - slate-prop-types@0.4.23
 - slate-react@0.12.0
 - slate-schema-violations@0.1.4
 - slate-simulator@0.4.23
 - slate@0.33.0
2018-02-21 18:12:43 -08:00
Ian Storm Taylor
2e2ab66b60 update changelogs 2018-02-21 18:11:54 -08:00
Ian Storm Taylor
38020c73a6 fix deprecated kind usage in leaf components 2018-02-21 18:05:54 -08:00
Ian Storm Taylor
514f3de1be
remove the void text content restriction, closes #1504 (#1663) 2018-02-21 18:03:41 -08:00
Zach Schneider
c5f0626a05 Convert setBlock and setInline to plurals for more intuitive naming. (#1558) 2018-02-21 18:03:30 -08:00
Ian Storm Taylor
35f96c27d4 Publish
- slate-react@0.11.6
2018-02-21 17:54:46 -08:00
Tom Moor
670ef391a8 Account for text being null in an onDrop event (#1647) 2018-02-21 16:54:28 -08:00
Ian Storm Taylor
fba5bc73e4 Publish
- slate-base64-serializer@0.2.24
 - slate-html-serializer@0.5.5
 - slate-hyperscript@0.5.5
 - slate-plain-serializer@0.5.5
 - slate-prop-types@0.4.22
 - slate-react@0.11.5
 - slate-schema-violations@0.1.3
 - slate-simulator@0.4.22
 - slate@0.32.5
2018-02-21 15:07:33 -08:00
Irwan Fario Subastian
1269be7ba8 Fix marks of undefined on char.marks (#1643)
* fix typo on getMarksAtCollapsedRangeAsArray

* making sure that char is defined on char.marks
2018-02-21 12:40:02 -08:00
Blake Embrey
07788eb2d9 Replace zero width blocks with newline before copy (#1644)
* Replace zero width blocks with newline before copy

* Fix linting issue

* Fixing linting again, sorry Github
2018-02-21 12:38:56 -08:00
Jinxuan Zhu
1776d8e64c Fixing the bug that getMarks steals mark from the previous block (#1645) 2018-02-21 12:36:34 -08:00
Julien Poissonnier
324a025ee9 Remove redundant memoization (#1630)
* Remove memoization from node.getKeys

* Remove memoization from methods that are directly backed by AsArray variants

* Remove memoization from hasChild/Descendant/Node

These are thin wrappers on top of functions that are themselves
memoized.
2018-02-21 12:32:29 -08:00
Julien Poissonnier
e3abba0a29 Fix drag and dropping a node "forward" in the document (#1621)
When drag and dropping a node to a position earlier in the document,
the node is inserted and then removed right after.
Regenerate the key to make sure the old node is removed instead of the
new one.
2018-02-12 14:36:51 -08:00
Jinxuan Zhu
f7546d3c7c Fix getInsertMarksAtRangeAsArray for empty Text Node (#1614) 2018-02-08 17:13:05 -08:00
Francesco Agnoletto
5cec47541d Fix triple selection extending to next block (#1605)
* Fix triple selection extending to next block

* Remove unused startOffset

* Add Iscollapsed check to prevent failing setBlock on initial block position

* Fix across-blocks.js test

* Test new hanging selection behaviour

* Lint

* Revert e902fa1acbbcec94a82474b5fea86923c8f2c5ad

* Lint

* Use ternary operator instead of if/else
2018-02-08 17:10:46 -08:00
Ian Storm Taylor
0df151ee52 Publish
- slate-base64-serializer@0.2.23
 - slate-dev-logger@0.1.39
 - slate-html-serializer@0.5.4
 - slate-hyperscript@0.5.4
 - slate-plain-serializer@0.5.4
 - slate-prop-types@0.4.21
 - slate-react@0.11.4
 - slate-schema-violations@0.1.2
 - slate-simulator@0.4.21
 - slate@0.32.4
2018-02-07 10:54:52 -08:00
Ian Storm Taylor
043e1a5fb5 fix require issue in bundle, add sourcemaps 2018-02-07 10:53:44 -08:00
Renaud Chaput
de4c9e478a Lint JSON, CSS and Markdown files with Prettier (#1612)
* Process and Lint CSS, Markdown and JSON files with Prettier

* Run `yarn prettier` to re-format Markdown, CSS and JSON files
2018-02-07 07:58:41 -08:00
Ian Storm Taylor
6df92950ab Publish
- slate-base64-serializer@0.2.22
 - slate-dev-logger@0.1.38
 - slate-html-serializer@0.5.3
 - slate-hyperscript@0.5.3
 - slate-plain-serializer@0.5.3
 - slate-prop-types@0.4.20
 - slate-react@0.11.3
 - slate-schema-violations@0.1.1
 - slate-simulator@0.4.20
 - slate@0.32.3
2018-02-06 19:59:47 -08:00
Ian Storm Taylor
1340d3d915 fix benchmarks by exposing memoization utils 2018-02-06 19:58:11 -08:00
Renaud Chaput
3339d088e1 Add Prettier with ESLint integration (#1589)
* Add Prettier, with basic config and ESLint integration

* Apply Prettier to all files using `yarn lint --fix`

* Tell Prettier to ignore an empty text in a test output.

* Run Prettier on JS files not handled by ESLint, and lint them too
2018-02-06 15:12:00 -08:00
Jinxuan Zhu
f28c59a26e Use getAncestors in getDescendant (#1604) 2018-02-06 14:12:48 -08:00
Tobias Andersen
329787a07a fix(updateSelection): make sure there is a node to extend from (#1603)
* fix(updateSelection): make sure there is a node to extend from

* fix(updateSelection): use setBaseAndExtent over collapse/extend
2018-02-06 14:07:41 -08:00
DamareYoh
eda5c02e79 Bugfix/undo merge node (#1594)
* fixed build for windows

* fixed issue where undo of merge node does not restore the node back to its original properties

* fixed lint issue

* updated operation docs for additional property on split_node and merge_node

* finished incomplete sentence in the docs.

* updated test to also verify data is restored

* renamed the 'original' property to 'properties' to be more consistent with similar operation interfaces, updated docs

* got rid of extra operations property.

* deserializing properties in merge_node and split_node, passing properties object in splitNodeByKey

* missed committing operations modles.

* updated operations.toJSON for new properties on merge_node and split_node

* fix linting error

* remove outdated comment.

* expanded check for split node inverse to include inline nodes

* partially revert update to test with deletion across inlines
2018-02-05 10:16:55 -08:00
Zach Schneider
228b97ff29 Switch to using Rollup for bundling (#1568)
* Implement first working rollup config for main slate pkg

* Convert slate-base64-serializer to rollup

* Convert slate-dev-logger to rollup

* Convert slate-html-serializer to rollup

* Convert slate-hyperscript to rollup

* Convert slate-plain-serializer to rollup

* Convert slate-prop-types to rollup

* Convert (mostly) slate-react to rollup

* Convert slate-simulator to rollup

* Misc cleanup and configuration tweaks/fixes

* Convert slate-schema-violations to rollup

* Successful rollup build for top-level examples

* Add plugin to replace process.env.NODE_ENV

* Only rebuild modules and dev examples in watch mode

* Enable sourcemaps for development builds

* Force debug to use browser version, remove builtins plugin

* Remove is-image from example
It relies on node `path` and wouldn't work well in-browser anyway

* Use browser version of react-dom/server

* Move stray require to import

* Configure examples to watch child package output

* Fix tests

* Remove unneeded preferBuiltins from resolve config

* Use more precise files array to ensure sourcemaps aren't included

* Use lodash instead of lodash.throttle
It's pulled in anyway since slate-react needs slate, so using the
minipackage actually causes code duplication

* Improve naming/fix UMD builds, update UMD doc

* Add rollup configs to linting, add a missing dep to package.json

* Use longform rollup CLI flags

* Add rollup-plugin-auto-external to reduce external module configuration

* Combine rollup config into a unioned helper

* Centralize to a single rollup configuration

* Update dist structure and package field naming for PR feedback

* Add comments and address PR feedback on rollup config

* i.e. -> e.g.

* Add some spacing to the configuration to improve readability

* Add a bit more spacing

* Remove umd from example Slate unpkg link
2018-02-02 15:46:36 -08:00
Jamie Talbot
c044d048ad Warn during normalization when range offsets are not numbers. (#1578) 2018-02-02 10:19:01 -08:00
Jinxuan Zhu
566c71c1d1 Fix range.moveToRangeOf when range is a backward range; (#1575)
* fix range.moveToRangeOf when isBackward

* add test for unwrapBlock with backward selection

* Always return isBackward:false in moveToRangeOf

* Update range.js
2018-01-31 13:01:58 -08:00
Conor Cussell
1ea96baf9f Fix selecting with shift+(left|right) key (#1570)
* Account for zero-width whitespace chars when selecting with arrow keys

* Change the correct line 😳

* Remove unused const

* Fix lint error

* Proper fix for shift select towards void nodes
2018-01-31 13:01:43 -08:00
Jinxuan Zhu
b1e5330ad5 Continue normalize next child when and only when the node exists still (#1538)
* Continue normalize next child when and only when the node exists still

* use the refindNode and refindPath provided

* Use Array.includes instead of Array.indexOf
2018-01-31 12:59:58 -08:00
Kelly Joseph Price
28450334a7 Edge browser selection edge case (#1574)
* Handle Edge browser selection case

* Re-use const
2018-01-30 18:09:39 -08:00
Jinxuan Zhu
2a1da72c70 Faster (but also safe) method about re-find node by path (#1548) 2018-01-30 18:05:43 -08:00
Ian Storm Taylor
44eccca60a Publish
- slate-base64-serializer@0.2.21
 - slate-dev-logger@0.1.37
 - slate-html-serializer@0.5.2
 - slate-hyperscript@0.5.2
 - slate-plain-serializer@0.5.2
 - slate-prop-types@0.4.19
 - slate-react@0.11.2
 - slate-schema-violations@0.1.0
 - slate-simulator@0.4.19
 - slate@0.32.2
2018-01-26 12:34:47 -08:00
Ian Storm Taylor
598513a5fc fix linter 2018-01-26 12:33:54 -08:00
Ian Storm Taylor
4db6b1d7fe update docs 2018-01-26 12:31:51 -08:00
Ian Storm Taylor
b8ca5d04df update docs 2018-01-26 12:31:15 -08:00