-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: marks at the start of the selection (#5725)
* fix: marks at the start of the selection * chore: modify unit test description
- Loading branch information
1 parent
85a1e1d
commit f31167c
Showing
3 changed files
with
45 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'slate': patch | ||
--- | ||
|
||
fix marks at the start of the selection |
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
36 changes: 36 additions & 0 deletions
36
packages/slate/test/interfaces/Editor/marks/focus-block-end.tsx
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,36 @@ | ||
/** @jsx jsx */ | ||
import { Editor } from 'slate' | ||
import { jsx } from '../../..' | ||
|
||
/** | ||
* Similar to firefox-double-click.tsx, when the selection is at the end of | ||
* the previous node's path, using Editor.marks retrieves the marks of that node. | ||
* However, when addMark is triggered, that node is not within the range for | ||
* adding marks, thus failing to transfer the state correctly. | ||
*/ | ||
|
||
export const input = ( | ||
<editor> | ||
<block> | ||
<text> | ||
block one | ||
<focus /> | ||
</text> | ||
</block> | ||
<block> | ||
<text bold>block two</text> | ||
</block> | ||
<block> | ||
<text bold> | ||
block three | ||
<anchor /> | ||
</text> | ||
</block> | ||
</editor> | ||
) | ||
|
||
export const test = editor => { | ||
return Editor.marks(editor) | ||
} | ||
|
||
export const output = { bold: true } |