Commit graph

1278 commits

Author SHA1 Message Date
Ed Sanders 03a94badfe Use current preference each time we open a new reply widget
TODO: Switch already setup widgets when we re-open them.

Bug: T253888
Change-Id: I6c541f27edbfe373f62b8508381bb5182681bda4
2020-05-29 13:06:36 +01:00
Translation updater bot cd216ec538 Localisation updates from https://translatewiki.net.
Change-Id: Idbd6f54539bffc88497854f3e741af08220359a6
2020-05-28 08:39:06 +02:00
Bartosz Dziewoński 43a7e82ed0 Tests covering fr.wp unsigned comment templates
Bug: T252058
Bug: T252059
Change-Id: Ica7426055e73562a98b99d6ea06e257df77b7493
2020-05-28 00:13:07 +02:00
Bartosz Dziewoński 79ae8a32c5 Support parsing when timestamp is wrapped in a link
Bug: T252059
Change-Id: Ib8952fb80503bad407e8d0fe725103a0fae12a6a
2020-05-27 22:47:17 +02:00
Bartosz Dziewoński 01b4a8f4f4 Support replying when timestamp is template-generated
* Move modifier#getFullyCoveredWrapper to utils
* Use that method to find the node where we start searching for
  template wrappers, rather than using endContainer

Bug: T252058
Change-Id: I55de58102f3468fce01290bd413a7fdc96d322d6
2020-05-27 21:16:03 +02:00
Bartosz Dziewoński c7575b49f6 Work around invalid ranges in #getNativeRange
Change-Id: I46a54654acb15fb1ef7b80495cf1be8103b7688f
2020-05-27 21:16:03 +02:00
Ed Sanders 12db2cbe6b Update mediawiki-codesniffer to 31.0.0
Change-Id: I14c3e5f9638f180d033cfeb45d1ba027a6811475
2020-05-27 17:32:46 +01:00
Translation updater bot 60155846aa Localisation updates from https://translatewiki.net.
Change-Id: I587a39bdcbe72753536743a1398bd04b3992f535
2020-05-27 08:48:28 +02:00
Translation updater bot 8d730699f7 Localisation updates from https://translatewiki.net.
Change-Id: Ibe821ebfc9d28a9f0b4aafabe990e2217e278e88
2020-05-26 08:35:41 +02:00
jenkins-bot d8a6362361 Merge "Fix failing test case for PHP modifier" 2020-05-26 03:08:48 +00:00
jenkins-bot 9f2ead06eb Merge "Insert replies outside of decorative comment frames" 2020-05-25 19:30:28 +00:00
jenkins-bot f9d0756494 Merge "Create ImmutableRange class in PHP" 2020-05-25 19:30:27 +00:00
Bartosz Dziewoński 72c730f6c4 Fix failing test case for PHP modifier
The expected HTML was wrong, a '<br />' tag inside 'data-mw' was
somehow turned into '<br ></span>'. No idea how that happened.
Something must be wrong with the HTML parsing in JS tests, which
were used to generate this file.

Change-Id: I69caa68fe70e706df81e8adf29889254704f601e
2020-05-25 21:09:18 +02:00
jenkins-bot bb0a4c80d8 Merge "Remove empty lines in visual mode too" 2020-05-25 17:15:50 +00:00
jenkins-bot 08e6db455d Merge "Use the faster childIndexOf() approach in JS too" 2020-05-25 16:37:17 +00:00
Translation updater bot 5e5b48f857 Localisation updates from https://translatewiki.net.
Change-Id: I9a7dd0526943603b8bed4297961e87d551533c5d
2020-05-25 08:39:21 +02:00
Ed Sanders e064f43499 Remove empty lines in visual mode too
We already do this in source mode (sanitizeWikitextLinebreaks).

Bug: T253402
Change-Id: I10390b3173d22e8db735f5cd60180b1f48b94fff
2020-05-22 20:21:46 +01:00
Ed Sanders ac476eb4cf Initialize tab state to avoid flicker
Also set 'defaultMode' before calling parent constructor.

Bug: T234403
Change-Id: I08320bd539419ddf7ba22a5dc316177d751bcb8d
2020-05-22 18:25:04 +00:00
Bartosz Dziewoński 8f583a23be Use the faster childIndexOf() approach in JS too
I was wondering if the different approach to childIndexOf()
implemented in PHP in b8d7a75c34 would
be faster in JS as well, and yes, it is.

Our test suite now takes (on my machine):
* Chrome: 8337 ms → 7355 ms (average over 5 tries)
* Firefox: 5321 ms → 5044 ms (average over 5 tries)

Change-Id: I71963eeb92dcea9bfd59cbf01a7aa0b7de5d9cf1
2020-05-22 19:33:35 +02:00
Bartosz Dziewoński 420c514091 Insert replies outside of decorative comment frames
When there is a wrapper element whose range matches the range of
a comment, any replies will now be added outside of that wrapper,
instead of directly after the comment (inside the wrapper).

Bug: T250126
Change-Id: I6b42c4db019ae998e91eebd324f9cbd2aa791b4f
2020-05-22 15:01:12 +01:00
Ed Sanders b3ca37c1c5 Create ImmutableRange class in PHP
TODO: Create one in JS as well

Change-Id: I6c9dc2455afcb8d0b68674a2985c5e43dd94b6fb
2020-05-22 15:01:09 +01:00
jenkins-bot 16cf49e7e4 Merge "ReplyWidget: Avoid buttons shifting when switching to source" 2020-05-22 11:05:32 +00:00
Translation updater bot 98b6d9c0ca Localisation updates from https://translatewiki.net.
Change-Id: I02b26487d7c9250f2946e3af31f79fb533ffa7f1
2020-05-22 08:34:56 +02:00
Bartosz Dziewoński fbd6338331 ReplyWidget: Avoid buttons shifting when switching to source
When the preview loads, the "Reply" / "Cancel" buttons shift downwards,
which looks ugly. Try to wait for the preview before showing the source
editor interface.

Bug: T234403
Change-Id: I70989fb9fbcac17e1a0672eda8d34bf26003bb96
2020-05-21 23:43:51 +02:00
jenkins-bot 54db24f1f5 Merge "Don't allow users to switch to a mode they are already in" 2020-05-21 18:21:42 +00:00
Ed Sanders 2d9a760d4e ReplyWidget: Use interface dir for UI
* Reset to content dir for preview.
* <textarea> gets dir from the `.sitedir-* textarea` rule.
* VE already sets the content dir in the editor.

Bug: T253255
Change-Id: I76df093490e86a730ccd5610c43c9b3fc7e07a54
2020-05-21 18:28:03 +01:00
Ed Sanders ade5f7cb6c Visual: Use createModelFromDom when setting document
Ensures that MW target sets the correct dir and lang on the document.

We should consider upstreaming this.

Bug: T253258
Change-Id: Ibc9ae7b4b105055291c941ce932f499bd6e13657
2020-05-21 18:26:59 +01:00
Ed Sanders 406aed0577 Don't allow users to switch to a mode they are already in
Change-Id: I082108c81ab871b64df76b6f9ba5cf4314ce6458
2020-05-21 18:26:08 +01:00
jenkins-bot d0dd4cf036 Merge "Add autosave support to visual mode" 2020-05-21 17:06:39 +00:00
jenkins-bot 838dcdccad Merge "Avoid deprecated User::getOption()" 2020-05-21 16:21:36 +00:00
jenkins-bot c53cecac10 Merge "Create a user preference to store visual/source mode" 2020-05-21 16:21:34 +00:00
Bartosz Dziewoński 5675eea4d0 Avoid deprecated User::getOption()
Change-Id: Iad32c3e63116c54c47cd3aa2aaf142c5dd5404c5
2020-05-21 13:12:49 +00:00
Ed Sanders 9fbafef652 Add autosave support to visual mode
Bug: T240257
Change-Id: I87f8b68a5afee8d03c81cb283c9bee68ef9d4a5d
2020-05-20 22:16:20 +01:00
Ed Sanders 5feb69612f Create a user preference to store visual/source mode
Bug: T250523
Depends-On: I5b3b47feeeca2085fcd283d55d7e9ceafa73be70
Change-Id: I18f5d38f9d694b12e5f983be7b3b165f135a890d
2020-05-20 22:16:19 +01:00
Ed Sanders 66d3c95f23 Prefix '@' to username auto-complete output
Bug: T252460
Change-Id: I932ccddcacbe15efe9ea08d6a6d028cd84d8815c
2020-05-20 12:28:31 +01:00
Bartosz Dziewoński c64bb6b5b7 Add the test for getAuthors() in JS too
Change-Id: Id7dabc535b6bb688602c0d55fc3696f662cb10c7
2020-05-19 21:13:52 +02:00
Bartosz Dziewoński 515af82061 Reduce duplication between PHP parser and data gen for JS parser
Also, make the handling of TranslateNumerals and digitsRegexp the same
between PHP and JS.

Change-Id: I1d81343d0b59ab3ecd59ba1c2ad99a729d983ac4
2020-05-19 20:54:44 +02:00
Translation updater bot d35facc83f Localisation updates from https://translatewiki.net.
Change-Id: Ica9abfed48cc3bd37c7f000fa098857dbdf8a708
2020-05-19 08:24:16 +02:00
jenkins-bot 2ee6cd6a03 Merge "Add test case for unwrapParsoidSections()" 2020-05-18 23:39:12 +00:00
jenkins-bot f5ac86528b Merge "Show real error message when an exception is thrown" 2020-05-18 23:08:34 +00:00
jenkins-bot 366aca2ccd Merge "Stop printing console warnings" 2020-05-18 22:52:30 +00:00
Bartosz Dziewoński 219339551c Stop printing console warnings
It was useful when I was debugging those parts of the code, but now
it's usually annoying.

The warnings can still sometimes be useful for understanding how the
tool parses some discussion, though. To keep that functionality, add
displaying warnings for each comment in the debug mode.

Change-Id: I2d218a8a394f179bcc0990ff988a0567c275ccf2
2020-05-18 23:37:37 +02:00
Bartosz Dziewoński e12aea2f77 Add test case for unwrapParsoidSections()
Covers the bug fixed in I9133d4365a71d6db1fa58b69ae3b970166d15c1e.

Depends-On: I9133d4365a71d6db1fa58b69ae3b970166d15c1e
Bug: T252238
Change-Id: I92831696864e04384eb514ab69f14563cceafc19
2020-05-18 21:36:48 +00:00
Ed Sanders 607440498e Spell check pass
Change-Id: Ia20da358297126bd52a968bd77c960f81fe82b8f
2020-05-18 21:24:14 +00:00
Ed Sanders c5d1029b25 Move /cases and /data up to /tests
Theses are no longer QUnit specific.

Change-Id: I5f3cca1ff686922e0cdaaedb80858f37df04799a
2020-05-18 21:47:17 +01:00
Bartosz Dziewoński c848d8a90e Parser tweaks
Follow-up to Ic1438d516e223db462cb227f6668e856672f538c.
Minor corrections and comment improvements in PHP parser,
and "backporting" some changes to JS parser that I like.

Change-Id: I5e54121914ec6b323e556dd133bcb71b3aefbb61
2020-05-18 19:53:26 +00:00
Ed Sanders b1427163af Parser.php: Add tests for getTranscludedFrom
Requires an implementation of unwrapParsoidSections

Change-Id: I96c929b1117ba652dbd5af6a1ee37a5f9e87ed1e
2020-05-18 19:53:01 +00:00
Ed Sanders d1e58841af Rename removeListItem to removeAddedListItem and remove in PHP
This method shouldn't be required on the server. Leave comments
relating to it in addListItem so JS & PHP can be kept in sync.

Change-Id: I849fac660faf6e750272c20776f96b9250f96b1b
2020-05-18 19:25:08 +00:00
jenkins-bot 2b7cca1380 Merge "ReplyWidget: Move all events bind to setup" 2020-05-18 19:19:47 +00:00
jenkins-bot 0496e6b7e6 Merge "PHP: More missing typehints" 2020-05-18 17:54:16 +00:00