Mooeypoo has uploaded a new change for review. https://gerrit.wikimedia.org/r/90210
Change subject: Adding a slug into an empty transclusion ...................................................................... Adding a slug into an empty transclusion If a template was setup without a default output and returns an empty result to the transclusion, the user could not access the template dialog because there was nowhere to hover over to get it visible. This commit checks the output from the template after it was rendered with the given parameters and if it returns empty, it adds a slug to the output so to give the users a placeholder to access that template and edit or remove it. Bug:55810 Change-Id: Ib842b401e74d79b6382cada6bb7c6048b713977c --- M modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js 1 file changed, 7 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/10/90210/1 diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js index d6763d4..6cbfd75 100644 --- a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js +++ b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js @@ -104,6 +104,13 @@ if ( contentNodes.length === 1 && contentNodes[0].nodeName.toLowerCase() === 'p' ) { contentNodes = Array.prototype.slice.apply( contentNodes[0].childNodes ); } + + // Check if the final result of the imported template is empty. + // If it is empty, put an inline slug inside it so that it can + // be accessible to users (either to remove or edit) + if ( contentNodes.length === 0 ) { + contentNodes.push( ve.ce.BranchNode.$inlineSlugTemplate[0] ); + } deferred.resolve( contentNodes ); }; -- To view, visit https://gerrit.wikimedia.org/r/90210 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib842b401e74d79b6382cada6bb7c6048b713977c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Mooeypoo <mor...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits