Cursor position bug after link('a' element) paste in Firefox
SergeyMosin opened this issue · 0 comments
SergeyMosin commented
Cursor jumps to the beginning of a line (see the video) when an 'a' element is pasted after some text in Firefox (Chrome is unaffected)
It looks like Firefox does not like the cursor/range being set to between the end of a
element and the end of parent block ( ex: <div>some text: <a>some link</a>|</div>
) in the moveRangeBoundaryOutOf
function
Squire/source/range/Boundaries.ts
Line 163 in 8bee516
However if the fixCursor
function is called on line 174 everything works
if (clone.endContainer === parent) {
fixCursor(parent) // << ADD THIS ON LINE 174
range.setStart(clone.endContainer, clone.endOffset);
range.setEnd(clone.endContainer, clone.endOffset);
}
The parent looks like this now <div>some text: <a>some link</a>|<br></div>
before the range
is set and the cursor behaves normally in Firefox