Page MenuHomePhabricator

CodeEditor is broken with realtime preview enabled
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • Enable realtime preview
  • Edit any CSS/JS page

What happens?:
CodeEditor looks broken, as in the screenshot in the last section.

What should have happened instead?:
CodeEditor should have only appeared with a "Preview" button in the top right?

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:

image.png (931Γ—1 px, 153 KB)

Browser: Opera GX LVL 3 (core: 85.0.4341.72)

Event Timeline

matmarex renamed this task from CodeEditor is broken with 2017 wikitext editor enabled to CodeEditor is broken with realtime preview enabled.May 12 2022, 2:12 AM
matmarex updated the task description. (Show Details)
matmarex subscribed.

This is actually not the 2017 wikitext editor (see https://www.mediawiki.org/wiki/Editor), but rather the realtime preview tool.

This seems to be only the case on plwiki, because Realtime Preview is being loaded as a gadget there. On other wikis, e.g. testwiki, the preview button is not present on non-wikitext pages.

This may be the same issue as T307039.

Yep, I think it is.

Change 804273 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/WikiEditor@master] Realtime preview: allow loading as a gadget

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

Change 804273 merged by jenkins-bot:

[mediawiki/extensions/WikiEditor@master] Realtime preview: allow loading as a gadget

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

I don't think there is much I can do to test this at the moment.

As I understand it, this change adds some client-side code that stops RTP from loading when the content type of the page is something other than wikitext (e.g. JS, JSON, etc.) Normally, this would be done server-side, but not when RTP is loaded as a gadget (in which case client-side code is needed).

On beta I can confirm that RTP is still being loaded on several namespaces (Article, File, Template).

It isn't loaded on pages using CodeEditor, but this is because it is being done server-side. To test the client-side code, we would need to load it as a gadget. I am not sure how to do this on beta. It might be easiest to wait for it to be deployed to plwiki and test there. (The same goes for T307039 and T309330.) @Samwilson what do you think?

@dom_walden: Yes, that's correct. Sorry, I should've thought of this before β€” I've now added it as a default gadget on Beta English Wikisource (e.g.). You'll have to turn off the beta feature.

Or wait till after the train next week and test on plwiki as you say.

@dom_walden: Yes, that's correct. Sorry, I should've thought of this before β€” I've now added it as a default gadget on Beta English Wikisource (e.g.). You'll have to turn off the beta feature.

Thanks, that's really helpful!

I tested a few pages on beta wikisource where the CodeEditor is used (e.g. here, here, here). The Realtime Preview does not get loaded. The regular CodeEditor behaves as I understand it should. All the basic functionality appears to function.