Commit graph

160 commits

Author SHA1 Message Date
Ed Sanders 2b3345af11 Change feedback link for new topic tool
Bug: T279400
Change-Id: I5d72552f45a63199c0fbb516dc94aef19945c95e
2021-05-26 11:27:01 +00:00
Ed Sanders 1893405635 Code style: Move var declarations inline
Change-Id: I1686603388b050ba4ec22eff23e4806cdf262b87
2021-04-22 17:43:46 +00:00
Bartosz Dziewoński 6bf75b4752 Fire the 'wikipage.content' hook on previews
We already fire it after saving the reply/topic.

Bug: T279141
Change-Id: I4ecbea877035f61d9642dded9ca54e5bff795099
2021-04-08 21:38:45 +02:00
jenkins-bot 9bf9977369 Merge "Fix switching interface getting stuck after failing to switch" 2021-04-03 12:59:21 +00:00
Ed Sanders 4c27187500 Make the source mode toolbar a user preference feature
Bug: T275950
Change-Id: I099af342f378215c68092d165dd88de1807d29d2
2021-03-31 22:40:53 +02:00
Bartosz Dziewoński 5dae22e93a Fix switching interface getting stuck after failing to switch
Follow-up to 58c078437d.

Bug: T274423
Change-Id: Ie410b61e2b64d9ef2bb20d5df9f95d2c90392323
2021-03-29 21:22:07 +02:00
jenkins-bot 4e956d11b9 Merge "ReplyWidget: Separate out switching logic into switch method" 2021-03-29 19:17:27 +00:00
Bartosz Dziewoński 566d4d92db Trim wikitext for preview
And change some uses of trim() to htmlTrim() for consistency.

Bug: T276612
Change-Id: I1f55f4793af8f3dda597288c9e3427abe31c37c9
2021-03-24 18:53:41 +01:00
Ed Sanders 822472a6ec ReplyWidget: Separate out switching logic into switch method
Keep implementation-sepcific modeTabSelect handling in
modeTabSelect event handler.

Change-Id: I183bc80eb9f0e2a69aa30e5de82026983e3006be
2021-03-24 14:09:09 +00:00
jenkins-bot abb14d091a Merge "ReplyWidget: Hide external links icons in the anon warning" 2021-03-20 17:41:36 +00:00
Bartosz Dziewoński 9da3949c47 Add accessibility labels to a few controls
Topic title field and old wikitext reply field had only placeholders,
but no labels.

Mode selector had labels on individual items, but not on the main
control.

Change-Id: I422e7e5baa8711340a1bb82255e788f2272c45c9
2021-03-18 15:15:40 +01:00
Bartosz Dziewoński 58c078437d Improve mode selector keyboard interactions
When there are just two modes, using arrow keys to switch between
them is not intuitive. The focus moving from the selector to the
body widget afterwards is even less intuitive.

Override default TabOptionWidget to allow options to be highlightable
(not just immediately selectable), and mark the current mode's tab as
disabled instead of selected (but make it look selected).

This results in intuitive keyboard interactions (tabbing to the widget
highlights the other tab rather than the current one, pressing enter
switches to it).

Bug: T274423
Change-Id: I9d358d5f301cbf081380ef5d34ccc8c4e146652e
2021-03-18 15:15:40 +01:00
Bartosz Dziewoński 522b7932d7 ReplyWidget: Hide external links icons in the anon warning
Similar to 282c987efa.

Change-Id: I0f6ca2d4aef114d7c8853df19140bbd27c20325a
2021-03-17 15:50:34 +01:00
Ed Sanders ece8ff69ff Change dt- class prefix to ext-discussiontools-
Longer, but follows the style guide and less likely to conflict.

We need to account for init classes in the cache being around for
a while.

Change-Id: I738bc93393850db320fdbda2b003ca8ac40556da
2021-03-13 14:42:39 +00:00
Bartosz Dziewoński 1a52f06daf Tweak signature formatting in previews for more accurate results
When posting a new topic, if your comment ends with a template
that has trailing line breaks, the signature will be added as a
preformatted text (which is arguably a bug: T255741).

Preview, however, did not reflect this bug, because of the <span>
markup added to fade out the automatic signature.

Change-Id: I062b01a035e22edfca752a49c5e2433b3f7fb4f6
2021-03-09 01:08:59 +01:00
Ed Sanders 5324e60e84 Tracking changes from VE source mode
Change-Id: I5cafa7a21a0ab90fab9d09e44b7525ee07f56709
2021-03-08 21:13:10 +00:00
Ed Sanders f5c3da2a86 Pass replyWidget to target
This allows the target to access $headerWrapper directly
instead of using flaky DOM traversal.

Change-Id: I81f6616ea8fa7cbfb58e576fd5b2739c6158a216
2021-02-28 22:07:51 +00:00
Ed Sanders 01ac28540a Support the enable2017Wikitext option
Bug: T257391
Change-Id: If2511609035c26063203512f4b860bd0060e08af
2021-02-26 19:13:54 +00:00
Bartosz Dziewoński 444e5deb62 Make sure the Visual/Source mode selector loses focus after switching
Bug: T274423
Change-Id: Icfa4d435e4cb0ecab123c5fbdb68f23ecde99b5f
2021-02-24 12:32:14 +00:00
Ed Sanders 33c6181e79 Rename indent replacement methods
Change-Id: I8cb1b58dad068be7cfa62cab9e932463a23c6b12
2021-02-17 23:42:57 +00:00
jenkins-bot 63a5916e53 Merge "Update warning about missing topic title immediately" 2021-02-02 12:11:21 +00:00
jenkins-bot fb415e374d Merge "Update 'save_failure_type' map for EditAttemptStep schema" 2021-02-01 18:28:13 +00:00
Bartosz Dziewoński 069050ad12 Update warning about missing topic title immediately
Since it's no longer tied to the "Reply" button, we can move the code
from ReplyWidget to NewTopicController, where it belongs.

Bug: T272543
Change-Id: I8c90ffb772573d22d26c608d45877ee948fd232d
2021-01-29 23:14:45 +01:00
Bartosz Dziewoński d354b34fa6 CommentController: Even better handle clicking links while already commenting
If the user is clicking on a new topic link, and a reply widget is
open, attempt to close it instead of doing nothing.

Bug: T272545
Change-Id: I1903f5ae4c9e98c4b3a4703ad0e44d772894592a
2021-01-25 23:42:15 +01:00
Bartosz Dziewoński 37b574f165 Separate dialog for abandoning a new topic
Bug: T269190
Change-Id: Ie4f486b0641edea369702631556d8ea31f991370
2021-01-19 21:40:21 +01:00
Bartosz Dziewoński 1fa9a020ad Update 'save_failure_type' map for EditAttemptStep schema
Remove unused error codes, update the ones that changed, and sort in
the order in which the types are listed on the schema page.

Bug: T272162
Change-Id: Ib16f7e11ff81d43443b08cf704ce5196420671e4
2021-01-15 19:54:45 +01:00
Bartosz Dziewoński d76143bc08 Ability to add new discussion sections
1. Extend the JS modifier to allow adding top-level comments
   (that is, replies to headings). PHP modifier doesn't do this
   because we'll save the changes using paction=addtopic instead.

2. Subclass CommentController to allow adding a new heading and a
   top-level comment underneath it at the same time.

3. A lot of ugly code in ReplyWidget to customize the interface
   for this case. Much of it should probably be moved to
   CommentController/NewTopicController.

Bug: T267595
Change-Id: I9c707bb7f7aae1b92c72fb4dee436490f8c8409b
2021-01-12 20:15:28 +00:00
Ed Sanders a082535e02 Fix styling of error/captcha MessageWidgets
Change-Id: I592c1a08238dc46ee342672be29a8070b495f3dd
2020-12-11 16:27:07 +00:00
Ed Sanders 1871c70378 Show keyboard shortcuts in button tooltips
Bug: T264913
Change-Id: I3c5b248f7c7b0ef381baab84fe98d4ba0cefd35a
2020-11-26 19:06:17 +01:00
jenkins-bot 579cc20120 Merge "Move ID->title logic into HeadingItem" 2020-11-05 18:10:08 +00:00
Ed Sanders 3c88f7de39 Always use ':' for indentation in preview
Matches what we end up posting. Leave context-aware code
commented out as this issue is not settled yet.

Change-Id: I7360e53d5d7823b2b52318005459212a21a6edc2
2020-11-05 16:15:38 +00:00
Ed Sanders 79c91c3cfc Move ID->title logic into HeadingItem
Change-Id: I03408d2404a99b5bc7795c1c4bf214d4b5fea1e0
2020-11-05 16:10:39 +00:00
Bartosz Dziewoński 203a4dcb42 Use 'id' attributes rather than heading text for edit autosummaries
Ideally the edit autosummary would be generated in the same
way as in the old wikitext editor: from the wikitext of the
heading. But on the JS side, we don't have access to the
wikitext, or to the PHP method that generates autosummaries.

This might seem crazy at first, but ultimately the point of
the autosummaries is to link to the section heading by its
'id' attribute, so it is perfectly reliable.

Doing it this way depends on $wgFragmentMode being set to
[ 'html5', 'legacy' ] or [ 'html5' ], otherwise the escaped IDs
are super garbled (particularly in non-Latin-alphabet languages)
and can't be unescaped reliably. Conveniently, we already
require that since 9ee0fd69f5.

Bug: T264561
Bug: T266725
Change-Id: I7d35098d672d0edb50d49e22de1686d5cc83b60e
2020-11-05 15:13:08 +00:00
Ed Sanders 7abd4621ae Use new heading markers for getting heading ranges/text
This will need to be deployed a few days after I782caafc3
to avoid issues with cached HTML.

Change-Id: I4b00d0b0efed9d91c0bc28914bbdf0955bb552b6
2020-11-04 21:04:40 +00:00
jenkins-bot f3c5d405b3 Merge "Switching editor modes would switch editor_interface before success/fail" 2020-10-30 23:19:06 +00:00
jenkins-bot 1baf837a19 Merge "ReplyWidget: Hide external links icons in the footer" 2020-10-30 17:43:22 +00:00
jenkins-bot 8f54ca44ac Merge "ReplyWidget: Fix exception when toggling the "Advanced" drawer" 2020-10-30 17:19:35 +00:00
Ed Sanders 6450cea848 Fix fetching of headline node with new HTML
This code path needs to work with new and old HTML
markup around headings.

Change-Id: I2291e407e68423b34fca4d53362680d97ab44a71
2020-10-29 15:41:26 +00:00
David Lynch b3186f8d6a Switching editor modes would switch editor_interface before success/fail
Also, stop the dialog-prevent-show event from switching editor_interface
just because it's tied to the `editor-switch` feature.

Bug: T259673
Change-Id: I2acf9d79add281ed0f62f022e44bb18948ceafc8
2020-10-28 21:59:32 -05:00
Bartosz Dziewoński 282c987efa ReplyWidget: Hide external links icons in the footer
Bug: T266686
Change-Id: I20debf936d73e4615b485e1b089616de8646e624
2020-10-28 18:07:43 +01:00
Bartosz Dziewoński 157d34c852 ReplyWidget: Fix exception when toggling the "Advanced" drawer
Bug: T266685
Change-Id: I9ba7761abbdeb1ee6f3449287923f7a77d85c531
2020-10-28 18:07:34 +01:00
jenkins-bot 333486fd85 Merge "Add preference to expand the "Advanced" menu when replying" 2020-10-27 11:42:41 +00:00
Ed Sanders 3b31aa669d Create controller.getApi method with defaults
Only share API objects when it is safe to do so.

Change-Id: I4810f59ce41c43f78e0b42db6b36620b2aca1cec
2020-10-23 12:30:37 +01:00
Bartosz Dziewoński 2f28cfdf56 Add preference to expand the "Advanced" menu when replying
* Add the preference
* Only display it when the reply tool is enabled
* Use it when opening the reply tool
* Save it when the menu is toggled from the reply tool interface

Bug: T261539
Change-Id: Icb8fa6b3f1e9a3644669f21b08f34ea8c175f2f9
2020-10-20 07:09:40 +02:00
Ed Sanders dfdadee481 Simplify edit summary selection logic
Always select the default reply if it looks unchanged, i.e.
we see '...*/ Reply' at the end of the summary.

Bug: T263062
Change-Id: I0a79d9e5072d9d9df16c93435502f67524e2d2bc
2020-10-07 18:56:17 +01:00
Ed Sanders eeefd985d6 Remove number when reading heading node
Bug: T264561
Change-Id: I0e6235f6b7169665e403fd6db1812fe90e8932b0
2020-10-05 21:58:51 +01:00
Bartosz Dziewoński 48d5a67d41 ReplyWidget: Pass initial config values to #setup, not to constructor
The same ReplyWidget instance can be re-used when the user cancels
replying and then starts replying again to the same comment.

Previously, the initial values passed to the constructor (when switching
modes) would still persist in this case, even if they were incorrect.

Bug: T263061
Change-Id: I3dff007456bfd4f3149c718ae72fbf373a2e2913
2020-09-25 20:00:00 +02:00
jenkins-bot e7206488a8 Merge "Collapse advanced drawer when clearing" 2020-09-21 21:08:03 +00:00
Ed Sanders e6b91ced43 Collapse advanced drawer when clearing
Bug: T263061
Change-Id: Ibcd95ce1c86548962b9b7ff7b62bd0d127f53b76
2020-09-21 20:52:47 +01:00
Ed Sanders 9d3eea5fdf Only reset summaryPrefixLength on user event
Bug: T263062
Change-Id: I323ce4dab0a430e2aeb906ae9cd5d6b48a179cff
2020-09-21 20:39:21 +01:00