Page MenuHomePhabricator

TemplateStyles not loaded in NWE preview
Closed, ResolvedPublic

Description

Whenever I edit pages with templates that use TemplateSyles in the New Wikitext Editor, during the page preview the styles are apparently not loaded at all, leading to a very different result in the preview and after saving. This causes confusion for users not aware of TemplateStyles and makes it impossible to get to see a realistic preview of pages in the NWE. I hope there is an easy fix to the problem!

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
JTannerWMF subscribed.

Our plan is to look into the level of effort of fixing this

This appears to be more or less the same issue as in T188143: VisualEditor does not like TemplateStyles; the <style>...</style> tags are gone and only <span about="#mwt1"> </span> tags are left.

Anything happening here? Lately I find myself always switching editors whenever I have to work with templates. That slows down the workflow quite a bit.

This is the same as T197563. That task fixed the rendering of templates in visual mode, we need to apply the same fix to preview in wikitext mode.

Change 577275 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/VisualEditor@master] ve.ui.MWSaveDialog: Remove meta element filtering from wikitext preview

https://gerrit.wikimedia.org/r/577275

Change 577275 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] ve.ui.MWSaveDialog: Remove meta element filtering from wikitext preview

https://gerrit.wikimedia.org/r/577275

Has this been fixed all of a sudden? Today for the first time templates with TemplateStyles did not look broken anymore when checking the preview. Great!

I was wondering, however, if TemplateStyles could be applied also while loading the VE/NWE (those approx. 2 seconds after clicking the edit button); that's now the only moment I'm aware of where the styles are still missing (except for the talk pages issue pointed out in T251024). It is confusing seeing the page broken, even if it is only for a few seconds. Not sure if it's related to this task, otherwise I will open another one.

Has this been fixed all of a sudden? Today for the first time templates with TemplateStyles did not look broken anymore when checking the preview. Great!

It was fixed by that patch in March, yes, but we had a bit of a backlog in reviewing the tasks.

I was wondering, however, if TemplateStyles could be applied also while loading the VE/NWE (those approx. 2 seconds after clicking the edit button); that's now the only moment I'm aware of where the styles are still missing (except for the talk pages issue pointed out in T251024). It is confusing seeing the page broken, even if it is only for a few seconds. Not sure if it's related to this task, otherwise I will open another one.

Can you file a separate task about it? I think this is caused by how we "disable" the existing style tags on the page when loading the editor (we do this so that the styles no longer apply if you remove the template that adds them in the editor).

I have now opened T254518 for the remaining issue. Good, I guess this task is resolved then, kudos to everyone involved, it's very appreciated!