forked from kaydelaney/slate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix improper selection after insertFragment (ianstormtaylor#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
- Loading branch information
1 parent
3ed981a
commit 2ea6d40
Showing
8 changed files
with
159 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
packages/slate/test/commands/at-current-range/insert-fragment/fragment-multiple-marks.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** @jsx h */ | ||
|
||
import h from '../../../helpers/h' | ||
|
||
export default function(editor) { | ||
editor.insertFragment( | ||
<document> | ||
<paragraph> | ||
<b>b</b> | ||
<u>u</u> | ||
<i>i</i> | ||
</paragraph> | ||
</document> | ||
) | ||
} | ||
|
||
export const input = ( | ||
<value> | ||
<document> | ||
<paragraph> | ||
wo<cursor />rd | ||
</paragraph> | ||
</document> | ||
</value> | ||
) | ||
|
||
export const output = ( | ||
<value> | ||
<document> | ||
<paragraph> | ||
wo | ||
<b>b</b> | ||
<u>u</u> | ||
<i> | ||
i<cursor /> | ||
</i> | ||
rd | ||
</paragraph> | ||
</document> | ||
</value> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
packages/slate/test/commands/at-current-range/insert-fragment/fragment-single-inline.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** @jsx h */ | ||
|
||
import h from '../../../helpers/h' | ||
|
||
export default function(editor) { | ||
editor.insertFragment( | ||
<document> | ||
<paragraph> | ||
<inline type="link">bar</inline> | ||
</paragraph> | ||
</document> | ||
) | ||
} | ||
|
||
export const input = ( | ||
<value> | ||
<document> | ||
<code> | ||
<paragraph> | ||
Foo<cursor />baz | ||
</paragraph> | ||
</code> | ||
</document> | ||
</value> | ||
) | ||
|
||
export const output = ( | ||
<value> | ||
<document> | ||
<code> | ||
<paragraph> | ||
Foo | ||
<inline type="link"> | ||
bar<cursor /> | ||
</inline> | ||
baz | ||
</paragraph> | ||
</code> | ||
</document> | ||
</value> | ||
) |
41 changes: 41 additions & 0 deletions
41
packages/slate/test/commands/at-current-range/insert-fragment/fragment-single-mark.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** @jsx h */ | ||
|
||
import h from '../../../helpers/h' | ||
|
||
export default function(editor) { | ||
editor.insertFragment( | ||
<document> | ||
<paragraph> | ||
<b>bar</b> | ||
</paragraph> | ||
</document> | ||
) | ||
} | ||
|
||
export const input = ( | ||
<value> | ||
<document> | ||
<code> | ||
<paragraph> | ||
Foo<cursor />baz | ||
</paragraph> | ||
</code> | ||
</document> | ||
</value> | ||
) | ||
|
||
export const output = ( | ||
<value> | ||
<document> | ||
<code> | ||
<paragraph> | ||
Foo | ||
<b> | ||
bar<cursor /> | ||
</b> | ||
baz | ||
</paragraph> | ||
</code> | ||
</document> | ||
</value> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters