jenkins-bot has submitted this change and it was merged.
Change subject: Section alignment: Auto grow/shrink the size of sections when
editing
......................................................................
Section alignment: Auto grow/shrink the size of sections when editing
Change-Id: I3c69773f04deb8a8c4ef8e02b08d356e5ced3bd3
---
M modules/translation/ext.cx.translation.js
1 file changed, 16 insertions(+), 16 deletions(-)
Approvals:
KartikMistry: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/translation/ext.cx.translation.js
b/modules/translation/ext.cx.translation.js
index 21e7a08..b2ae9f4 100644
--- a/modules/translation/ext.cx.translation.js
+++ b/modules/translation/ext.cx.translation.js
@@ -118,7 +118,7 @@
'contenteditable': true
} );
$section.empty();
- keepAlignment( $section );
+ $section.on( 'input', keepAlignment );
// Bind events to the placeholder sections
$sourceSection.click( function () {
@@ -139,21 +139,21 @@
} );
};
- function keepAlignment( $section ) {
- $section.on( 'input', function () {
- var $sourceSection, sectionHeight, sourceSectionHeight;
-
- $section.css( 'min-height', '' );
- $sourceSection = $( '#' + $section.data( 'source' ) );
- sectionHeight = $section.height();
- sourceSectionHeight = $sourceSection.height();
- if ( sourceSectionHeight > sectionHeight ) {
- $section.css( 'min-height', sourceSectionHeight
);
- } else {
- $sourceSection.css( 'min-height', sectionHeight
);
- }
- // TODO: We will have to auto-shrink the sections while
removing content.
- } );
+ /**
+ * Keep the height of the source and translation sections equal
+ * so that they will appear top aligned.
+ */
+ function keepAlignment() {
+ var $sourceSection, sectionHeight, sourceSectionHeight,
$section;
+ /*jshint validthis:true */
+ $section = $( this );
+ $sourceSection = $( '#' + $section.data( 'source' ) );
+ sectionHeight = $section.height();
+ $sourceSection.css( 'min-height', '' );
+ sourceSectionHeight = $sourceSection.height();
+ if ( sourceSectionHeight < sectionHeight ) {
+ $sourceSection.css( 'min-height', sectionHeight );
+ }
}
$.fn.cxTranslation = function ( options ) {
--
To view, visit https://gerrit.wikimedia.org/r/119926
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3c69773f04deb8a8c4ef8e02b08d356e5ced3bd3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <[email protected]>
Gerrit-Reviewer: KartikMistry <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits