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

227 Commits

Author SHA1 Message Date
Ben Gotow
73392b9596 Update search-highlighting example per #1454 (#1526) 2018-01-12 10:41:17 -08:00
Ian Storm Taylor
68bf8a00bf fix syncing-operations example 2018-01-04 15:38:16 -08:00
Ian Storm Taylor
5444a300b8
rename kind to object for clarity (#1501)
* rename `kind` to `object` for clarity

* add deprecation warning for direct access

* add deprecation warning for node creation
2018-01-04 15:26:53 -08:00
Ian Storm Taylor
65c583f695 update syncing-operations example 2017-11-16 11:53:59 -08:00
Ian Storm Taylor
f1f07da5e5
add immutable operation model, with serialization (#1409)
* add immutable operation model, with serialization

* fix split node operations, and deserializing operations
2017-11-16 11:32:13 -08:00
来诺
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
Yifeng Wang
4e420413bb fix drop on inline void node (#1376) 2017-11-11 15:31:50 -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
Yifeng Wang
bb7e30c5fb Add history example (#1331)
* add history example

* optimize history example

* optimize layout and comments
2017-10-30 09:59:23 -07:00
Yifeng Wang
501ca7c2fa Handle pasting image in Paste HTML example (#1334)
* enable pasting images

* fix typo
2017-10-29 14:30:53 -07:00
Ian Storm Taylor
3b497bc342 remove hard to maintain examples readmes 2017-10-28 16:24:03 -07:00
Ian Storm Taylor
c547a24afb fix plugins example 2017-10-28 15:09:07 -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
8f307b8260
fix to always normalize ancestors of a node (#1310)
* fix to always normalize ancestors of a node

* fix plugins example

* update changelog
2017-10-27 09:36:06 -07:00
Yifeng Wang
2e1f9c8f63 fix table handler args (#1292) 2017-10-26 09:31:53 -07:00
Brandon Johnson
e7b4020ed2 Include Array.prototype.includes polyfill (#1297)
* Include Array.prototype.includes polyfill

In https://github.com/ianstormtaylor/slate/commit/070a700
the `default` feature set was added
and the `Array.prototype.includes` feature removed
from the polyfill.io request.
I think it's great to include the `default` feature set,
but, `Array.prototype.includes` is not included in the `default` set,
so we have to explicitly request it.
IE 11 needs an `Array.prototype.includes` polyfill
in order for the examples to work.

* Update dev.html

* Update index.html
2017-10-26 09:18:02 -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
3b41f11370 fix 2017-10-25 15:01:34 -07:00
Ian Storm Taylor
070a700130 update examples polyfill to use default and es6 2017-10-25 15:01:27 -07:00
Brandon Johnson
092b8a0e5d Request Array.prototype.includes polyfill (#1287)
Slate uses `Array.prototype.includes`
in at least one place:
https://github.com/ianstormtaylor/slate/blob/b558872/packages/slate/src/schemas/core.js#L62

So, request an `Array.prototype.includes` polyfill
from polyfill.io
if the user's browser needs it,
which is the case with IE 11.

Also requests minified JavaScript,
since this code is used
for the slatejs.org website,
and there's no need to serve
non-minified code there.
2017-10-25 14:59:39 -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
b375660aa9 refactor hotkeys to constants, and add transforms (#1251)
* refactor hotkeys to constants, and add transforms

* update hotkey helper
2017-10-17 18:18:27 -07:00
Ian Storm Taylor
a341f4d4eb fix docs pages and plugins example 2017-10-17 09:22:08 -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
fb0bdfa28b fix linter 2017-10-16 20:35:18 -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
f69d2c4a12 remove keyboard data.* properties (#1235)
* update examples and walkthroughs

* deprecate data keyboard properties

* update examples

* add is-hotkey to resources doc

* udpate docs

* update docs

* fix split-block test
2017-10-15 19:23:07 -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
来诺
d4a58543b5 Fix hovering menu (#1230)
* Fix hovering menu example by using ReactDOM.createPortal

* Format

* Fix tests
2017-10-14 13:06:27 -07:00
Ian Storm Taylor
e815c2752c fix findNativePoint in empty blocks, add error reporting to examples 2017-10-13 18:34:35 -07:00
Ian Storm Taylor
5c1d43e3f9 fix block void node spacing, closes #1226 2017-10-13 18:00:51 -07:00
Ian Storm Taylor
a1d2223e36 add syncing-operations example 2017-10-13 16:24:00 -07:00
Ian Storm Taylor
70a008c178 remove dev examples 2017-10-13 15:48:08 -07:00
Ian Storm Taylor
f2550be53e update number of human feet 2017-10-13 15:45:38 -07:00
Ian Storm Taylor
74ee8d11f7 fix markdown-preview example 2017-10-13 15:38:10 -07:00
Ian Storm Taylor
545469ffe0 fix findNativePoint for void nodes 2017-10-13 15:22:16 -07:00
Ian Storm Taylor
8fd46bb599 remove iframes example, since it depends on react internals 2017-10-13 15:05:12 -07:00
Ian Storm Taylor
9d5873ec94 remove react-addons-perf 2017-10-13 15:02:19 -07:00
Ian Storm Taylor
e53cee3942 refactor decorations to use selections (#1221)
* refactor decorations to use selections

* update docs

* cleanup

* add Selection.createList

* fix tests

* fix for nested blocks

* fix lint

* actually merge

* revert small change

* add state.decorations, with search example
2017-10-13 12:04:22 -07:00
AlbertHilb
9bef508d87 Add props.attributes to the element used to render paragraphs. (#1188) 2017-09-27 18:35:06 -07:00
WangChienChieh
2d7642b9d3 Pasting external HTML does not work with Slate example. (#1129) (#1146)
* Pasting external HTML does not work with Slate example. (#1129)

*Due to the upgrade of slate, adjust the way of el.attrs.find to el.href.

* Update index.js
2017-09-21 14:45:24 -07:00
AlbertHilb
5c840c78e1 Reshape void component structure. (#1104)
* Reshape void component structure.
Get rid of offscreen spacer.

* Polish Embeds example `Video` component.

* Fix oversight.

* Force spacer width to be 0.

* Update tests
2017-09-12 08:51:26 -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
Ian Storm Taylor
01bc6944bd fix change logic in embeds example, fixes #1074 (#1078) 2017-09-07 09:04:17 -07:00
Ian Storm Taylor
e51cf5e028 cleanup many things in ./utils (#1061) 2017-09-06 15:27:55 -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
Dan Burzo
786050f732 Introduces state.activeMarks and has add/remove/toggleMark use it instead of state.marks (#990)
* WIP getting raw marks arrays from the current range

* Always handle marksRaw as Array, fixes tests/lint

* Clean up

* Fixes collapsed selection raw marks, simpler _every_ condition, harmonize toolbar buttons in rich-text example

* raw -> perCharacter

* Add tests for toggleMark collapsed selection

* Add .DS_Store to .gitignore

* Added test for toggleMark add in partially marked selection, with and without other marks

* Added docs for state.marksPerCharacter

* replace marksPerCharacter with activeMarks

* Update the other examples

* Clarify getActiveMarksAtRange

* AddMark/RemoveMark to use getActiveMarksByRange

* User activeMarks for toggle§MarkAtRange transform
2017-09-05 17:48:19 -07:00