Skip past our own reply buttons when displaying reply widget

Without this, the reply widget would be inserted before the reply button,
in the middle of the paragraph.

Follow-up to e36dc8e78a.

Change-Id: I5e22a0a0b70e8da395eb23dd6ae80af70840a2e2
This commit is contained in:
Bartosz Dziewoński 2020-08-29 14:15:42 +02:00
parent dbfbffd4f3
commit 5e1b6b1b81

View file

@ -91,6 +91,11 @@ function addListItem( comment ) {
desiredLevel = comment.level + 1; desiredLevel = comment.level + 1;
target = curComment.range.endContainer; target = curComment.range.endContainer;
// HACK: Skip past our own reply buttons
if ( target.nextSibling && target.nextSibling.className && target.nextSibling.className.indexOf( 'dt-init-replylink-buttons' ) !== -1 ) {
target = target.nextSibling;
}
// target is a text node or an inline element at the end of a "paragraph" (not necessarily paragraph node). // target is a text node or an inline element at the end of a "paragraph" (not necessarily paragraph node).
// First, we need to find a block-level parent that we can mess with. // First, we need to find a block-level parent that we can mess with.
// If we can't find a surrounding list item or paragraph (e.g. maybe we're inside a table cell // If we can't find a surrounding list item or paragraph (e.g. maybe we're inside a table cell