Commit graph

92 commits

Author SHA1 Message Date
Umherirrender fbcc93d98c Avoid "Cannot read property 'top' of undefined" in toolbar
Can happen when using up and down keys without selection

Bug: T282607
Change-Id: Ibf7b4711fe7d0ebc14638a77770acff9149a9d7a
2021-06-01 22:30:15 +02:00
Ed Sanders 137395538e Fix eslint warnings
Change-Id: I57b11c6b4c6e67bb38bb67a93b06d6d1d3009933
2021-05-23 15:49:49 +01:00
bkudiess-msft 358c587ffb Makes special characters booklet accessible
Bug: T253410
Change-Id: Ic42c3cb437d128ca12d15908bb93e83902d997cb
2020-06-29 19:12:56 +00:00
Ed Sanders 8e9d306510 Create a toolbarReady hook for attaching toolbar tools
Using an event introduces a race condition where the extension
adding the listener has to do so before WikiEditor finishes loading.

Change-Id: I5a8dc6f8fd1b1939b5d98307b20ef1fd355cee99
2020-04-21 15:28:40 +01:00
jenkins-bot d050676356 Merge "Improve accessibility of expandable controls" 2020-03-13 19:36:35 +00:00
Akinwale Alagbe b2222d0afa Improve accessibility of expandable controls
Fixing aria-* attributes to the Heading menu and roles property to 
the menu dropdown items in order to make the element function like an 
ideal menu to screen readers. 

Adding aria-expanded attribute to Expandable panes(Advanced, 
Special Characters and Help) widgets to allow
screen readers announces of the state expandable buttons. 

Bug: T244426
Change-Id: I0cb47afd7f3622ed83a57410086984d9abc9acfd
2020-03-13 19:23:10 +00:00
jenkins-bot f7b8e34a5c Merge "Fix double escaping" 2020-03-13 15:57:25 +00:00
Ricordisamoa e4d02b5e9a Fix double escaping
e75284e528 escapes a few messages too
eagerly but 1fc00749fb only fixes one
of such mistakes.

Without this change, the labels of some toolbar buttons (e.g. Italian
'Redirect', Welsh 'Numbered list') display ''' where apostrophes
should be.

Change-Id: I3265631512c5d22ecc3dafb9d56acecc7d50ad1d
2020-02-05 19:11:01 +01:00
Ed Sanders ef38bdfe2f Align toolbar styling with Apex
Also separate out Apex-specific styling into a separate file.

The current toolbar is already supposed to be aligned with Apex
so the visual changes here are minimal.

Bug: T223155
Change-Id: I7a0a21809018e0094d50992054523d20be3c5473
2020-02-04 17:16:37 -08:00
Fomafix f5c89bd673 Avoid href="#" on <a> elements
An <a href="#"> element
* shows a status line with a URL on hover and
* opens a new tab on middle click.

For still supporting keyboard navigation the replacement uses
* tabindex="0" to have the normal tab order and
* .on( 'keydown' ) to catch the Enter key.

The image example in the help does not need a link or a keyboard
navigation.

Change-Id: I6d75f75871bb29bdd878451f282f2055ed3f4f5c
2019-11-06 18:13:14 +01:00
Ed Sanders 85ac5f2e07 build: Update linters
Change-Id: Idcac2a782781a86dabd91f30a41adac1ea94ef16
2019-10-29 22:16:13 +00:00
Ed Sanders 2112538387 build: Update linters
Change-Id: I3a50982ee652c4c1c9b357c793e07cccf014e261
2019-10-07 16:52:10 +01:00
Roan Kattouw d23d096281 Convert ext.wikiEditor module to packageFiles
This allows us to bundle the wgWikiEditorMagicWords and
mw.msg.wikiEditor(?!) config vars that were previously exported globally
in the startup module.

This code is old and crufty, so this is a somewhat minimal conversion:
* Use require() for jquery.wikiEditor.{dialogs,toolbar}.config.js,
  and for jquery.wikiEditor.{dialogs,toolbar}.js
* Don't attempt to convert jquery.wikiEditor.js to something
  require-based, instead just run it and let it set the $.wikiEditor and
  $.fn.wikiEditor globals
* Consolidate ext.wikiEditor.{dialogs,toolbars}.js into
   ext.wikiEditor.js

Bug: T222828
Change-Id: Ia75d685cbde786e8fceb6db36f2436b2beea1499
2019-08-05 22:24:56 +00:00
Fomafix d2e683f230 Add arrow-up as indicator for the pinned menu
Change-Id: I9a8afd8ec8f17c867f81889524a64b96b1d10568
2019-06-18 18:09:25 +02:00
Ed Sanders 583ad04b87 build: Update eslint-config-wikimedia to 0.10.0
Change-Id: I5fea8a1d6c91ea69c3490101ea38ce4626bd7e11
2019-01-08 23:32:56 +00:00
Derk-Jan Hartman 45d34eaa1b Animations: Get rid of jquery animations
Similar to makecollapsible.. Played around with CSS transitions, but
due to the non-predictable and variant sizing of the section elements
isn't really worth the trouble in my opinion.

Also was an accessibility issue on the select (header) dropdown.

Bug: T210671
Bug: T175379
Change-Id: I6fa476645bae7f0e1b01c563c4395e2af003c2c5
2018-12-03 12:27:40 -08:00
Ed Sanders f1c0cbc70f Make jQuery.async loop synchronous
Bug: T209699
Change-Id: I61b6bd2f428144d746ccfbaf6269d64926a9c4d7
2018-11-16 12:56:55 +00:00
Derk-Jan Hartman c7e4545589 Toolbar: ignore modifications on readonly textarea
CodeMirror forces WikiEditor to load. While CodeMirror handles readonly
textareas, the WikiEditor toolbar doesn't. CodeMirror and
syntaxhighlighting is pretty useful in readonly actually,
so I'm making WikiEditor a tad more resistent against readonly mode.

Bug: T188817
Change-Id: I927a780e1aea86a19750387f530bad84b1ff5ef4
2018-11-14 19:02:58 +00:00
Ed Sanders 4fa41179e8 Remove obsolete aliases from closures
Bug: T208951
Change-Id: I0b2993912de221e810414e46708c19be163922f6
2018-11-12 22:28:40 +00:00
Gergő Tisza 1fc00749fb
Fix escaping
Follows up I2df3ec8c0.

Change-Id: Ic8f44dec0f24e2443055ef46cd0b4140c200a22b
2018-10-12 20:29:29 -07:00
James D. Forrester e75284e528
Fork autoMsg() with escaped autoSafeMsg(), replace where appropriate
The only use of raw HTML messages is in the help panel, which is the only user
of `layout: 'table'`, so we can replace all other callers.

Bug: T154891
Change-Id: I2df3ec8c05d4daaa094378354566356a822c081f
2018-10-12 01:27:52 -07:00
Derk-Jan Hartman bfbc794c5b Toolbar: Add a new 'toggle' tool type; declare as v0.5.2
A new toggle tooltype which makes use of ToggleButtonWidget in order
to provide proper accessibility for all buttons that require on/off
state

Bug: T198781
Change-Id: I8b7fd41571a48fa4f6560790d94bb966972e740f
2018-08-17 11:19:32 -07:00
Ed Sanders 72e48c26e0 Convert remaining tools to OOUI
Replaces the insert and advanced-insert groups, which
are currently multi-colour icons.

Drops the button-sprite + offset mode, according to
mwgrep there are no other users of this.

Bug: T191031
Bug: T143508
Change-Id: I7032f98908a591ea5c9d3dbbb7616e2c10bbfc80
2018-04-11 15:50:23 +01:00
Ed Sanders 2dd87044e2 Provide #setActive API for buttons
Change-Id: I3e6f65f6f290778d3fbfa22f5d212c26fee12a86
2018-03-23 13:39:01 +00:00
Ed Sanders 6b9aa52894 Allow toolbar items to use OOUI icons as buttons
Change-Id: I04e8b6c395e9569e5593378a556e239edc254186
2018-03-21 18:31:21 +00:00
Alangi Derick e0977eeb93 Escape messages appropriately and not use raw html
Make sure messages are escaped and not feed on raw html
before inserting into the group.

Also, updated the minus-x version to 0.3.0.

Bug: T154891
Change-Id: I12e5dc03396fa8bed9beb362ae91a77e64646113
2018-01-22 20:21:58 +01:00
Ed Sanders 66a29b9c0a build: Update linters and fix errors
Change-Id: I3d316cfa7432d0600f0114608342155c1d1f6c1d
2017-10-31 18:40:57 +00:00
Pavel Astakhov 3e14a90fb7 Do not add a background image if the icon is not defined
Bug: T172500
Change-Id: Ib658651e04090ec4f5bc1f5bacbbfb0d7e7f893e
2017-08-04 15:46:08 +06:00
Ed Sanders d400102c38 Remove IE8 hacks
Change-Id: I23e33e3498487bedcc50d95e2162175e940882c4
2017-05-22 11:50:04 +02:00
Ed Sanders 1b0bd60ee8 build: Update eslint to 0.4.0 and make pass
Change-Id: Ib0ac14fb53479eb964a5d51066661b4771b1f72e
2017-05-04 22:38:47 +00:00
Timo Tijhof 7769baa56e Replace deprecated jQuery bind() and size()
> JQMIGRATE: jQuery.fn.bind() is deprecated
> JQMIGRATE: jQuery.fn.size() is deprecated; use the .length property

Note that bind() is not removed in v3, merely deprecated.
Even after the jQuery Migrate phase, it will continue to work.

size() was removed in v3 and works only during the Migrate phase.

https://api.jquery.com/size/
https://api.jquery.com/bind/
https://jquery.com/upgrade-guide/3.0/

Bug: T124742
Change-Id: I6bbd8f829ecf987228c6a5abd32c84e4e088a9bd
2016-11-21 18:23:50 -08:00
Ed Sanders 7eed707a48 Replace jshint/jscs with eslint/stylelint
Change-Id: Ife5e782bd5513e0496e384655b9b203de5c841a5
2016-11-21 21:02:38 +00:00
Ramunas Geciauskas c277e3eeb6 Stop any other tab animations when clicking on the tab button
When quickly clicking on a tab (the same one or a different one) in the
toolbar the new animation is started immediately even though previously
triggered animations might still be running. This leads to potential
issues as reported in T106993 bug report.
Make sure to stop previous animation first before issuing a new one.
Additionally 'resize' trigger is under racing conditions when
expanding/collapsing tabs, and needs to be invoked explicitly on any
size-change event (cannot rely on the fact that the last issued animation
will trigger last).

Bug: T106993
Change-Id: I874dd7cb9f2fe96e3a6493508cbae4de56f7a6c0
2016-03-31 12:08:07 -04:00
Derk-Jan Hartman cfb3d25117 Only load a page/booklet once
Bug: T126138
Change-Id: Ib4b2b76b115026df12a7d9cc3c30b7559c2580e4
2016-02-22 23:21:21 +01:00
Fomafix ce96b0c72e Remove loading spinner
Since e8d37102 the loading spinner is not visible, because all actions
relating to it are in the same render step of the browser.

The loading occurs fast enough now, that we also don't want to show an
intermediate spinner.

Change-Id: Id2a3584deed2ecde807d8f354341dd6868b10009
2016-02-21 20:57:44 +00:00
Fomafix 0b5c23d42b Use .prop() instead of .attr()/.removeAttr() for boolean HTML attributes
https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript#Pitfalls

Create elements according to
https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript#Creating_elements

Change-Id: I14a7f6e8d2c0a43b89d0d186398a4fea76b7d362
2016-02-07 14:22:56 +00:00
Fomafix 19789d762b Use background-image instead of <img> for toolbar icons
Change-Id: I8af0e2c8585e8d9f6f72133953792eb88a176bcf
2015-12-22 13:36:36 +00:00
paladox bdb67f719c build: Test JS code with jshint and jscs via npm
Change-Id: I039bc4c17fbba3c74a5050066b20af05434ca482
2015-11-18 12:06:36 +00:00
Schnark 522331ddda Wikieditor: Rework deferred building of toolbar
Currently sections of the toolbar can be built deferred. This
is done for the help section and the special characters. The
disadvantage is, that you can't modify such sections before
they are really loaded.

This patch modifies the behavior by doing the following:

* Toolbars are always built directly. After all, deferring isn't
  used there anyway in the standard configuration.
* When a booklet is requested to be built only when it's needed,
  the index and all pages will be built immediately, only the
  content of the pages is deferred and built only when it is
  needed.

Even on slow machines building all pages immediately doesn't cause
noticeable pauses, in fact, opening a page with special characters
seems even faster because only the page you need is built, not all
pages.

Since all pages exist from beginning, you can remove and add pages
from user scripts. It is still not possible to modify an existing
page (add or remove a row to a help page, add or remove a character,
unless it is the page that was opened last time), but this is something
that shouldn't be needed very often, so it should be acceptable that
it still doesn't work.

Bug: T25479
Bug: T70791
Change-Id: I0e61b1fd4f6139a251e53a1fac28b3821bc6b860
2015-08-14 13:11:39 +00:00
Derk-Jan Hartman 1b02e98296 Toolbar: Remove Opera redraw hack
The versions of Opera that this was targeting aren't really supported
anymore anyways. So let's just remove this hack.

Bug: T106574
Change-Id: I1b11fc8ec30f3c33b681daff7f676fa965fb78cb
2015-07-22 21:06:28 +02:00
jenkins-bot 10ff6c36de Merge "WikiEditor shouldn't store wrong cookies for booklets" 2015-07-21 23:01:58 +00:00
Fomafix 7c932c06da Fix spaces
Change-Id: Icce6ba3de9e472472b8b9e98e78e4aece82e806d
2015-07-20 07:12:45 +00:00
Schnark 72d7413480 WikiEditor shouldn't store wrong cookies for booklets
When additional booklets are created, or existing removed, WikiEditor
currently stores one wrong cookie for each new booklet. This is because
twice a wrong id is passed as parameter, and because a cookie is set for
the default value. This patch fixes these issues.

Additionally I replaced in the function that needed to be edited a loose
comparison with a strict one ($.cookie will return null, never undefined),
and .size() by .length.

Bug: T27184
Change-Id: Iacc1c71a1e0fc2307a3a28d9c1bb00967ac9827a
2015-07-16 07:19:25 +00:00
Derk-Jan Hartman e8d37102a5 Toolbar: Let's remove a speedup loop...
Change-Id: I3e965dda1c48195d7c11f1d7f23a09dd8447cfc7
2015-07-06 14:41:33 +02:00
Fomafix edbee613fc Support fallback languages for icons
Use mw.language.getFallbackLanguageChain() to get the
fallback language chain. This chain currently always contains 'en'
as last element. Remove the last element to prevent a fallback to 'en'.

Reimplement autoIconOrOffset to correctly prefer sprite before icon.

Bug: T87247
Change-Id: I452dd45d20ea4dd542d63274b7aad0272e20ea12
2015-06-21 15:42:18 +00:00
jenkins-bot 51cc8a3d21 Merge "Move style from JavaScript to CSS" 2015-02-08 19:55:44 +00:00
Fomafix 000031fd48 Move style from JavaScript to CSS
Change-Id: I1bf4b886e3b9b789df377dbdd2df94eb80dd61d1
2015-01-14 07:51:24 +00:00
Fomafix 790a1af231 Fix whitespaces in JavaScript
* Use a singe space as whitespace.
* Remove space before colon when not used as ternary operator

Change-Id: I6391bbcf10d26fadf82686d7ff226b773868415c
2015-01-14 07:14:44 +00:00
Fomafix 169c4bfb7d Fix whitespaces for JavaScript and CSS
Change-Id: I3f6bf0d9e788cdca19b2b699fcb0a7b5ceab2a93
2015-01-13 09:14:53 +00:00
Alexander Jones 55c6e1271f Add QUnit test for ext.wikiEditor.toolbar
This patch replaces the manually operated test module for ext.wikiEditor.toolbar
with one based on QUnit. The new test suite uncovered a bug with the removeFromToolbar
API function in jquery.wikiEditor.toolbar, which prevented the removal of select buttons
from the toolbar. This issue has also been fixed in this commit. .jshintrc was updated
to ignore the new QUnit global.

Bug: T39485
Change-Id: Icef3debcffa484a8d78628bcd9da0892b750bb40
2014-11-29 14:12:26 -06:00