Page MenuHomePhabricator

Support the <ce>/<chem> tag for chemical formula in VisualEditor
Closed, ResolvedPublic8 Estimated Story Points

Description

Only now I found out that in addition to <math> there is also <ce>/<chem>, which shows chemical formulas for a long time already (T98306).

It should be supported in VE, like <math> is.

Event Timeline

This could be just another option inside the math dialog. E.g. after "Display" an option for "Format as chemical formula".

Change 331696 had a related patch set uploaded (by Amire80):
[WIP] Add support for chemical formula in VisualEditor

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

Change 331786 had a related patch set uploaded (by Esanders):
Create chemistry icon for upcoming VE chemistry support

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

Change 331786 merged by jenkins-bot:
Create chemistry icon for upcoming VE chemistry support

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

@Amire80, pay attention: you can't use the same code for math and for ce without change it. You should add explicitly the code that checks if the input field is empty, and if it is, the result should be empty string and not empty string inbetween ce tags. If you do this, you can use it also for math, because in that case it does not matter. Here it will be a huge bug without this change. Please answer here so I'll know you read this. Thanks.

Meta-comment: First, <ce> will soon change to <chem>. See T153606. So I'll use <chem> from here on.

I read this, but I'm not sure that I understand entirely.

Basically, what you want is that if I add a <math>, don't type anything, and insert, nothing should be inserted? Or <math></math>? And is it different for <chem>?

We are currently splitting the code for inserting and editing <math> and <chem> elements. We'll put the common parts in one class, but everything that has to be separate, will be separate. If you have comments about it, they will be very appreciated.

OK, @Amire80.
For math:
The code for "' input that looks like "<math></math>" is fine.
The code for "' input that looks like "" is fine.
You can choose any of them.
For chem:
The code for "' input that looks like "" is fine.
The code for "" input that looks like "<chem></chem>" is wrong.
So, you should add a condition to the code generator:
if inpuvar="" return "" else return "<chem>" + inputvar + "</chem>"

Oh, I got it, thank you. Empty <math> gets rendered as nothing, and empty <ce> gets renders as pointless displaystyle ce, etc. Is this what you're talking about?

I guess that typing nothing should probably insert nothing in both cases, but I'll check with real VisualEditor designers and developers (this particular thing here is just something I do for fun :) ).

Exactly, @Amire80. I saw that when implemented the chemical tag in wikieditor. I even am not sure that you can see the bug anywhere except Firefox undoing mechanism. But it's enough to implement it. And better now, before the deployment, and not fix it later.

Esanders renamed this task from Support the <ce> tag for chemical formula in VisualEditor to Support the <ce>/<chem> tag for chemical formula in VisualEditor.Jan 17 2017, 5:18 PM
Esanders updated the task description. (Show Details)
Esanders updated the task description. (Show Details)
Esanders added a subscriber: Dvorapa.
Jdforrester-WMF triaged this task as Medium priority.
Jdforrester-WMF moved this task from To Triage to Blocked on the VisualEditor board.
Jdforrester-WMF set the point value for this task to 8.

Change 331696 merged by jenkins-bot:
Add support for chemical formulae in VisualEditor

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

I'm very happy to know that VE going to suppoprt chem formula.
Thank you. I just want to report a bug.
In block mode, Big chemical formula don't display properly.
https://en.wikipedia.org/wiki/User:Libattery/sandbox

Can you please report this as a separate bug, and add a screenshot? The
page to which you linked looks correct, but I might be missing something.

בתאריך 26 במאי 2017 04:23 AM,‏ "Libattery" <
[email protected]> כתב:

Libattery added a comment.

I'm very happy to know that VE going to suppoprt chem formula.
Thank you.

I just want to report a bug.
In block mode, Big chemical formula don't display properly.

https://en.wikipedia.org/wiki/User:Libattery/sandbox

*TASK DETAIL*
https://phabricator.wikimedia.org/T153365

*EMAIL PREFERENCES*
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

*To: *Amire80, Libattery
*Cc: *Libattery, Elitre, Dvorapa, gerritbot, Schnark, IKhitron, Amire80,
Aklapper, Robinma, Maosef, Adik2382, merbst, Wess, TerraCodes, Debenben,
Johan, MGChecker, Luke081515, Jrf, Husun1297, Prod, Ryasmeen, fredw,
Physikerwelt, Pkra, Swainr, scfc, TheDJ, Jdforrester-WMF, Jay8g, Ltrlg

This is screenshot. look yellow boxes. I'm a newbie here. I don't know how to "report separate bug".
so can you do that?

chembug.png (535×566 px, 30 KB)

Can you please report this as a separate bug, and add a screenshot? The
page to which you linked looks correct, but I might be missing something.

בתאריך 26 במאי 2017 04:23 AM,‏ "Libattery" <
[email protected]> כתב:

Libattery added a comment.

I'm very happy to know that VE going to suppoprt chem formula.
Thank you.

I just want to report a bug.
In block mode, Big chemical formula don't display properly.

https://en.wikipedia.org/wiki/User:Libattery/sandbox

*TASK DETAIL*
https://phabricator.wikimedia.org/T153365

*EMAIL PREFERENCES*
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

*To: *Amire80, Libattery
*Cc: *Libattery, Elitre, Dvorapa, gerritbot, Schnark, IKhitron, Amire80,
Aklapper, Robinma, Maosef, Adik2382, merbst, Wess, TerraCodes, Debenben,
Johan, MGChecker, Luke081515, Jrf, Husun1297, Prod, Ryasmeen, fredw,
Physikerwelt, Pkra, Swainr, scfc, TheDJ, Jdforrester-WMF, Jay8g, Ltrlg

@Libattery I reported separate bug in T166380 for you. Next time you can do this by clicking a star in the top blue bar and selecting "Create task" option. Please don't hesitate to add more details about the bug there