Santhosh has uploaded a new change for review. https://gerrit.wikimedia.org/r/216067
Change subject: Avoid cx-segment spans appearing in published content ...................................................................... Avoid cx-segment spans appearing in published content Testplan: Start translating a paragraph. After the source content copied to target paragraph, delete the last sentence of that paragraph using backspace. Inspect the paragraph and we will see that even though the content was removed, the wrapper span still exist as empty span in the paragraph. Now publish. Without this patch, the published content will have that empty span. With this patch you should not see the empty span in the published content. For unknown reason to me, the replaceWith function with the cloned content does not remove all .cx-segment spans. With the above testplan, the empty span.cx-segment did not get removed. So I am reducing the scope of .find and .replaceWith to section levels and I see it working. Bug: T96234 Change-Id: I962c6ae8e6993e597c71a8c283868554fdb546d1 --- M modules/publish/ext.cx.publish.js 1 file changed, 4 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation refs/changes/67/216067/1 diff --git a/modules/publish/ext.cx.publish.js b/modules/publish/ext.cx.publish.js index b05e9dd..362a658 100644 --- a/modules/publish/ext.cx.publish.js +++ b/modules/publish/ext.cx.publish.js @@ -314,11 +314,6 @@ * @return {string} processed html */ CXPublish.prototype.prepareTranslationForPublish = function ( $content ) { - // Remove the wrapper tags that are added to the highlighting segments - $content.find( '.cx-segment' ).replaceWith( function () { - return $( this ).html(); - } ); - // Remove unnecessary elements $content.find( 'link, title, .placeholder' ).remove(); @@ -333,7 +328,10 @@ if ( $section.is( 'h1, h2, h3, h4, h5, h6' ) ) { $section.find( 'br' ).remove(); } - + // Remove the wrapper tags that are added to the highlighting segments + $section.find( '.cx-segment' ).replaceWith( function () { + return $( this ).html(); + } ); // Remove empty sections if ( !$.trim( $section.text() ) ) { $section.remove(); -- To view, visit https://gerrit.wikimedia.org/r/216067 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I962c6ae8e6993e597c71a8c283868554fdb546d1 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ContentTranslation Gerrit-Branch: master Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits