User:PerfektesChaos/js/editToolStrIns

From mediawiki.org

mw-editTools: Insert characters and strings.

Script to facilitate input of special characters and strings into wiki edit field.

Main target is easy insertion of characters not present on the keyboard, but strings are also subject of desire, like Wiki syntax, HTML tags, template collections or TeX.

The script has been designed to be used on any WMF project in any language environment for any user language skills. Local administration shall benefit from collected wisdom and is able to reuse previous work automatically.

Functionality[edit]

A tool region, usually below the text edit area, is equipped with a gadget for selection of particular character sets or other collections. A menu presents the selected compilation. Each token may be inserted into page when clicked, either as single string at cursor position or enclosing the current selection with a kind of begin and end tags. The target is wpTextbox1, but also wpSummary or text input on forms, depending on which got last focus.

By default text will be inserted only, avoiding text loss. If user presses Ctrl simultaneously, a selected region will be replaced. User defined elements may be equipped to replace something.

Multilingual support[edit]

Within one project several languages may be supported. The native language of Commons and Meta is English, but users may edit in areas where they are more comfortable with GUI elements in their own language. Users may visit a project as a guest for some reasons; perhaps they even cannot read the foreign script without difficulties.

However, insertion of data is based on the native language of the current project.

Definitions which might be useful for other projects are supposed to be collected and distributed by a unique world wide version of the code. This goes for both character sets and language related GUI translation.

User customization and project adaption[edit]

The standard appearance may be modified by the user, removing, changing or appending elements. The basic configuration may be adopted by the local project, using a global repository.

Predecessors, Authors, Credits[edit]

Procedural Part[edit]

The earliest implementation digged out has been

Various copies and clones have been adopted by users on English Wikipedia.

Further progress was made by

That has been adopted by German Wikipedia 2009-02-27:

Data[edit]

While authors of the functional part added some character set collections, many users provided further insertion material.

Other Approaches[edit]

The WikiEditor style is nice for a limited number of single characters. However, for languages with 100 distinct characters scrolling is required, and the square tiles are too small for strings like template names or syntax elements. The suggested but older approach presents even a large number of characters at one glance, ready for click, and permits grouping and styling.

Further usage[edit]

The code has been developed and tailored for WMF projects, but the basic functionality may be cut off and could be used anywhere under correct license and origin attribution.

Technical[edit]

Source code
ResourceLoader
  • ext.gadget.editToolStrIns for Extension:Gadgets
  • Dependencies: user, mediawiki.util, jquery.textSelection
Namespaces any
mw.libs editToolStrIns
mw.hook editToolStrIns.ready — when gadget loading completed
Receiving the application object.
MediaWiki ≥ 1.18