1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-24 17:23:07 +01:00

2976 Commits

Author SHA1 Message Date
Arek Mytych
594e891c32 Make use of clientX and clientY in getEventRange (#2675)
Fixes #2570
2019-04-02 06:24:38 -07:00
Hanna Greaves
c688ad7c72 Allow custom placeholder styles (#2667)
* Allow custom placeholder styles

* lint fixes

* review feedback

* lint
2019-04-02 06:23:50 -07:00
Tom Locke
2380aa094f Clarify semantics of return from deserialize (#2665)
This can trip folks up who are using compile-to-JS languages (ClojureScript in my case), where return semantics may be different.
2019-03-26 07:29:41 -07:00
Aaron Greenlee
edbafa6fcb Glossary Enhancements (#2663)
* Rephrased to removed idiom and better describe Slate.

* Added links to educate folks about the core DOM concepts

* Renamed headline to `Slate Mirrors the Dom`

* Rephrased immutable js introduction

* Corrected spelling error

* Simplified language introducing how one can change values.

* Simplified statement about collection methods

* Added encouraging language for Immutable JS learning suggestion

* Quoted mozilla links

* Suggestions to improve readability of data-model documentation

* Added serialized example value

* Resolved one prettier complaints

* `yarn run prettier`

* anchor/focus point glossary content

* normalized term identifiers

* added mark

* Added plugin

* Added schema

* `yarn run prettier` and enhancements to collapsed, focus, and value
2019-03-26 07:27:48 -07:00
Yoel
02f4850930 Convert remaining Node.get* methods to use paths (#2557)
* tests

* faster getSelectionIndeces by passing path during render

* rename var

* fix variables

* revert node component changes

* revert changes to content

* changes to element and path-utils

* fix point normalize

* cleanup

* more cleanup, clearer getDescendant
2019-03-25 19:54:00 -07:00
Ivan Ha
b3107fc142 docs: fix immutablejs doc domain (#2655) 2019-03-25 19:23:53 -07:00
Ellie Strejlau
98fd922915 Fix error when pasting an image into Slate image example. (#2592)
* Fix error when pasting an image into Slate.

* Change isImage to call getExtension, which uses the URL API. Additionally, make sure JSDocs are consistent.
2019-03-11 11:12:19 -05:00
delijah
b8c372df93 Switched Map to fromJS in order to convert the whole js object (also nested data structures) to immutable (#2619)
Looks like a worthwhile improvement to me @delijah and thanks for contributing the PR. Given that nested data structures are permissible this improved the ease of use.
2019-03-10 21:32:36 -07:00
Ian Storm Taylor
5347fe1f3a Publish
- slate-base64-serializer@0.2.97
 - slate-html-serializer@0.7.36
 - slate-hyperscript@0.11.27
 - slate-plain-serializer@0.6.36
 - slate-prop-types@0.5.27
 - slate-react-placeholder@0.1.15
 - slate-react@0.21.18
 - slate@0.44.12
slate@0.44.12 slate-react@0.21.18 slate-react-placeholder@0.1.15 slate-prop-types@0.5.27 slate-plain-serializer@0.6.36 slate-hyperscript@0.11.27 slate-html-serializer@0.7.36 slate-base64-serializer@0.2.97
2019-03-08 13:43:26 -08:00
Sunny Hirai
89adf63e1f
Android 8 and 9 Support (#2565)
* Allow the dev server to work for non localhost host

* Refactored set-selection-from-dom into utils as prep for Android support

* Show debug onInput at start if triggered

* Added and refactored to use set-text-from-dom-node with improved set selection after input

* Remove unnecessary console.log in set-text-from-dom-node

* Fixes to pass linter

* Adds basic composition to Android API27 including fixing one bug where compositionStart does not fire

* Fix some of the enter handling in API 27 and 28

* Add fixes for API 25

* Add debug for slate:update instead of separate render and updateSelection

* Add API 26 fix for ignoring all but Enter in onKeyDown

* Fix enter on Android 26 and 27

* Revert onSelect bug. Editor API 26 and 27 stable-ish

* Fix enter at beginning and end of word in API 26 and 27

* Fix enter handling at end of line API 26 and 27

* Fix reversion of enter bug when not at end of line

* Rename enter to linefeed which is more accurate

* Fix backspace on Android 27 and 28

* Fix enter at end of line then backspace then enter bug in API 26 and 27

* Refactor to simplify reading code

* Refactor to use executor and fix the suggestion problem

* Fix multi point edit in API 27/28

* Update Android documentation on enter handling

* Fix enter in API 26/27 and document 4 different enter cases

* Refactor partial into SlateSnapshot

* Complete SlateSnapshot refactor

* Remove unnecessary plugin comments

* Add smoke tests

* Rename smoke tests to composition in exmaples

* Fix API28 split join and insertion

* Fix space then backspace in middle of word bug in API 28

* Add text for middle word space and backspace bug

* Add note that the space backspace bug does not exist on API 27

* Fix 'It me. No.' bug in API 26/27

* Fix comments

* Update comments to fit Slate style guide

* Move a debug statement

* Fix zero-width selection placement bug.

* Fix 'it is' then enter in middle of 'it' bug

* Partial fix of enter, backspace, enter in word

* Add and fix comments. Fix selection in zero-width for API26-27

* Fix linting

* Fix documentation

* Remove snapback from packages

* Remove snapback from yarn.lock

* Rename SlateSnapshot to DomSnapshot

* Remove guard on DomSnapshot apply method

* Remove debug plugin from plugins/dom

* Remove unnecessary comment in content.js componentDidUpdate

* Remove closest and add function into dom-snapshot directly

* Remove unused DebugPlugin

* Move Android detection related code into slate-dev-environment

* Capitalize to Number in JSDoc

* Add API version and Input Events Level 2 for Android

* Add input events level 2 for android without matching api version

* Fix line failures
2019-03-08 10:14:52 -08:00
董沅鑫
e0fa49315a Fix examples/tables variable "previous" is null when select text and delete all (#2638) 2019-03-08 12:04:54 -05:00
Yoel
9f2edf9512 Fix move_node dirtyPath and PathUtils.transform calculations (#2593)
* test and changes to test runner for move-node edge case

* fix dirtyPaths calculation for move_node

* prettier

* remove commented out code, remove needless toArray call

* remove test assertion

* more lint fixes

* possibly correct test for deleting all nested blocks

* pretty test

* fix PathUtils.transform edge case with move_node

* tests for PathUtils.transform for some move_node cases

* prettier

* element moveNode also uses PathUtils.transform, fix sibling edge case

* refactor for ease of comprehension

* new edge case test, fix move_node invert

* prettier

* revert last move_node transform case for clarity
2019-03-07 18:08:15 -05:00
Jason Staten
4d0ccc8e81 Fix Edge positioning with newlines (#2622)
* Fix Edge positioning with newlines

Edge has a [bug][1] where `Range.prototype.toString()` will convert `\n`
into `\r\n`. The bug causes a loop when slate-react attempts to
reposition its cursor to match the native position.

This change avoids calling `Range.prototype.toString()` by cloning the
content nodes and measuring `textContent` on those instead.

[1]: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10291116/

* Add COMPAT message
2019-03-07 18:01:59 -05:00
Ian Storm Taylor
bc8de50d99 Publish
- slate-base64-serializer@0.2.96
 - slate-dev-environment@0.2.2
 - slate-hotkeys@0.2.9
 - slate-html-serializer@0.7.35
 - slate-hyperscript@0.11.26
 - slate-plain-serializer@0.6.35
 - slate-prop-types@0.5.26
 - slate-react-placeholder@0.1.14
 - slate-react@0.21.17
 - slate@0.44.11
slate@0.44.11 slate-react@0.21.17 slate-react-placeholder@0.1.14 slate-prop-types@0.5.26 slate-plain-serializer@0.6.35 slate-hyperscript@0.11.26 slate-html-serializer@0.7.35 slate-hotkeys@0.2.9 slate-dev-environment@0.2.2 slate-base64-serializer@0.2.96
2019-03-06 14:30:06 -08:00
Ian Storm Taylor
4557c0fba7 fix === equality for linter 2019-03-06 14:26:41 -08:00
Sunny Hirai
bc256e027a Add API version and Input Events Level 2 for Android (#2618)
* Add API version and Input Events Level 2 for Android

* Add input events level 2 for android without matching api version
2019-03-06 17:13:57 -05:00
Dominic Amato
3dce916074 Use strict equality except for null/undefined for improved performance and behavior (#2514)
* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* undo strict null checking

* remove added semicolons

* Prettier Formatting Changes

* Update .eslintrc

add smart strict equality rule

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert Non-strict to strict equality checking
Convert non-strict equality checking, using `==`, to the strict version, using `===`.

* Convert files to use strict equality

* fix prettier eslint errors

* fix remaining prettier complaints

* use strict null equality in serializer
2019-03-06 16:48:41 -05:00
Mate Paiva
bd7ee85c9b Fix missing break in last example (#2629)
In the last chunk of code, it was missing the `break` (or `return`). So, if used as is, the bold key will toggle the `code` feature as well.
2019-03-06 16:45:08 -05:00
Brendan
646ff2a80f
Fix onCommand docs that referenced query instead of command (#2625) 2019-03-06 15:44:41 -06:00
Mate Paiva
e5e1e570b8 Remove return true on key down function (#2628)
Correct me if I am wrong, but I believe that this `return true` is a no-op. I removed it and everything kept working as usual. And, when I was following the tutorial, that particular line created an interrogation mark in my brain. So, my suggestion is to remove that line to avoid creating entropy for no reason.
2019-03-06 16:44:35 -05:00
Yoel
2740907b7f fix insert fragment with void children (#2624) 2019-03-06 16:41:39 -05:00
Yoel
9dc53c5d82 Fix insert-node-by-key benchmark, add normalize and insert-fragment benchmarks (#2587)
* fix insert-node-by-key benchmark, add normalize-with-problems

* add benchmark for insertFragment

* more fragment benchmarks
2019-03-06 16:35:12 -05:00
Stefan
9c852b7367 Remove reference to deprecated slate-simulator package (#2591) 2019-02-28 12:20:47 -08:00
Brendan
a3f91e139f Add @convertkit/slate-lists to plugins page (#2615) 2019-02-28 12:08:34 -08:00
Marko Grešak
9694b22846 Show View Source link next to example title (#2577)
Add a view source link in Slate's examples to make it easy to see how an example was created
2019-02-19 12:11:17 -08:00
Bryan Haakman
8e659dbd28 Small doc fix for isNodeInRange (#2580) 2019-02-04 16:29:18 -08:00
Ian Storm Taylor
6302b2d9d2 Publish
- slate-base64-serializer@0.2.95
 - slate-dev-benchmark@0.0.5
 - slate-html-serializer@0.7.34
 - slate-hyperscript@0.11.25
 - slate-plain-serializer@0.6.34
 - slate-prop-types@0.5.25
 - slate-react-placeholder@0.1.13
 - slate-react@0.21.16
 - slate@0.44.10
slate@0.44.10 slate-react@0.21.16 slate-react-placeholder@0.1.13 slate-prop-types@0.5.25 slate-plain-serializer@0.6.34 slate-hyperscript@0.11.25 slate-html-serializer@0.7.34 slate-dev-benchmark@0.0.5 slate-base64-serializer@0.2.95
2019-01-30 16:19:34 -08:00
Brendan
58709123dd Add @convertkit/slate-code to docs (#2568) 2019-01-30 12:12:05 -08:00
Yoel
8a0baac696 Fix benchmarks that use value.change (#2569)
* benchmark for large with selection

* inputer -> inputter

* value.change -> editor for slate benchmarks

* use editor in slate-react benchmarks

* prettier

* fix decorations benchmark
2019-01-30 12:10:34 -08:00
Stefan
f677f76559 Improve slate-react-placeholder component. (#2460)
* Improve slate-react-placeholder component.
Now there can be multiple placeholders that do not interfere with each other.
No developer facing changes.

* Fix lint issue

* Unique placeholder marks based on key, not type.
2019-01-29 16:19:43 -08:00
David Gertmenian-Wong
37bab503b4 Use babel-polyfill in place of polyfill.io CDN (#2496)
Update provides support for running the examples app on IE 11.

There appeared to be a number of issues with using `polyfill.io`
with slate. While trying to run the example app on IE 11, I ran
into each of the following:
https://github.com/Financial-Times/polyfill-service/issues/792
https://github.com/Financial-Times/polyfill-service/issues/854
https://github.com/Financial-Times/polyfill-service/issues/1341

`babel-polyfill` provides more robust support for polyfilling and
will allow for better targeting of supported browser envs in the
future (if desired).

Also includes `element-closest` polyfill, which is necessary for
using with IE 11 :(
2019-01-29 16:16:12 -08:00
Brendan
861ba522b8 Prevent default browser scroll on content focus (#2526) 2019-01-29 16:13:46 -08:00
Jason Staten
83e45ac054 Fix mouse refocus in IE 11 (#2535)
* Fix mouse focus in IE 11

In IE11, refocusing by click would cause the editor to immediately lose focus.

Fixes #2364

* Skip delect onFocus for EDGE
2019-01-29 16:11:18 -08:00
Charley DAVID
1564c3a031 Fix dirty path normalization on move_node (#2536)
* Add failing tests on undo nested node merge

* Fix PathUtils transform on move_node operations
2019-01-29 16:10:35 -08:00
phy
1ce7c7cc89 fix(at-range): correct findInsertionNode method throw a type error when there arg is a Text node (#2498) 2019-01-29 16:09:18 -08:00
Yoel
91d46b3529 move_node tests and code clean up (#2555)
* tests

* refactor moveNodeByPath

* refactor element.move_node

* refactor invert.move_node
2019-01-29 16:08:17 -08:00
Konrad Lisiczyński
63cbfb3266 Clarify children access in renderEditor in docs (#2286)
* Clarify children access in renderEditor in docs

* Applied review changes of renderEditor doc update

* Updated renderEditor docs to match Slate 0.43

* Prettified plugins.md
2019-01-29 16:05:03 -08:00
Vritant Bhardwaj
6bf36a35d4 Update link to source (#2497)
The link to the package directory previously lead to a 404 page.
2019-01-29 16:04:05 -08:00
Ian Storm Taylor
391e2cba67
Revert "Android 8.0, 8.1 and 9.0 Support (#2553)" (#2562)
This reverts commit 17cdeae858b4c8a88b408fe743e6d8f2bdcbb72b.
2019-01-28 19:18:03 -08:00
Sunny Hirai
17cdeae858
Android 8.0, 8.1 and 9.0 Support (#2553)
* Allow the dev server to work for non localhost host

* Refactored set-selection-from-dom into utils as prep for Android support

* Show debug onInput at start if triggered

* Added and refactored to use set-text-from-dom-node with improved set selection after input

* Remove unnecessary console.log in set-text-from-dom-node

* Fixes to pass linter

* Adds basic composition to Android API27 including fixing one bug where compositionStart does not fire

* Fix some of the enter handling in API 27 and 28

* Add fixes for API 25

* Add debug for slate:update instead of separate render and updateSelection

* Add API 26 fix for ignoring all but Enter in onKeyDown

* Fix enter on Android 26 and 27

* Revert onSelect bug. Editor API 26 and 27 stable-ish

* Fix enter at beginning and end of word in API 26 and 27

* Fix enter handling at end of line API 26 and 27

* Fix reversion of enter bug when not at end of line

* Rename enter to linefeed which is more accurate

* Fix backspace on Android 27 and 28

* Fix enter at end of line then backspace then enter bug in API 26 and 27

* Refactor to simplify reading code

* Refactor to use executor and fix the suggestion problem

* Fix multi point edit in API 27/28

* Update Android documentation on enter handling

* Fix enter in API 26/27 and document 4 different enter cases

* Refactor partial into SlateSnapshot

* Complete SlateSnapshot refactor

* Remove unnecessary plugin comments

* Add smoke tests

* Rename smoke tests to composition in exmaples

* Fix API28 split join and insertion

* Fix space then backspace in middle of word bug in API 28

* Add text for middle word space and backspace bug

* Add note that the space backspace bug does not exist on API 27

* Fix 'It me. No.' bug in API 26/27

* Fix comments

* Update comments to fit Slate style guide

* Move a debug statement

* Fix zero-width selection placement bug.

* Fix 'it is' then enter in middle of 'it' bug

* Partial fix of enter, backspace, enter in word

* Add and fix comments. Fix selection in zero-width for API26-27

* Fix linting

* Fix documentation

* Remove snapback from packages

* Remove snapback from yarn.lock
2019-01-28 12:30:48 -08:00
Nandu
7a6de8725c Add break in the Switch statement for Custom Formatting Walkthrough (#2550)
The Custom Formatting Walkthrough does not work as expected. When
Ctrl + B is pressed it applies both Bold and Code styles to the
content. This is because of the case statement running beyond
the Bold case due to the absence of a break keyword.
2019-01-21 18:27:43 -08:00
Tom Moor
43ee38e39d Update commands.md (#2551)
Fixed incorrect documentation for `moveToRangeOfNode`
2019-01-21 18:25:09 -08:00
Eric Edem
68e5ff95d9 feat(Examples): improve example navigation (#2450)
* feat(Examples) make tab menu responsive

For small screens, don't show tabs by default. Instead, show a hamburger menu. When clicking the hamburger menu, expand the examples list.
2019-01-11 10:32:06 -08:00
Jinxuan Zhu
44e47d7ffe Refactor duplicate code in mixin (#2529)
* Refactor duplicate code in mixin

* Remove debugger
2019-01-09 19:48:17 -08:00
Akumatus
09db2c93b6 fix unwrapBlockAtRange disorder (#2512) 2019-01-07 10:05:03 -08:00
Sunny Hirai
92c1ffbcd3
Refactor to utils (#2522)
* Refactored set-selection-from-dom into utils as prep for Android support

* Added and refactored to use set-text-from-dom-node with improved set selection after input
2019-01-04 12:02:33 -08:00
Mark Allen
c6a48a1b9e Fix minor typos in example comments (#2507)
No code changes.
2019-01-03 19:25:11 -08:00
Sunny Hirai
48f1bfcb6c
Allow the dev server to work for non localhost host (#2516)
This change is useful in order to access the live updating dev server from a mobile device that is not on localhost. A precursor to getting Android working.
2019-01-03 12:57:33 -08:00
Sunny Hirai
6f41f2e8e9
Fix link to instructions for running examples 2018-12-28 16:19:38 -08:00
Ian Storm Taylor
d9cc247d45 Publish
- slate-base64-serializer@0.2.94
 - slate-html-serializer@0.7.33
 - slate-hyperscript@0.11.24
 - slate-plain-serializer@0.6.33
 - slate-prop-types@0.5.24
 - slate-react-placeholder@0.1.12
 - slate-react@0.21.15
 - slate@0.44.9
slate@0.44.9 slate-react@0.21.15 slate-react-placeholder@0.1.12 slate-prop-types@0.5.24 slate-plain-serializer@0.6.33 slate-hyperscript@0.11.24 slate-html-serializer@0.7.33 slate-base64-serializer@0.2.94
2018-12-11 13:23:21 -08:00