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
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 themoveRangeBoundaryOutOf
function https://github.com/fastmail/Squire/blob/8bee51683b723e000f477009ed4337716a7b80ba/source/range/Boundaries.ts#L163However if the
fixCursor
function is called on line 174 everything worksThe parent looks like this now
<div>some text: <a>some link</a>|<br></div>
before therange
is set and the cursor behaves normally in Firefoxfirefox-link-paste-bug.webm