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

201 Commits

Author SHA1 Message Date
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
Hans-Wilhelm Warlo
469d8b394c Refactor render arrow functions (#969) 2017-08-02 09:36:33 -07:00
Ryan Yurkanin
af84cf2511 adding forced-layout-example (#954) 2017-07-31 18:19:45 -07:00
Zach Schneider
f8b103d75e Reckon with inconsistencies between parse5 and native DOMParser (#952) 2017-07-31 18:18:30 -07:00
Zach Schneider
4bbf7487ea Replace cheerio with parse5 (#934)
* Replace cheerio with parse5

* Convert to dependency injection for HTML parser
* Add options.domParser to HTML serializer
* Fallback to native DOMParser if present and no option provided
* Error if no DOM parser is available (option or native)
* Update tests to pass parse5 as config option

* Update test so it passes.
Cheerio interprets `<p><hr /></p>` as one `p` node with a child `hr`
node, but both parse5 and native DOMParser interpret it as 3 nodes: a
blank `p` node, `hr` node, and second blank `p` node. Update test
expectation to match new API.

* Remove cheerio-esque compatibility conversion.

* Use `application/xml` in native DOMParser
Using `text/html` causes it to wrap the fragment in html, body, etc

* Change error message to single line.
Was inserting an undesired newline char

* Add documentation for new `domParser` option to html serializer
Also boyscout missing documentation for `defaultBlockType` option

* Rename `domParser` option to `parseHtml`
Rename the option to make it clearer what it does, since it accepts a
function and not a `DOMParser` analogue object.
2017-07-20 09:46:02 -07:00
mjadobson
31c75590ae Fix Edge Drag & Drop Issues (#923)
* Fix Edge doctype warning

* Remove getData() calls in onDragOver

Access to data within ondragover is prohibited

* Handle Edge errors accessing `dataTransfer.dropEffect`

* Work around Edge not supporting custom data in drag events

If unable to use `setData()` with custom type, then uses JSON obj to store data in 'text/plain'

* Fix more Edge errors

Edge sometimes throws 'NotSupportedError' whena accessing `items` property on `dataTransfer`

* Fix linting errors

* Fix formatting
2017-07-12 08:43:38 -07:00
Samy Pessé
74bf684ec9 Add property "isEmpty" (#863)
* Add property isEmpty to State

* Update hovering menu example

* Document isEmpty

* Improve perf of isEmpty with @Soreine 's suggestion

* Fix return of isEmpty
2017-07-11 13:34:02 -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
Conor Cussell
a3a7949fc4 Add example of using plugin.render to /examples/plugins (#890) 2017-06-21 17:32:32 -04:00
Alex Zajac
da1210da0f Local examples url update (#822)
* Update url when testing locally

When attempting to mess around locally I could never get anything to update. Sure enough I was looking in the wrong place and had missed the `/dev.html` on the end of my url.

Here's to hoping no one else struggles with this again.

* Update Readme.md
2017-05-20 10:58:10 -07:00
Dae-Ho Kim
873f1b1124 Fix json (#798)
Remove comma
2017-05-06 09:19:27 -07:00
Ian Storm Taylor
526d162002 fix large document example imports 2017-05-04 17:14:09 -07:00
Ian Storm Taylor
13a99a9b73 refactor examples, upgrade dependencies 2017-05-04 16:48:42 -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
78fefa1115 update table example to make scope clearer 2017-05-01 11:18:35 -07:00
Craig Michael Thompson
f39c4327fe feat: Add ES6 polyfill to examples page (#729)
* feat: Add ES6 polyfill to examples page

* Fixes issue with IE11 simply not displaying anything on load due to missing `Symbol` shim

* Move script to the bottom before build.prod.js file
2017-04-19 09:03:02 -07:00
Ian Storm Taylor
50593f9335 speed up decorator examples 2017-04-06 11:21:41 -07:00
Ian Storm Taylor
059ee96db8 a handful of performance improvements (#705)
* update large example

* pass block down to <Text> for performance, closes #700

* add get-ranges benchmark

* optimize getRanges(), closes #699

* add serialization benchmarks

* optimize Raw.deserializeRanges() by computing marks once, closes #701

* change .merge calls to .set for performance

* change updateDescendant() to use getAncestors() for memoization

* change getPath() to use getAncestors() for memoization

* switch getTexts() and friends to use arrays while iterating

* rename split-block benchmark

* update benchmark compare script
2017-04-02 14:57:36 -07:00
Ian Storm Taylor
2743348d65 add markdown example, fix selection handling with decorators 2017-03-30 14:12:56 -04:00
Ian Storm Taylor
b0adb9252c cleanup 2017-03-30 12:44:55 -04:00
Ian Storm Taylor
ef81dc856a fix check-lists example 2017-03-30 12:30:33 -04:00
AlbertHilb
f1b147860b Rewrite CheckListItem component. Only the area we really want to be editable (#696)
must lie inside contenteditable elements.
2017-03-30 10:35:01 -04: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
392fd75722 fix getPoint to work around in-editable content 2017-03-29 13:01:16 -04:00
Ian Storm Taylor
30c2b206fb add check list example 2017-03-28 12:55:48 -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