Commit graph

8258 commits

Author SHA1 Message Date
Thiemo Kreuz 45096d1e2f Streamline and harden template paramter search widget behavior
What this changes:
* The moment the user selects anything in the parameter search
  widget, the input is cleared, no matter what happens next.
  Even in case of an error. We know the input was bad in this
  case. Let's get rid of it.
* The method makes sure it does not even try to add a
  duplicate parameter. This should be unreachable, but better
  be safe than sorry.

This is split from I5eeb973. I run into this while playing
around with different approaches related to hiding deprecated
parameters. Typically there should be no way the parameter
search widget offers a duplicate. Still I believe it's a good
idea to have this extra safety-net.

Bug: T272487
Bug: T288827
Change-Id: I04e76d73b4a3f6467d0ccf3ccff5d2f6b4114bd9
2021-08-20 07:46:26 +00:00
jenkins-bot 21d9f533c8 Merge "Avoid conflicts between 2017 wikitext editor and DiscussionTools new topic tool" 2021-08-03 16:14:18 +00:00
jenkins-bot cf17a1f191 Merge "Remove tooltip from template dialog title" 2021-08-03 15:29:10 +00:00
jenkins-bot 7ef4fdc0c2 Merge "Revert "Hide deprecated parameters if they don't have a value"" 2021-08-03 08:42:35 +00:00
Thiemo Kreuz (WMDE) 8d9b4526c6 Revert "Hide deprecated parameters if they don't have a value"
This reverts commit 0d4dee341b.

Reason for revert: This made it entirely impossible to add a
deprecated parameter, even if done intentionally. Needs more tests.

Bug: T274551
Change-Id: I7389bad0845cd1ce78f9d7ef71592cb1ce2a063e
2021-08-03 08:24:24 +00:00
jenkins-bot e57daaad98 Merge "Minor JSDoc documentation fixes in template dialog code" 2021-07-29 12:13:17 +00:00
jenkins-bot c7274acf80 Merge "Remove skinning modules when showing preview" 2021-07-28 19:35:42 +00:00
jenkins-bot 8102c3cc36 Merge "Move abort event tracking from the start to the end of the teardown process" 2021-07-28 16:59:03 +00:00
Arlo Breault 2fd09aaba3 Remove skinning modules when showing preview
Bug: T185284
Change-Id: Ifec8809cd75cb76c79936a69351be0c7779de39e
2021-07-28 10:55:16 -04:00
Bartosz Dziewoński ec3341c9a1 Avoid conflicts between 2017 wikitext editor and DiscussionTools new topic tool
They both want to handle the same URLs. If we detect that
DiscussionTools new topic tool will open, then do not open 2017
wikitext editor.

Bug: T282204
Change-Id: Ic7dd677ea219938969f60bab91387c2e03ebdbe6
2021-07-28 16:10:22 +02:00
jenkins-bot 98aeab538b Merge "MWInternalLinkAnnotationWidget: show disambiguation pages last" 2021-07-28 03:00:52 +00:00
MusikAnimal 4fbab29e22 MWInternalLinkAnnotationWidget: show disambiguation pages last
Disambiguation pages are rarely the page users intend to link to,
especially with newbies. By moving the disambig page(s) as the last
result, the user is more likely to pick the page they actually intended
to link to.

Bug: T285510
Depends-On: I2b8545f6dd4849629037f81f48a540748e60da83
Change-Id: Id55a19e7665d8f88559c471de36e5447fb2babb0
2021-07-27 18:36:50 -04:00
Bartosz Dziewoński 6dc9b55b21 Move abort event tracking from the start to the end of the teardown process
Bug: T237063
Change-Id: I66869f8a84692e6fbe00373460449714cc722084
2021-07-27 22:50:52 +02:00
jenkins-bot 632d83aa8d Merge "Fix rare exception when editor loading is aborted" 2021-07-27 17:27:30 +00:00
Bartosz Dziewoński 995644de88 Fix rare exception when editor loading is aborted
If editor loading was aborted while the surface was already being set up,
this code would cause the following exception:

    Uncaught TypeError: Cannot read property 'tools' of null

Introduced in c02c529537 (2017) because
our coding conventions at the time demanded that all `var` statements
must appear at the beginning of a function.

Bug: T287487
Change-Id: Id657d6f1e1189c17ede25362f145bb7b10f441db
2021-07-27 17:40:13 +02:00
jenkins-bot e36d67cf75 Merge "Hide deprecated parameters if they don't have a value" 2021-07-23 11:04:17 +00:00
Andrew Kostka 0d4dee341b Hide deprecated parameters if they don't have a value
Bug: T274551
Change-Id: I6bfceae2579a5bcedae9da7eb5326fe8f60ea7c0
2021-07-22 12:24:57 +02:00
Andrew Kostka ef33a908a0 Dynamically set the visibility of the sidebar search
With this users can also filter undocumented parameters
that they added to an empty starting template.

Bug: T272481
Change-Id: I99adb38b0ae4d4ade91fcb506f10c0222b9bb5e8
2021-07-20 13:11:08 +02:00
Andrew Kostka 6cec42f8dc Don't reset the sidebar search field if the search widget is undefined
Bug: T286987
Change-Id: I66116ea08d4682e179e9eb70d117454194e3517d
2021-07-20 12:08:00 +02:00
Andrew Kostka d44bc19d20 Adjust the styling for the template parameter search
Bug: T272481
Change-Id: Ie1c6b95cf32640401cb2a17bcda656a40a22e9b4
2021-07-16 18:03:48 +02:00
jenkins-bot d738698deb Merge "Fix incomplete back button implementation in template dialog" 2021-07-16 14:41:07 +00:00
jenkins-bot 317b78782e Merge "Make it possible to reuse existing transclusion outlines" 2021-07-16 14:25:24 +00:00
jenkins-bot 4cb9b05668 Merge "fix order of sidebar elements" 2021-07-16 14:15:16 +00:00
Svantje Lilienthal 2f4e73d6ed fix order of sidebar elements
Bug: T272481
Change-Id: Ifd925bd6e8b972fd5d4e851c3a39a91aeac97d43
2021-07-16 15:10:56 +02:00
jenkins-bot 18a18bc825 Merge "Fix incomplete template dialog event handling in new sidebar" 2021-07-16 13:07:03 +00:00
Thiemo Kreuz 014bc9369c Fix incomplete back button implementation in template dialog
Bug: T286783
Change-Id: Ie86e2c8c6a874fde11591286a83faba71a34430d
2021-07-16 14:54:09 +02:00
jenkins-bot 575d4a8376 Merge "Fix ellipsis on long strings in parameter search widget" 2021-07-16 12:48:53 +00:00
Thiemo Kreuz 5c6d2212da Make it possible to reuse existing transclusion outlines
Note that this patch alone probably does not make that much
sense. The code executed is pretty much the same. The only
difference is that the empty (!) …ContainerWidget is kept
and re-filled with what might be a completely different
template.

This is not much of a difference to before when the
container was recreated.

This change will make more sense when the container has to
manage more state, e.g. focus states. This state will
survive then.

Change-Id: Ic336d10a595e3e222741a3dc57c1d54639166b7a
2021-07-16 14:43:31 +02:00
Thiemo Kreuz 092276009a Minor JSDoc documentation fixes in template dialog code
Change-Id: I3697e48697ab0910b90b418abbc370736589b6e1
2021-07-16 14:25:11 +02:00
jenkins-bot 4ab5fd5c6b Merge "Add a message next to undocumented parameters" 2021-07-16 12:05:29 +00:00
Thiemo Kreuz 1bbf7c3394 Fix ellipsis on long strings in parameter search widget
This ellipsis was there before we started working on this code,
but was never working properly.

We understand that the CSS was intentionally done like this (as
the comment explains). However:
* We changed the width of the dialog. The old value doesn't
  match any more.
* The width is different when the sidebar is expanded vs. when
  it is collapsed. Even if we update the number, it won't
  always work.
* The 100% work fine in current browsers. I can only assume
  this was different back in 2014 when this CSS was written
  (see Ia8259e9).

Bug: T285044
Change-Id: I3de2b0ed0b6a05d2b9fa0b325a2b12277564b271
2021-07-16 13:33:51 +02:00
Thiemo Kreuz 434c11f6de Fix incomplete template dialog event handling in new sidebar
Notably:
* Don't require the model in the new sidebar via dependency
  injection, but connect the event handlers later. This is
  relevant because we currently create the new sidebar in the
  wrong spot. Removing the hard dependency allows us to split
  the code and utilize initialize() and getSetupProcess()
  correctly. This will be done in a following patch.
* The change event now includes the new position. This makes
  it very easy to add this missing feature to the new sidebar.

Also:
* Stop triggering change events when nothing changed. These
  events are expensive. They bubble all the way up to the
  TransclusionModel, and to all linked
  onTransclusionModelChange() handlers.
* Update event documentation to make this more visible.

Bug: T274544
Change-Id: Iafe29f18a6fed14d9c3124c9756aa840886afbbc
2021-07-16 11:29:26 +00:00
jenkins-bot cdf2497983 Merge "Tweaks and cleanups to template parameter search" 2021-07-16 10:47:37 +00:00
jenkins-bot 3858829c19 Merge "Fix template editor showing more than one new sidebar" 2021-07-16 10:18:06 +00:00
Thiemo Kreuz 1164f67f40 Tweaks and cleanups to template parameter search
Notably:
* Include parameter aliases, labels and descriptions in the
  search.
* Don't use a possibly outdated search index, but live data.
* Clear filter when a new checkbox is added.

Bug: T272481
Change-Id: Ie90a803af6178a8bb6de370a0f8e079800d9f8a2
2021-07-16 12:11:13 +02:00
jenkins-bot 6e86365b81 Merge "Add parameter search to sidebar of VE TemplateDialog" 2021-07-16 10:06:15 +00:00
Svantje Lilienthal 066c663864 Add parameter search to sidebar of VE TemplateDialog
Bug: T272481
Change-Id: If044e5d134f1b24f939c4786949e6ca34fb79e1e
2021-07-16 09:48:29 +00:00
jenkins-bot 974db3940f Merge "Show ellipsis when sidebar parameter names are too long" 2021-07-16 08:28:13 +00:00
Andrew Kostka 9ffdd51f04 Show ellipsis when sidebar parameter names are too long
Bug: T285044
Change-Id: I6bf53ec4d6d45888ed7e9ba1d67848e41224de63
2021-07-15 17:35:42 +02:00
jenkins-bot a8ff5f2b41 Merge "Remove trash icons from the content view" 2021-07-15 15:21:57 +00:00
Thiemo Kreuz 8ab2ec25ea Fix template editor showing more than one new sidebar
Bug: T274544
Bug: T286715
Change-Id: I9fe8b53a73b1862eca2d99afb02aa3d532d61918
2021-07-15 15:17:44 +00:00
Andrew Kostka f02c48ea52 Add a message next to undocumented parameters
Bug: T274550
Change-Id: I1af71150239ebc9966cc22e7d28883fbac99fdf1
2021-07-15 14:47:21 +02:00
Andrew Kostka 01d8a8c7a4 Remove trash icons from the content view
Bug: T275761
Change-Id: I8d2c1b8ebdc2e20779d0207b1a2ebe6ce36c54e7
2021-07-15 12:20:45 +02:00
Thiemo Kreuz 766b220f5a Finishing touches to new template editor sidebar
In detail:
* Allow clicks on all elements in the new sidebar. This should
  focus the corresponding element on the right.
* Make all elements in the new sidebar tabbable.
* Fix MWTransclusionOutlineTemplateWidget.createCheckbox() to
  not need a temporary param object any more.
* Rewrite more code in MWTransclusionOutlineTemplateWidget to
  be shorter and easier to read.
* Fix MWTemplateModel.addParameter() to not do way to much
  stuff when a parameter already exists.
* Update code documentation.
* Use more specific, less ambiguous variable and method names.

Bug: T274544
Change-Id: Iaf6f7d1b0f7bf0e9b03eb86d01f3eceadece6fe4
2021-07-15 08:40:35 +00:00
Thiemo Kreuz ff9f8a9e2d Focus template editor elements on click in the new sidebar
Clicks on the left side now focus elements on the right
side.

This patch also simplifies the …ContainerWidget constructor.
The config parameter should only be used for "OOUI things"
that are needed by subclasses and mixins. But the parameters
we have here are not "UI things".

Passing them as config passes them to classes where we don't
know what they do with it. What probably happens is that
some class keeps a reference to the entire config object,
which doesn't have a benefit and possibly blocks garbage
collection.

Bug: T274544
Change-Id: I0c0e4a1ba59dcb43141338ffe939c9c6783e000d
2021-07-15 08:40:28 +00:00
Thiemo Kreuz 198c5dba77 Make button to add undocumented template parameter work
Thanks to the widget now being an actual ButtonElement.

Bug: T274544
Change-Id: I1b0ef28b0aa115a027a07f3ae53c583598483e96
2021-07-15 08:40:20 +00:00
Thiemo Kreuz eb1f1e28a3 Make new template editor sidebar items actual ButtonElements
Actually reusing this OOUI mixin gives us a lot of well
developed functionality we need anyway. Most notably proper
event management, e.g. click events.

The number of CSS properties we need to override is managable,
I would argue. Let's see:
* Our buttons are not inline-elements, but should use the full
  width.
* No focus-border left and right for the same reason.
* We want much more inner padding.
* We want a stronger hover effect.
* We need to fine-tune the position of the icon. This is
  because of the inner padding.
* Need to get rid of a negative margin that's only relevant
  for inline-buttons.

I currently feel like the benefits are worth living with
slightly more brittle code. Note that we can undo this change
any time because all this is well encapsulated in this new
class.

Bug: T274544
Change-Id: I33f275a958964d49e803e56bf74a6fa961093da1
2021-07-14 13:31:40 +02:00
Thiemo Kreuz 170ca9d58a Reuse generic button widget for elements in the new sidebar
This introduces another generic "button-like" class that can
be reused in multiple places in the new sidebar. The main
change in this patch is the "add more information" button
which is now an instance of this new class as well.

This patch also simplifies over-complicated setup code in
related widgets.

Bug: T274544
Change-Id: I0cfe7675d02fdd5c5dc8d9198bb3f4aec9abf397
2021-07-13 17:23:27 +00:00
Thiemo Kreuz 28049425ec Various design tweaks to the new template dialog sidebar
Still far from being finished, but much closer to the mocks
already.

Bug: T274544
Change-Id: I1feee06e43a4b9c10a2d9443b6d816595bead64d
2021-07-13 13:00:37 +00:00
Thiemo Kreuz 31904688df Update new sidebar when moving template parts up/down
The new sidebar now updates accordingly when elements are
moved around.

Bug: T274544
Change-Id: Ic6bc3484c54523aa4edc6b48a843c47059569061
2021-07-13 10:18:20 +02:00