Page MenuHomePhabricator

Automatically give pasted tables class="wikitable" in VE-MW
Closed, ResolvedPublic1 Story Points

Description

Paste the following table (or any table from a non-Mediawiki source) into VE. While in edit mode, it will look fairly normal, with borders and a grey background for header cells (due to VE's own style rules). But after the page is saved, it will appear in read mode without any borders or background.

AnimalFerocityCuddliness
Bunny09
Cat410
Tiger10?

This is because pasted tables do not get class="wikitable" which provides the normal table styling.

Event Timeline

Etonkovidova raised the priority of this task from to Needs Triage.
Etonkovidova updated the task description. (Show Details)
Etonkovidova added a project: VisualEditor.
Etonkovidova added a subscriber: Etonkovidova.
Etonkovidova triaged this task as Normal priority.Jan 9 2015, 10:57 PM
Etonkovidova set Security to None.
Etonkovidova moved this task from To Triage to Freezer on the VisualEditor board.
Catrope renamed this task from Pasting Google spreadsheet cells displayed differently in Read and Edit VE modes to Pasted tables in VE-MW do not automatically get class="wikitable".Mar 10 2015, 4:43 PM
Catrope added a subscriber: Catrope.

This is "correct" behavior: tables in MW read mode do not have borders unless class="wikitable" is explicitly set. Perhaps pasted tables should automatically get class="wikitable", like newly created tables do?

Elitre added a subscriber: Elitre.Jun 3 2015, 1:55 PM
Quiddity added a subscriber: Quiddity.

This is "correct" behavior: tables in MW read mode do not have borders unless class="wikitable" is explicitly set. Perhaps pasted tables should automatically get class="wikitable", like newly created tables do?

I believe that would be good. All tables I've ever seen in articles use this (or more complex) styling, and it's used almost everywhere in https://www.mediawiki.org/wiki/Help:Tables

I agree with @Quiddity. From the user's perspective, wikitable styling is how Mediawiki tables look. We should definitely apply class="wikitable" automatically.

In fact, I'd go further and ask why Vector doesn't style all tables like this by default? In the rare cases when people actually want the default style, that could be applied using a class.

Jdforrester-WMF renamed this task from Pasted tables in VE-MW do not automatically get class="wikitable" to Automatically class="wikitable" to pasted tables in VE-MW.Jun 18 2015, 7:30 PM
Neil_P._Quinn_WMF renamed this task from Automatically class="wikitable" to pasted tables in VE-MW to Pasted tables in VE-MW do not automatically get class="wikitable".Jun 18 2015, 7:42 PM
Neil_P._Quinn_WMF updated the task description. (Show Details)
Neil_P._Quinn_WMF renamed this task from Pasted tables in VE-MW do not automatically get class="wikitable" to Automatically give pasted tables class="wikitable".Jun 18 2015, 7:46 PM
Neil_P._Quinn_WMF updated the task description. (Show Details)
Jdforrester-WMF renamed this task from Automatically give pasted tables class="wikitable" to Automatically give pasted tables class="wikitable" in VE-MW.Jun 18 2015, 7:52 PM
Jdforrester-WMF added a subscriber: Jdforrester-WMF.

It's important to note that we only want this to be the case in VE-MW, not VE-core. :-)

In fact, I'd go further and ask why Vector doesn't style all tables like this by default?

To answer my own question, it's probably that this would break tables used as a poor man's layout tool by Mediawiki editors

Izno added a subscriber: Izno.Jun 25 2015, 12:46 AM

It's important to note that we only want this to be the case in VE-MW, not VE-core. :-)

Last I checked .wikitable ships in core. Am I crazy, or is there some other reason why not?

In fact, I'd go further and ask why Vector doesn't style all tables like this by default?

To answer my own question, it's probably that this would break tables used as a poor man's layout tool by Mediawiki editors

These very rarely, if ever, occur in mainspace on en.wp. Probably rare on the other wikis. Why doesn't someone do the research of getting a dump of mainspace of x or y or z MW wikis and look for tables without the class assigned?

It's important to note that we only want this to be the case in VE-MW, not VE-core. :-)

Last I checked .wikitable ships in core. Am I crazy, or is there some other reason why not?

You're not crazy, it's just that the naming is confusing :). "VE-core" (VisualEditor core) is a rich text editor independent of MediaWiki. "VE-MW" (VisualEditor MediaWiki) is what everyone knows as the VisualEditor, the extension to MediaWiki. We want this behavior in VE-MW, but not VE core.

In fact, I'd go further and ask why Vector doesn't style all tables like this by default?

To answer my own question, it's probably that this would break tables used as a poor man's layout tool by Mediawiki editors

These very rarely, if ever, occur in mainspace on en.wp. Probably rare on the other wikis. Why doesn't someone do the research of getting a dump of mainspace of x or y or z MW wikis and look for tables without the class assigned?

We wish :) https://en.wikipedia.org/wiki/San_Francisco has 39 table elements without the wikitable class. This includes the infobox, some nested infobox bits which have their own tables, all the navboxes, all the maintenance templates, assorted templates which generate infobox-like or thumbnail-like structures, and some other bits and pieces.

GOIII added a subscriber: GOIII.Jun 25 2015, 5:46 AM

In fact, I'd go further and ask why Vector doesn't style all tables like this by default? In the rare cases when people actually want the default style, that could be applied using a class.

fwiw... The use of .wikitable is relegated almost exclusively to discussions and help pages on Wikisource at best -- where the last thing we want is a table that renders nothing like the ones found in works we're transcribing.

Go ahead and make it the default for VE but please provide a way to override/usurp that or it will just wind up as another never-used dialog in our case.

So it sounds like .wikitable is, in fact, just one style out of many. So I think task will remain limited to what it says in the title: automatically give pasted tables class="wikitable" in VisualEditor-Mediawiki.

Elitre added a comment.EditedNov 13 2015, 10:29 AM

Question: Are we stripping any table classes these days?

I just got bit by this while helping some folks copy over existing information from a Word document.

Perhaps a solution would be to allow tables to have a modal like Media and Templates where one could click to bring up a window to make configuration changes to the table? One option could be to apply styles - directly by class name or perhaps language indicating "with borders" or some such. Less ambiguity in the language is better for editors unfamiliar with language such as "class=wikitable" but also understandably more difficult to implement consistently.

Or, conversely (and I can't believe I'm taking inspiration from Microsoft Word) upon paste there is a modal to ask editors 'match default style' or "keep existing style"?

Tables created in VE-MW do get class="wikitable" applied by default, correct?

Ltrlg added a subscriber: Ltrlg.

Change 265785 had a related patch set uploaded (by Esanders):
MWTableNode: Apply wikitable class to pasted tables

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

Jdforrester-WMF closed this task as Resolved.Jan 22 2016, 7:07 PM
Jdforrester-WMF assigned this task to Esanders.
Jdforrester-WMF removed a project: Patch-For-Review.
Jdforrester-WMF edited a custom field.

Change 265785 merged by jenkins-bot:
MWTableNode: Apply wikitable class to pasted tables

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

Change 265812 had a related patch set uploaded (by Esanders):
Follow-up I9714cf3: Add tests for wikitable paste

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

Change 265812 merged by jenkins-bot:
Follow-up I9714cf3: Add tests for wikitable paste

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