Page MenuHomePhabricator

[CharInsert] Use event binding from a module instead of inline javascript
Closed, ResolvedPublic

Description

Author: jisok2

Description:
Editing in non-javascript environment, I copy&paste characters in [[MediaWiki:Edittools]]. But because of the mouse links, it's somewhat tricky to drag the wanted character. I want the links activated only when javascript is enabled.


Version: unspecified
Severity: enhancement

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 9:41 PM
bzimport set Reference to bz9424.
bzimport added a subscriber: Unknown Object (MLST).

Any stuff requiring JavaScript should not be in Edittools. Only JS independent texts and placeholders which are to be filled/manipulated by scripts in Common.js or other linked js pages.

ayg wrote:

Yes, the Charinsert extension should just output a plain character wrapped in a span with class="mw-charinsert" that the JavaScript can add a link to if enabled.

The script should be able to differentiate between <charinsert>A+B</charinsert> (inserts "A" to the beginning and "B" to the end of the selection) and <charinsert>A<nowiki>+</nowiki>B</charinsert> (inserts "A+B").

Per comment #2, it seems adequated to tag this as "easy".

If any scripts or styles remain, port to ResourceLoader as well.

Actually the links by core EditTools do use JavaScript and it looks genuine too.

In the current state (SVN HEAD:112664) extensions/CharInsert/CharInsert.php outputs:
<a onclick="insertTags( .. );"> .. </a>

Which calls the core mw.toolbar.insertTags function. So it does work by default (insertion in toolbar). And that pretty much justifies the use of links, right ?

Granted it could be nicer and prettier but the assumption made here that it requires site-specific javascript code to work is not true. Marking WONTFIX as such.

Well, the deal was to remove onclick=... stuff in favour of jQuery general global handling.

Thus reopening.

OK, maybe that should be a separate request then. Re-summarizing for now (removing javascript on itself makes no sense as a goal unless it's redundant or broken).

Change 152076 had a related patch set uploaded by Helder:
Use event binding from a module instead of inline javascript

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

Change 152076 had a related patch set uploaded by TheDJ:
Use event binding from a module instead of inline javascript

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

Change 288922 had a related patch set uploaded (by Brian Wolff):
[DO NOT MERGE] Remove inline event handler js from charinsert

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

Legoktm added a subscriber: Legoktm.

@Bawolff can you write something up for tech news and/or wikitech-ambassadors?

Change 288922 merged by jenkins-bot:
Remove inline event handler js from charinsert

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

matmarex assigned this task to Bawolff.