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

817 Commits

Author SHA1 Message Date
Justin Weiss
6269fcaa71 Drop dragged nodes into the correct place (#3001)
When drag-and-dropping nodes within the same editor, the removal of
the dragged nodes can cause paths and offsets to change. This is
really hard to compensate for.

Instead of compensating for it, rearranging the order things happen
mean we are always working with a document in a reasonable state.

Now, we:

1. Fire a MouseUp event on `event.target` (because we haven't done
   anything, it's guaranteed to exist)
2. Save the range we're dragging (for later)
3. Select the target range (because we haven't deleted anything, this
   is still valid)
4. Delete the range we're dragging (this will automatically adjust the
   editor's selection)
5. Insert the dragged fragment at the current range

No matter where we're dragging from or to, these should all be
pointing at places that both exist, and haven't changed.
2019-09-08 10:06:19 -07:00
Ian Storm Taylor
c42d84dbf6 Publish
- slate-base64-serializer@0.2.111
 - slate-html-serializer@0.8.10
 - slate-hyperscript@0.13.8
 - slate-plain-serializer@0.7.10
 - slate-prop-types@0.5.41
 - slate-react-placeholder@0.2.8
 - slate-react@0.22.8
 - slate@0.47.8
2019-08-27 10:31:30 -04:00
Stan Gurenkov
de376d79b8 Fix several undo/redo issues related to selection operation (#2948)
Should fix the following issues: #2891, #2729
2019-08-22 14:28:13 -04:00
Yue
6e56932ee4 fix React warnings on renderMark, renderBlock, renderDecoration (#2974)
* fix React warnings on renderMark, renderBlock, renderDecoration

* included decorateNode and relocated code into constants in EventHandler

* Put decorateNode and render handlers into a seperate file.

* fix indentation

* overlooked indentation.
2019-08-22 12:50:32 -04:00
Ian Storm Taylor
1f673a9b43 Publish
- slate-base64-serializer@0.2.110
 - slate-html-serializer@0.8.9
 - slate-hyperscript@0.13.7
 - slate-plain-serializer@0.7.9
 - slate-prop-types@0.5.40
 - slate-react-placeholder@0.2.7
 - slate-react@0.22.7
 - slate@0.47.7
2019-08-21 22:45:19 -04:00
themithy
1895c6696f Fix extracting relative ranges from decorations. (#2970) 2019-08-21 22:42:43 -04:00
themithy
f4283866f2 Fix range normalization in remove node. (#2971) 2019-08-21 22:42:07 -04:00
kay delaney
9c2d55e800 deleteBackwardAtRange now works when offset is equal to n (#2966)
* deleteBackwardAtRange now works when offset is equal to n
Closes #2965

* Adds test to verify behaviour of `deleteBackwardAtRange` when offset===length
2019-08-21 22:41:21 -04:00
themithy
9a2b53e81c Fix rendering of collapsed annotation at offset zero. (#2918) 2019-08-21 22:39:58 -04:00
Charley DAVID
2ea6d40ad0 Fix improper selection after insertFragment (#2976)
* Fix typo & remove useless check

* No need to check the end of the selection, as this part is called after the
  `deleteExpanded` call. Selection is collapsed at this point.

* Fix insertFragment selection not place properly
2019-08-21 22:39:38 -04:00
Ian Storm Taylor
3ed981aedf Publish
- slate-base64-serializer@0.2.109
 - slate-html-serializer@0.8.8
 - slate-hyperscript@0.13.6
 - slate-plain-serializer@0.7.8
 - slate-prop-types@0.5.39
 - slate-react-placeholder@0.2.6
 - slate-react@0.22.6
 - slate@0.47.6
2019-08-19 12:41:58 -04:00
themithy
ff831eba7d Deduplicate dirty paths for normalization. (#2916)
* Deduplicate dirty paths for normalization.

* Update editor.js
2019-08-19 10:37:38 -06:00
Yulong Ruan
8ab49c04c4 fixed #1237 which calls Selection.getRangeAt(0) when Selection.type = 'None' (#2920)
it should check the latest rangeCount, not the previous memorized one
2019-08-19 10:24:49 -06:00
Stan Gurenkov
65796c8ba0 insertTextByPath should replace marks on the inserted text with the once that are provided (#2936)
It were trying to add those marks that are passed to the function to the existing once,
but it should replace them instead.

Example error behavior was:
* put cursor at the end of the marked text
* toggle marks
* enter text

expected:
text is being added without toggled marks

actual:
text is added with those marks applied
2019-08-19 10:23:46 -06:00
Brendan
6672f553e9 Mutate newDirtyPaths instead of creating a new array every iteration (#2559)
* Mutate newDirtyPaths instead of creating a new array every iteration

* Switch to map + Array.prototype.concat.apply to improve readability

* Update editor.js
2019-08-19 10:19:24 -06:00
Charley DAVID
0edcc89692 Fix splitNode range updates when selection is backward (#2938) 2019-08-19 10:17:07 -06:00
Charley DAVID
b6a99ce752 Fix removing marks generate useless operations (#2946) 2019-08-19 10:12:55 -06:00
lin onetwo
5686c3d8cc fix: Unknown event handler property onEvent (#2925)
* fix: Unknown event handler property `onEvent`

```
index.js:1 Warning: Unknown event handler property `onEvent`. It will be ignored.
	in div (created by Content)
    in Content (created by Editor)
```

* fix: make onEvent required

Seems this prop is provided in `component/editor.js`
2019-08-19 10:09:08 -06:00
lakatosandrei
6aba4260f8 fix(firefox): fixed the bug that happens when changing the focus from one field to another (#2236)
* fix(firefox): fixed the bug that happens when changing the focus from one field to another

* Publish

 - slate-base64-serializer@0.2.69
 - slate-html-serializer@0.7.8
 - slate-hyperscript@0.10.8
 - slate-plain-serializer@0.6.8
 - slate-prop-types@0.4.67
 - slate-react@0.18.11
 - slate-simulator@0.4.67
 - slate@0.41.3

* Publish

 - slate-base64-serializer@0.2.70
 - slate-html-serializer@0.7.9
 - slate-hyperscript@0.10.9
 - slate-plain-serializer@0.6.9
 - slate-prop-types@0.4.68
 - slate-react@0.18.12
 - slate-simulator@0.4.68
 - slate@0.41.4

* Publish

 - slate-react@0.18.13

* Revert "Fix an occasional crash in Firefox in isInEditor (#2229)"

This reverts commit 1ff050265bbcb8e6d5b5bbf9dc8839f1c6a2ddef.

* fix(firefox): added postinstall script to the main project

* fix(firefox): removed error causing line

* fix(firefox): added the right fix for this

* fix(firefox): added the best fix for this

* fix(firefox): made the range a constant

* fix(firefox): added the removeAllRanges inside the if wrapper

* fix(lint): fixed lint error

* fix(versions): removed changes for the package.json files

* fix(versions): removed remaining changes for the package.json files

* fix(conflict): fixed the issue that resolving the conflicts caused last time

* fix(lint): fixed the last lint error

* chore(content): moved comment in setTimeout to see why git is not showing conflicts locally
2019-08-19 10:08:22 -06:00
themithy
5c4e4f9548 Add annotation-related ops to path.transform. (#2) (#2915) 2019-08-19 10:04:30 -06:00
themithy
d4b003862d Add point normalization to addAnnotation. (#2914) 2019-08-19 10:03:49 -06:00
Ian Storm Taylor
2304df2f50 Publish
- slate-base64-serializer@0.2.108
 - slate-html-serializer@0.8.7
 - slate-hyperscript@0.13.5
 - slate-plain-serializer@0.7.7
 - slate-prop-types@0.5.38
 - slate-react-placeholder@0.2.5
 - slate-react@0.22.5
 - slate@0.47.5
2019-08-19 11:35:20 -04:00
Nadeem Shaik
b1af2d3dc8 Add prop to optionally enable grammarly (#2855) 2019-07-03 13:04:58 -07:00
themithy
9e2e2a1cc5 Fix bugs in getRelativeRange. (#2872) 2019-07-03 13:03:26 -07:00
Sunny Hirai
7d4062cde9
Add Android 8 and 9 compatibility using Mutations (#2853)
* Add debug-mutations

* Fix linting

* Add debug-mutations to o core plugins

* Fix debug output

* Add comment about debug statement

* Add comment explaining the building of debug output object

* Add framework for mutations and mutation observer

* Working splitBlock and mergeBlock

* many things working but not autocorrect

* All later tests pass

* Before adding isComposing to composition-manager

* Fixit

* fix enter enter backspace backspace

* Pass all tests except space-back-space-back

* Passes all tests I think but doesn't continuous backspace or select delete

* Passes all tests and delete selection work

* Fix for merge

* Passes all tests including typing hello world on new line and enter

* Before switching to a function

* Fix enter after last char

* Fix it wasn't me. no. bug

* Remove timeout delay on compositionEnd and everthing works except it wasnt me. no.

* Passes all tests but need to add tests for delete all and select delete

* Pass all tests

* Fix  remove selection

* Added flush onCompositionEnd just in case

* Fix bugs for Android 8 split join and fix side effects on Android 9 to that fix

* Add comments to composition manager

* Clean up code

* Fix bug with delete range

* Add comments

* Fix focus lost bug on change examples

* Improve comments

* Rename clear to clearAction and a comment

* Rename lastEl to last.rootEl

* Remove isListening

* Rename vars

* Fix bug where changing to new example during a composition messes up update

* Add comment to switching examples in composition fix

* Improve comments

* Refactor

* Refactor removeNode

* Remove unused event callbacks

* Refactor connect

* Cleanup mutation plugin

* Remove unnecessary comments

* Remove readme

* Refactor ReactPlugin

* Refactor plugins and injection locations

* Remove dom-observer

* Remove is-input-data helpers

* Move fixSelectionInZeroWidthBlock

* Fix some linting and also a composition manager bug

* Fix linting and remove placeholder on Android

* Refactor

* Update composition-manager description

* Fix comment on composition manager

Co-Authored-By: Nick Anderson <tetramputechture@gmail.com>
2019-06-12 16:14:00 -07:00
Nadeem Shaik
5471343ae8 Fixed mentions example (#2877) 2019-06-12 11:07:35 -07:00
Ian Storm Taylor
67e397100e Publish
- slate-base64-serializer@0.2.107
 - slate-html-serializer@0.8.6
 - slate-hyperscript@0.13.4
 - slate-plain-serializer@0.7.6
 - slate-prop-types@0.5.37
 - slate-react-placeholder@0.2.4
 - slate-react@0.22.4
 - slate@0.47.4
2019-06-07 11:11:42 -07:00
Justin Weiss
af8a0baafe Fix several errors in the deprecated getEventRange (#2847)
This version of the method has drifted from `editor.findEventRange`,
and now crashes when it's being used. This commit fixes an import and
changes some code to match the new code in `editor.findEventRange`.
2019-06-07 18:57:08 +01:00
Guillaume Racicot
52027ff270 Corrected placeholder alignement on chrome (#2836) 2019-06-07 18:54:19 +01:00
Sunny Hirai
f15538d6a5
Normalize target node in debug mutations (#2845)
* Normalize target node in debug mutations

* Added comments and fixed linting
2019-05-30 16:07:04 -07:00
Sunny Hirai
d2f9b4167c
Improve debug mutations plugin (#2844) 2019-05-29 18:03:42 -07:00
Sunny Hirai
78264cf117
Hook debug-mutations into lifecycle events (#2841) 2019-05-28 18:10:50 -07:00
Sunny Hirai
2265240c04
Removed pseudo-event object from lifecycle events (#2840) 2019-05-28 17:48:40 -07:00
Sunny Hirai
2634c58e32
Add render event for plugins (#2834) 2019-05-27 18:34:00 -07:00
Sunny Hirai
2ec21e7fc4
Add 3 lifecycle event handlers (#2833) 2019-05-27 15:04:59 -07:00
Sunny Hirai
80212943cc
Fix Hot Module Reload for plugins (#2825)
* Fix HMR for plugins

* Use TheReactPlugin in resolveController argument inside method
2019-05-22 18:57:29 -07:00
Sunny Hirai
96cb419ccb
Second attempt at Debug Mutations (#2823)
* Add debug-mutations

* Fix linting

* Add debug-mutations to o core plugins

* Fix debug output

* Add comment about debug statement

* Add comment explaining the building of debug output object
2019-05-22 18:21:20 -07:00
Sunny Hirai
8311767108
Add noop plugin as detached plugin (#2824) 2019-05-22 17:57:58 -07:00
Sunny Hirai
b73632d42f
Add editor to plugin options (#2821) 2019-05-22 12:07:24 -07:00
Sunny Hirai
accba53f56 Add div to editor as editor.el (#2820) 2019-05-22 11:26:11 -07:00
adjourn
d7b37a8dca Fix placeholder not rendering (#2819) 2019-05-22 11:23:32 -07:00
Ian Storm Taylor
1639e8da49
Revert "Add noop plugin (#2814)" (#2817)
This reverts commit b71fdbbb3d14f77ad77d280bc27dc556d70a5f6f.
2019-05-21 23:22:38 -07:00
Ian Storm Taylor
0837db7ce0
Revert "Debug mutations (#2815)" (#2816)
This reverts commit 5948738092e3c04ed0198d066472d05c10c515d6.
2019-05-21 23:21:50 -07:00
Sunny Hirai
5948738092
Debug mutations (#2815)
* Add noop plugin

* Add debug mutations
2019-05-21 17:34:22 -07:00
Sunny Hirai
b71fdbbb3d
Add noop plugin (#2814) 2019-05-21 17:24:00 -07:00
Ian Storm Taylor
fd31269c29 Publish
- slate-base64-serializer@0.2.106
 - slate-html-serializer@0.8.5
 - slate-hyperscript@0.13.3
 - slate-plain-serializer@0.7.5
 - slate-prop-types@0.5.36
 - slate-react-placeholder@0.2.3
 - slate-react@0.22.3
 - slate@0.47.3
2019-05-21 13:26:57 -07:00
Ian Storm Taylor
d2bd71b3d9 Merge branch 'master' of github.com:ianstormtaylor/slate 2019-05-21 13:24:02 -07:00
Cary Dunn
3c013c567a fallback findPath query to find closest element with a data-key (#2794)
* fallback findPath query to find closest element with a data-key

* lint

* move example to findEventRange query

* lint
2019-05-20 14:41:40 -07:00
adjourn
4eff9b5a06 Fix leaf memoization bug (#2766)
* Fix leaf memoization bug

* Update leaf.js
2019-05-20 14:37:31 -07:00
Cary Dunn
7adf56ffd1 gracefully handle null content ref in findDOMNode query (#2774) 2019-05-20 13:34:16 -07:00