Page MenuHomePhabricator

Live preview fails when section=new&nosummary=1
Closed, ResolvedPublicBUG REPORT

Description

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

What happens?:
The browser navigates to action=submit, same as live preview turned off.

What should have happened instead?:
Live preview happens.


mediawiki.action.edit.preview.js$191:

summary = OO.ui.infuse( $( '#wpSummaryWidget' ) );

This fails because there is no #wpSummaryWidget.

Details

Related Objects

StatusSubtypeAssignedTask
InvalidNone
ResolvedBUG REPORTNardog

Event Timeline

Why do we even use OO.ui.infuse for the summary widget (when we don't for the buttons)? Would there be any problem with simply using $( '#wpSummary' ).val()?

Why do we even use OO.ui.infuse for the summary widget (when we don't for the buttons)?

This is for the character limit functionality (visibleCodePointLimit).

Would there be any problem with simply using $( '#wpSummary' ).val()?

That functionality would break.

Why do we even use OO.ui.infuse for the summary widget (when we don't for the buttons)? Would there be any problem with simply using $( '#wpSummary' ).val()?

To elaborate: .val() for reading the value would probably be fine, but .val( foo ) for setting the value would probably cause problems (some parts of the interface would see the new value and some would not, e.g. maybe the character limit as @Jdforrester-WMF says), so to avoid easy mistakes, we always use OO.ui.infuse when working with OOUI widgets.

(when we don't for the buttons)

I think that's a little bit of historical weirdness… this code was once upon a time loaded by LiquidThreads, which had non-OOUI buttons, so it was kept this way to keep it working. I'm not sure if that's still needed, maybe it can be changed.

Change 732421 had a related patch set uploaded (by Nardog; author: Nardog):

[mediawiki/core@master] Make live preview work when section=new&nosummary=1

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

Change 732421 merged by jenkins-bot:

[mediawiki/core@master] Make live preview work when section=new&nosummary=1

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

matmarex assigned this task to Nardog.

Thanks for the patch!