jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/350408 )
Change subject: Fix the container calculation for template editor
......................................................................
Fix the container calculation for template editor
For inline templates, it was possible to have a container
for editor evaluated as a child of a section. Since anything
under section is saved, the whole editor code may get saved.
Also the previous code might give more than one match for the container
resulting multiple editors.
This fix corrects this behavior.
Testplan:
Translate Варна from ru to ba. Click on the section under Климат, it has
two big tables, both are templates. Double click to open the editor.
Without this template, the editor's position will be wrong and sometimes
the target column of editor won't even appear. Also the whole section
alignment will go wrong.
With this patch the editors should appear aligned and in correct position.
Note that there is a delay in getting this template editor rendered since
it has lot of fields.
Bug: T163105
Change-Id: I4094c81c08a0f6674664787ae90d2eb446c36c6e
---
M modules/tools/ext.cx.tools.template.js
1 file changed, 5 insertions(+), 7 deletions(-)
Approvals:
jenkins-bot: Verified
Nikerabbit: Looks good to me, approved
diff --git a/modules/tools/ext.cx.tools.template.js
b/modules/tools/ext.cx.tools.template.js
index 1e900a4..578e599 100644
--- a/modules/tools/ext.cx.tools.template.js
+++ b/modules/tools/ext.cx.tools.template.js
@@ -258,7 +258,7 @@
* So we find a 0-height fragments to use for alignment and section
* restore.
*
- * @return {jQuery}
+ * @return {jQuery|undefined}
*/
Template.prototype.getFirstVisibleFragment = function () {
var $fragments, $fragment;
@@ -283,16 +283,14 @@
* @return {jQuery}
*/
Template.prototype.getEditorContainer = function () {
- var $container;
+ var $container, $visibleFragment;
- $container = this.$template;
-
+ $visibleFragment = this.getFirstVisibleFragment() ||
this.$template;
if ( this.options.inline ) {
- this.$parentSection = this.$parentSection ||
- this.$template.closest(
mw.cx.getSectionSelector() );
+ this.$parentSection = this.$parentSection ||
$visibleFragment.parent( mw.cx.getSectionSelector() );
$container = this.$parentSection;
} else {
- $container = this.getFirstVisibleFragment() ||
this.$template;
+ $container = $visibleFragment;
}
return $container;
--
To view, visit https://gerrit.wikimedia.org/r/350408
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4094c81c08a0f6674664787ae90d2eb446c36c6e
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits