1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-18 22:24:38 +01:00

55 Commits

Author SHA1 Message Date
来诺
72f49bf6d7 Fix image example's onPaste (#1375)
* Fix image example's onPaste

* Fix lint test

* Add custom onDrop back to support files drop

* Check event type in onDropOrPaste
2017-11-13 11:53:31 -08:00
Ian Storm Taylor
98ed83c23b
Add schema first/last definitions (#1360)
* add `first` and `last` validations to schema

* update docs

* update schema usage in images example

* fix forced-layout example
2017-10-31 21:11:05 -07:00
Ian Storm Taylor
3b497bc342 remove hard to maintain examples readmes 2017-10-28 16:24:03 -07:00
Ian Storm Taylor
adb2678732
Rename "state" to "value" everywhere (#1313)
* rename state to value in slate core, as deprecation

* rename all references to state to value in slate core

* migrate slate-base64-serializer

* migrate slate-html-serializer

* migrate slate-hyperscript

* migrate slate-plain-serializer

* migrate slate-prop-types

* migrate slate-simulator

* fix change.setState compat

* deprecate references to state in slate-react

* remove all references to state in slate-react

* remove `value` and `schema` from props to all components

* fix default renderPlaceholder

* fix tests

* update examples

* update walkthroughs

* update guides

* update reference
2017-10-27 13:39:06 -07:00
Ian Storm Taylor
509d3d50fc remove rendering from schema & make it expressive (#1262)
* split rendering out of schema

* remove default components

* first stab at new schema

* make default normalizations smarter

* revert to forcing defaults to be verbose?

* refactor reason constants

* split nodes into blocks/inlines

* get tests passing

* restructure schema tests

* add parent test

* cleanup

* remove defaults from schema

* refactor schema rule.nodes validation, update example

* embed schema in state objects

* fixes

* update examples, and fixes

* update walkthroughs

* update docs

* remove old schemas doc page

* add more tests

* update benchmarks
2017-10-25 17:32:29 -07:00
Ian Storm Taylor
f42a64ac8f refactor placeholder to use schema (#1253)
* refactor placeholder to use schema

* update placeholder, remove old export

* add maxWidth to prevent overflow

* update docs
2017-10-18 00:23:39 -07:00
Ian Storm Taylor
11b2003f53 Remove data (#1244)
* remove data from event handler signatures

* standardize known transfer types

* add setEventTransfer to docs

* update examples, fix drag/drop

* fix tests and draggable attribute setting
2017-10-16 21:04:16 -07:00
Ian Storm Taylor
b462c2ce19 deprecate data, add getEventRange and getEventTransfer helpers (#1243) 2017-10-16 18:50:29 -07:00
Ian Storm Taylor
6c42f6c9c3 Rename Range to Leaf, and Selection to Range (#1231)
* rename Range to Leaf

* rename Selection to Range

* add findDOMRange, findNode, findRange helpers

* refactor to remove findDropPoint util

* revert findDOMNode to throwing errors

* export new helpers, fix linter

* update docs

* update examples
2017-10-14 15:36:27 -07:00
Ian Storm Taylor
5c1d43e3f9 fix block void node spacing, closes #1226 2017-10-13 18:00:51 -07:00
Ian Storm Taylor
ace9f47930 change slate to be a monorepo using lerna (#1106)
* init lerna, move files into ./packages

* move test files into ./packages

* more moving around

* fill out package.json files

* fixing imports

* more fixing of imports, and horribleness

* convert examples, fix linting errors

* add documentation

* update docs

* get tests passing

* update travis.yml

* update travis.yml

* update travis.yml

* update test script

* update travis.yml

* update scripts

* try simplifying travis.yml

* ocd stuff

* remove slate-core-test-helpers package

* add package readmes

* update reference docs structure

* refactor slate-simulator into its own package

* add docs for new packages

* update docs

* separate benchmarks into packages, and refactor them
2017-09-11 18:11:45 -07:00
Ian Storm Taylor
9fca2d3b9b start removing raw serializer (#1098)
* start removing raw serializer

* convert first tests to use jsx

* simplify jsx tests for raw serializer

* allow for options in raw serializer tests

* add more preserve option tests

* convert plain serializer tests

* convert html serialize

* start converting html deserialize

* add hyperscript util

* remove slate-sugar copy-pasted

* finish converting html deserialize

* convert plugins tests

* update rendering tests

* convert schemas tests

* convert core plugin tests

* update hyperscript utl

* refactor changes test directory structure

* fix changes before migration

* add migrated changes test files

* remove <x- prefixes from migration

* get addMark at-current-range tests passing

* get delete at-current-range tests passing

* remove old tests

* convert deleteForward and deleteBackward

* convert insertBlock, insertInline, insertFragment, insertText

* convert removeMark, setBlock, setInline, splitBlock, splitInline

* add unstaged tests

* convert toggleMark, unwrapBlock, unwrapInline, wrapBlock, wrapInline, wrapText

* convert call, setData

* convert on-selection tests

* remove old on-selection tests

* convert history tests

* convert insertFragmentByKey, insertNodeByKey, insertTextByKey, mergeNodeByKey, moveNodeByKey

* convert removeNodeByKey, removeTextByKey, setMarkByKey, setNodeByKey

* convert splitDescendantsByKey, splitNodeByKey, unwrapBlockByKey, unwrapInlineByKey, unwrapNodeByKey, wrapBlockByKey

* fix tests

* port missing at-range tests to at-current-range

* remove at-range tests

* fix raw serializer tests

* fix linter

* fix to prefer toJSON as the canonical method name

* fix todos

* remove internal references to Raw

* add deprecation helper to Text.fromJSON

* convert examples to not use Raw, and not rely on terse

* remove focus-blur example, rename large document example

* refactor Raw serialize to deprecate, not remove, terse

* deprecate defaultBlockType, toRaw, cleanup serializers
2017-09-10 14:56:03 -07:00
Ian Storm Taylor
16d29db8cb add isSelected prop, cleanup sCU, add custom component reference (#1084)
* add isSelected prop, cleanup sCU, add custom component reference, fixes #1080

* fix custom node reference

* update custom node reference

* remove sCU check for text-only children
2017-09-07 14:33:34 -07:00
Tobias Andersen
7eed37164b Make sure nodes always know if they're selected (#1029)
* Make sure nodes update when their selection change

(cherry picked from commit 3e8744409ea94554faafa1e72415cdfb54b4bc78)

* Update examples of showing selected blocks nodes
2017-09-06 09:07:46 -07:00
Ian Storm Taylor
7470a6dd53 Expose transforms (#836)
* refactor to extract applyOperation util

* change handlers to receive transform instead of state

* change onChange to receive a transform, update rich-text example

* fix stack iterationg, convert check-list example

* convert code-highlighting, embeds, emojis examples

* change operations to use full paths, not indexes

* switch split and join to be recursive

* fix linter

* fix onChange calls

* make all operations invertable, add src/operations/* logic

* rename "join" to "merge"

* remove .length property of nodes

* fix node.getFragmentAtRange logic

* convert remaining examples, fix existing changes

* fix .apply() calls and tests

* change setSave and setIsNative transforms

* fix insert_text operations to include marks always

* cleanup and fixes

* fix node inheritance

* fix core onCut handler

* skip constructor in node inheritance

* cleanup

* change updateDescendant to updateNode

* add and update docs

* eliminate need for .apply(), change history to mutable

* add missing file

* add deprecation support to Transform objects

* rename "transform" to "change"

* update benchmark

* add deprecation util to logger

* update transform isNative attr

* fix remaining warn use

* simplify history checkpointing logic

* fix tests

* revert history to being immutable

* fix history

* fix normalize

* fix syntax error from merge
2017-09-05 18:03:41 -07:00
Hans-Wilhelm Warlo
469d8b394c Refactor render arrow functions (#969) 2017-08-02 09:36:33 -07:00
Samy Pessé
0746582cc4 Fix dragging text in the editor (#884)
* Fix dragging text in the editor

* Only use transfer type "node" when dragging a void node

* Move onDropNode to core plugin
2017-07-11 13:28:45 -07:00
mjadobson
e81f4e24e9 Fix image drop in example (#919)
* Fix image drop in example

Dropped images were being inserted at previous selection rather than drop target.

* Fix linting errors
2017-07-11 13:14:39 -07:00
Ian Storm Taylor
94e0e6254a Copy void (#788)
* Fix getFragmentAtRange to not return early when selection is in void node or collapsed

* Detecting when cut or copy is made in a void node, and not returning early

* Checking if text exists before using it for cut/copy

* Moving inVoidNode check to onCutOrCopy

as per @ianstormtaylor note.

* If/else for dom operations when copying text vs void node

* Adding fragment span to the contents

* more work on copy-pasting void nodes
2017-05-04 14:42:47 -07:00
Ian Storm Taylor
6198708086 change selection updating logic to happen at the top-level, closes #662 2017-03-30 00:41:06 -04:00
Ian Storm Taylor
1511d9f203 fix caching logic for onDocumentChange and onSelectionChange, fixes #614 #553 #538 2017-02-28 15:25:55 -08:00
Ian Storm Taylor
64b1e542b8 refactor the Selection model, deprecating old methods (#631)
* refactor Selection, deprecating old methods

* fix a few more things

* introduce an alternative for moveToOffsets

* add edge methods for move{start/end}OffsetTo

* fix selection return value

* fix deprecation warnings

* refactor transforms to make auto-generating easier

* refactor and deprecate selection transforms

* remove deprecation warnings from tests

* fix deprecation warnings in examples
2017-02-27 12:55:13 -08:00
Ian Storm Taylor
8f92ec6a6d fix linting 2017-02-25 12:55:31 -08:00
Per-Kristian Nordnes
c456c9dbe1 Image example: fix delete bug. Fixes #625 (#628)
As void-nodes now can be deleted, use a schema rule to normalize the document, and insert a paragraph when empty. Delete old "onDocumentChange" handler.
2017-02-25 12:50:52 -08:00
Ian Storm Taylor
6f67ac70c9 fix linting 2016-11-17 18:10:30 -08:00
Soreine
a319499f7c Enforce 2-spaces indentation 2016-11-10 11:04:49 +01:00
Soreine
ce0a5579e7 Remove a most of unused vars 2016-10-25 13:12:10 +02:00
Nicolas Gaborit
f87e4dc72b Remove old snapshot parameter for Transform.apply (#361) 2016-10-04 12:19:31 -07:00
Suwijak Chaipipat
b7f317ac4b Unset selection before remove node (#316) 2016-09-14 14:48:21 -07:00
Ian Storm Taylor
ccac6102a5 fixes 2016-08-14 13:21:46 -07:00
Ian Storm Taylor
454bc8020b add full support for file data transfers 2016-08-09 12:25:08 -07:00
Ian Storm Taylor
9a70188f34 loosen default shouldComponentUpdate for nodes, and make Void implicit 2016-08-04 14:12:27 -07:00
Ian Storm Taylor
789c4b3002 fix void leaf selection handling 2016-08-01 18:26:27 -07:00
Ian Storm Taylor
d20b8511bb refactor onKeyDown to use data object 2016-07-27 16:22:11 -07:00
Ian Storm Taylor
569e940fd1 add node component, cleanup draggable/void interactions 2016-07-25 16:46:17 -07:00
Ian Storm Taylor
d78ddeabad update examples for terse raw 2016-07-25 14:45:37 -07:00
Ian Storm Taylor
3bd000d118 add draggable nodes, first steps 2016-07-24 18:04:11 -07:00
Ian Storm Taylor
e80799252f add always ending in paragraph to image example 2016-07-22 21:28:28 -07:00
Ian Storm Taylor
31782cb11a remove selection state handling from image block in examples 2016-07-22 13:28:38 -07:00
Ian Storm Taylor
03393dabfb change void blocks to not be added automatically, and to handle focus 2016-07-22 13:24:22 -07:00
Ian Storm Taylor
6993b0c666 change a few examples to omit ranges for cleanliness 2016-07-21 16:41:35 -07:00
Ian Storm Taylor
ed6000b210 remove is-image-url dev dep since it isnt backwards compatible 2016-07-19 11:22:09 -07:00
Ian Storm Taylor
826956c2c9 fix "secret" behavior of image example 2016-07-18 16:34:28 -07:00
Ian Storm Taylor
d8783d618a add more example readmes 2016-07-14 16:31:55 -07:00
Ian Storm Taylor
ab12518a4b clean up examples 2016-07-13 16:19:49 -07:00
Ian Storm Taylor
3d33ab3da2 add plain text serializer 2016-07-13 14:55:41 -07:00
Ian Storm Taylor
510eb63d8d fixes 2016-07-12 21:14:21 -07:00
Ian Storm Taylor
2f4c8726e0 add attributes props in examples 2016-07-11 18:39:45 -07:00
Ian Storm Taylor
db1151bd15 add linting to examples 2016-07-07 08:35:13 -07:00
Ian Storm Taylor
de4afd38b1 cleanup renderers in examples, fixes #43 2016-07-06 14:42:59 -07:00