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:
Jan Lysý
2025-01-07 14:07:17 +01:00
committed by Oluwaseun Olorunsola
parent 70e6a9328b
commit c102ef7003

View File

@ -117,7 +117,7 @@ const getCursorPosition = (
);
if ( formatIndex !== null ) {
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,
};
}
@ -129,7 +129,7 @@ const getCursorPosition = (
);
if ( replacementIndex !== null ) {
return {
start: replacementIndex + selection.anchorOffset,
start: replacementIndex + selection.anchorOffset + 1, // We need to add 1 for the replacement length
end:
replacementIndex +
selection.anchorOffset +