mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-09-03 04:02:33 +02:00
Alter cursor placement in insertFragment
tests to reflect reality (#2271)
Previously, `start-inline` and `end-inline` included the cursor at the end of an inline, i.e. ```js <paragraph> <link>example<cursor /></link> </paragraph> ``` Using Slate in a browser, it doesn’t seem possible to me to actually achieve this state: i.e. whenever the cursor is on either side of an inline such as a link, typing will not add text to that inline. (This is consistent with other editors, for example Google Docs). Now, these tests are updated to have a cursor just outside the inline. This leads to more sensible outputs. (Finally, I removed a TODO comment indicating that `middle-inline-fragment-inline`’s cursor output was incorrect. I believe this is a sensible expectation, which matches behavior in editors including Google Docs.) Fixes https://github.com/ianstormtaylor/slate/issues/1754
This commit is contained in:
committed by
Ian Storm Taylor
parent
d5834bb5b0
commit
9cdd6c9637
@@ -14,9 +14,8 @@ export const input = (
|
|||||||
<value>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
<paragraph>
|
<paragraph>
|
||||||
<link>
|
<link>word</link>
|
||||||
word<cursor />
|
<cursor />
|
||||||
</link>
|
|
||||||
</paragraph>
|
</paragraph>
|
||||||
</document>
|
</document>
|
||||||
</value>
|
</value>
|
||||||
@@ -27,10 +26,7 @@ export const output = (
|
|||||||
<document>
|
<document>
|
||||||
<paragraph>
|
<paragraph>
|
||||||
<link>word</link>
|
<link>word</link>
|
||||||
fragment
|
fragment<cursor />
|
||||||
<link>
|
|
||||||
<cursor />
|
|
||||||
</link>
|
|
||||||
</paragraph>
|
</paragraph>
|
||||||
</document>
|
</document>
|
||||||
</value>
|
</value>
|
||||||
|
@@ -24,7 +24,6 @@ export const input = (
|
|||||||
</value>
|
</value>
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: the cursor placement needs to be fixed
|
|
||||||
export const output = (
|
export const output = (
|
||||||
<value>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
|
@@ -14,9 +14,8 @@ export const input = (
|
|||||||
<value>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
<paragraph>
|
<paragraph>
|
||||||
<link>
|
<cursor />
|
||||||
<cursor />word
|
<link>word</link>
|
||||||
</link>
|
|
||||||
</paragraph>
|
</paragraph>
|
||||||
</document>
|
</document>
|
||||||
</value>
|
</value>
|
||||||
@@ -32,20 +31,3 @@ export const output = (
|
|||||||
</document>
|
</document>
|
||||||
</value>
|
</value>
|
||||||
)
|
)
|
||||||
|
|
||||||
// The result has an invalid selection for now:
|
|
||||||
//
|
|
||||||
// "selection": {
|
|
||||||
// "anchorOffset": 8
|
|
||||||
// "anchorPath": [
|
|
||||||
// 0
|
|
||||||
// 1
|
|
||||||
// 0
|
|
||||||
// ]
|
|
||||||
// "focusOffset": 8
|
|
||||||
// "focusPath": [
|
|
||||||
// 0
|
|
||||||
// 1
|
|
||||||
// 0
|
|
||||||
// ]
|
|
||||||
export const skip = true
|
|
||||||
|
Reference in New Issue
Block a user