Improve inserting at the end of the text
In some cases inserting at the end of the text skipped the latest character. [MAILPOET-6396]
This commit is contained in:
committed by
Oluwaseun Olorunsola
parent
70e6a9328b
commit
c102ef7003
@ -117,7 +117,7 @@ const getCursorPosition = (
|
|||||||
);
|
);
|
||||||
if ( formatIndex !== null ) {
|
if ( formatIndex !== null ) {
|
||||||
return {
|
return {
|
||||||
start: formatIndex + selection.anchorOffset,
|
start: formatIndex + selection.anchorOffset + 1, // We need to add 1 for the format length
|
||||||
end: formatIndex + selection.anchorOffset + range.toString().length,
|
end: formatIndex + selection.anchorOffset + range.toString().length,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -129,7 +129,7 @@ const getCursorPosition = (
|
|||||||
);
|
);
|
||||||
if ( replacementIndex !== null ) {
|
if ( replacementIndex !== null ) {
|
||||||
return {
|
return {
|
||||||
start: replacementIndex + selection.anchorOffset,
|
start: replacementIndex + selection.anchorOffset + 1, // We need to add 1 for the replacement length
|
||||||
end:
|
end:
|
||||||
replacementIndex +
|
replacementIndex +
|
||||||
selection.anchorOffset +
|
selection.anchorOffset +
|
||||||
|
Reference in New Issue
Block a user