Commit graph

3467 commits

Author SHA1 Message Date
jenkins-bot e857ded358 Merge "Streamline button margin calculation for outline parts" 2022-08-04 13:05:18 +00:00
WMDE-Fisch 7f4645bbe0 Streamline button margin calculation for outline parts
Generally the default button margin on the parts is 24px. The only
exception are the placeholder and wikitext when they are the last
parts in the outline.

Bug: T312644
Change-Id: Ie513bf1c022b2696cc92aacbbca59ddf6e55043e
2022-08-03 13:09:51 +02:00
jenkins-bot e50c0af860 Merge "Show "no parameters" message only when there are no parameters" 2022-08-03 09:43:50 +00:00
Thiemo Kreuz cdf9a59278 Tweak the hard coded top scroll padding for the parameter list
In Iebfe2e2 we already tweaked this by 1px. Turns out this was not
enough in all relevant situations. I still get random scroll events
just because I move the mouse around. Setting: Firefox, 120% zoom,
multi-part transclusion.

Bug: T312926
Change-Id: I475c1ef029e9721cc663881e40547730389cd26d
2022-08-03 11:15:32 +02:00
Thiemo Kreuz 5eb1193670 Tweaks to focus/scrolling code relative to sticky header
* Rename method because it turns out it is not only about the sticky
  header, but also relevant when there is no header.
* Move some code to more appropriate places.
* Use 0 as documented in OOUI, not null.
* Set the padding back to 0 when the sticky header is not visible.
  As of now this is an unreachable state because the filters never go
  away after they have been made visible. Still this code was always
  written with this possibility in mind to make it future-proof.
* Performance optimization for the boolean "show filters?" check.

Bug: T312926
Change-Id: Iaba08ccd8bf00360fd26f9268d5be43df4f4fbd8
2022-08-02 11:41:23 +00:00
Thiemo Kreuz 0b28414dff Restore scrolling parameters into view with(out) sticky header
This is a partial revert of Ide45141. Now the scrolling always
happens (again), but properly considers the presence of the sticky
header. It was also not correctly initialized on construction time.

This is a candidate for a backport. The patch is intentionally as
small as possible because of this. Code cleanup will be done in a
later patch.

Bug: T312926
Change-Id: I06425b42566bfb2087846636055ee75e98a05029
2022-08-02 12:29:06 +02:00
Thiemo Kreuz b9376f5990 Show "no parameters" message only when there are no parameters
The message was also shown when a documented template appears as
part of a multi-part transclusion but with zero parameters being
used. You see the filters in this case and can click "show all".
The message is just wrong in this situation.

Bug: T312926
Change-Id: I8d26ceec483e05fd1f69013e506fa1eb4e4c29ed
2022-08-02 11:48:45 +02:00
Thiemo Kreuz 800461efac Scroll below sticky header only if sticky header is present
Bug: T312926
Change-Id: Ide45141f0a21b782f8674ecbed9ee512de985661
2022-08-01 15:37:33 +02:00
jenkins-bot 2f555569ea Merge "Tweak the hard coded top scroll padding for the parameter list" 2022-08-01 13:05:03 +00:00
WMDE-Fisch 8ae4d291df Tweak the hard coded top scroll padding for the parameter list
Currently the sticky size is exactly 114px. With 115px you also can
see an auto scroll effect on multi part transclusions when you hit
that 1px sweat spot at the top of the list.

Bug: T312926
Change-Id: Iebfe2e2c6360c650755cd985157949a26a5287a4
2022-08-01 14:07:31 +02:00
jenkins-bot a1bd30f35d Merge "Simplify partly redundant findFirstSelectedItem implementation" 2022-08-01 11:45:08 +00:00
Thiemo Kreuz d01d1e78c2 Simplify partly redundant findFirstSelectedItem implementation
Introduced via Ibc56abf. But the OOUI SelectWidget does have some
methods for this already.

This patch also updates some @mixins documentation.

Bug: T302965
Change-Id: Iffbb44d41586786a2165f8d7916f94a52ad19122
2022-08-01 11:07:29 +00:00
jenkins-bot ee760ee2a6 Merge "Fix forgotten "setPage" property because of merge conflict" 2022-08-01 09:37:40 +00:00
Thiemo Kreuz cdb9766752 Fix forgotten "setPage" property because of merge conflict
The rename in I5a16ab4 was done the exact same time a new usage was
introduced via Ibb717ca. Neither patch shows a conflict. Still there
is one.

I remove the extra `|| null` line because it is just not needed. We
don't need to set the property to null when it was already null.

Bug: T312213
Change-Id: Id3f025786c9412e8c1946434113c41356da08098
2022-08-01 09:42:25 +02:00
Andrew Kostka dc91a39f8b Use the same styling for add template and add parameter buttons
Bug: T314052
Change-Id: I62d4e282b0e8f0a32e37e144db358144224119f1
2022-07-28 16:24:15 +02:00
jenkins-bot 6422e69821 Merge "Minor code cleanups in forked BookletLayout and related" 2022-07-28 12:59:10 +00:00
jenkins-bot 13c2a24f6c Merge "Prefer adding parameter to currently focussed template" 2022-07-28 11:34:38 +00:00
jenkins-bot 52c155f43f Merge "Fix "null is not a string" error in event logging code" 2022-07-28 10:41:15 +00:00
Thiemo Kreuz 741dbe5ccf Minor code cleanups in forked BookletLayout and related
E.g. renaming variables and moving code around. No functional change.

Change-Id: I39e76356c62a0d1bcdf1d20bc8215f09604ad07d
2022-07-27 16:04:27 +02:00
jenkins-bot 94268009c9 Merge "Remove dead code, deleting parameters is not possible" 2022-07-27 09:41:51 +00:00
Thiemo Kreuz b085d6cf24 Prefer adding parameter to currently focussed template
Instead of the template that's currently selected. That's confusing,
e.g. when you click one of the search fields, search for a parameter,
can't fine it, and press ctrl+shift+d to add an undocumented
parameter. Or you navigate the list of parameters with the cursor
keys, can't find the parameter you are looking for, and press
ctrl+shift+d to add it.

Still falls back to the selection when the focus is outside of the
sidebar.

We suggest to merge this before UX review, and review it later in
demo time. It's easy to undo if necessary.

Bug: T313388
Change-Id: I9848dd0af4fe821526dafc18bbd7cb1ab0e68cfc
2022-07-27 09:17:23 +02:00
jenkins-bot e06cdeadb1 Merge "ve.ui.MWGalleryDialog: Fix "Alternative text" not being readonly sometimes" 2022-07-26 20:26:17 +00:00
jenkins-bot f7d9da3317 Merge "Start altText as null to avoid empty alt for new gallery images" 2022-07-26 20:00:52 +00:00
jenkins-bot 7e55a99917 Merge "Add a checkbox to use the image caption as the alt text for galleries" 2022-07-26 20:00:48 +00:00
Bartosz Dziewoński d2f7796744 ve.ui.MWGalleryDialog: Fix "Alternative text" not being readonly sometimes
Depending on the order in which this code executed, sometimes the
dialog initialization would overwrite the readonly state set by item
initialization.

They should simply all check both conditions.

Change-Id: I6a18f1e074f118423438c017b3e4e34e75579e5d
2022-07-26 21:50:19 +02:00
jenkins-bot c595901528 Merge "Tab to first template parameter in list, not to the selection" 2022-07-26 14:45:04 +00:00
jenkins-bot 20f255d0f9 Merge "Fix filtering not clearing "currently selected page" state" 2022-07-26 14:36:02 +00:00
jenkins-bot 4997f3d41d Merge "Move getters for the currently selected part to two-pane layout" 2022-07-26 12:30:41 +00:00
Thiemo Kreuz d922c12957 Remove dead code, deleting parameters is not possible
This code was for when the dialog had a trash can icon for every
parameter, and parameters could actually be deleted. It's unreachable
now.

We missed this when removing the old workflow.

Change-Id: Ic94df506ea84009a1e1863a4e9847a70498df448
2022-07-26 13:21:39 +02:00
jenkins-bot 72b3a31571 Merge "Fix Ctrl+D and Ctrl+Shift+Y hotkeys to add parts" 2022-07-26 09:23:50 +00:00
jenkins-bot 2185393d96 Merge "Fix Ctrl+Shift+D hotkey to add undocumented parameters" 2022-07-26 09:20:48 +00:00
Thiemo Kreuz 72c136182c Remove unused pieces of code from two-pane layout
The toggle feature is not used. The method is always called with a
bool.

Bug: T313489
Change-Id: Id05398ea837355f93df597674e817e3e4f0f8481
2022-07-26 10:41:45 +02:00
Arlo Breault 5bfdff2197 Start altText as null to avoid empty alt for new gallery images
Bug: T310624
Change-Id: I26ffb386fa4de5ed6128da8d08da1df2576f3755
2022-07-25 22:43:28 -04:00
jenkins-bot ce2cdc6a1e Merge "ve.ui.MWTemplateDialog: Fix dialog becoming inert" 2022-07-25 16:03:50 +00:00
jenkins-bot 801d017417 Merge "Add missing check to confirmation dialog's "closed" handler" 2022-07-25 15:27:06 +00:00
Bartosz Dziewoński 9e954b7c20 ve.ui.MWTemplateDialog: Fix dialog becoming inert
OOUI support for multiple modal window managers is hacky, and only
works correctly when the managers are attached directly to <body>.
Remove the wrapper that doesn't seem to be necessary.

Bug: T313690
Change-Id: I4134c0f50d28a364dcf15b426bd9b59a4f7a985d
2022-07-25 17:01:12 +02:00
Thiemo Kreuz cbc90ff90a Remove dysfunctional "no outline" mode from template dialog
The dialog is unusable when there is no outline. See T313489 for a
longer explanation.

Bug: T313489
Change-Id: Ib2cc9c363d3596a16f6f1c4aef03ca216abf6b1f
2022-07-25 14:45:18 +00:00
Thiemo Kreuz 59c2ee6242 Add missing check to confirmation dialog's "closed" handler
Apparently this can be undefined when Esc is pressed. Note this code
cleanup related to but does not fix T313690.

Bug: T313690
Change-Id: Ia4658f8e00a68ed4cc3a6ddb0a932b3218b813dc
2022-07-25 13:53:12 +02:00
Arlo Breault 94c4d619a7 Add a checkbox to use the image caption as the alt text for galleries
The need for something like this was anticipated in
I2bf43c7e83283f43e047229eb53c244918fcbb0c.

As of version 2.5.0 of Parsoid's output, if alternate text is missing
for an image but a caption is present and image isn't displaying the
caption (ie. it isn't a thumb or frame), then the text content of the
caption will be set as the alt attribute.  Parsoid will then drop the
alt attribute when serializing if it matches the caption text, since
it's unnecessary.

However, if the caption is modified and the alt text isn't, the alt will
be serialized.  This is likely to be unexpected to editor.  They may
have missed that the both the caption and alt are populated in VE and
only edited one place.

Since all of the above is happening only for images where the caption
isn't visible, it doesn't appear to be a much used feature since, at
least for inline images, the experience of caption editing was already
less than optimal.

However, because of a quirk in how galleries are rendered in Parsoid,
this affects gallery caption editing, which is visible and presumably
used more often.  See T268250 for a discussion on an improved gallery
structure.  But for now, gallery images are effectively inline and set
the alternate text, thus subject to the above.

Here we add a checkbox so that the default is to ignore the alt if it's
the same as the caption.  And only make use of it if it differed
originally or was explicitly unchecked to modify.

Bug: T311677
Change-Id: Idf297d8a98995971c5835b0cea56c3317a3626e2
2022-07-22 15:46:55 -04:00
Thiemo Kreuz c821ca154b Document what "current page" means in two-pane layout
Change-Id: I37b26a9f01031d4910ff773977a89eb46a4c19ac
2022-07-22 18:12:15 +02:00
Thiemo Kreuz c2c5a2b938 Fix filtering not clearing "currently selected page" state
This patch also removes an obsolete comment.

Bug: T313388
Change-Id: Ie292c07fb096f89a226d7a2239e3dd2883dd91d7
2022-07-22 17:10:48 +02:00
Thiemo Kreuz 1491315c04 Move getters for the currently selected part to two-pane layout
Turns out we have two concepts, now represented by two methods:
1. A top-level part can only be moved or removed when it is actually
   selected. This is relevant for the toolbar buttons and for the
   keyboard shortcuts/hotkeys. We intentionally block the buttons
   and hotkeys when a parameter is selected.
2. Adding a new part or parameter is always possible, no matter if a
   top-level part or parameter is selected. This is again relevant
   for the toolbar buttons and hotkeys.

Bug: T313388
Change-Id: I17caf8fce9d8f1ebe21660cf8c6d91ace8423490
2022-07-22 15:53:10 +02:00
Thiemo Kreuz 21ab6bc5f6 Fix Ctrl+D and Ctrl+Shift+Y hotkeys to add parts
Same issue as in the previous patch, but less intrusive. It was always
possible to add a new part, but it was often inserted at the wrong
position. It worked only as intended when a top-level part was
selected. When a parameter was selected, the new part was always
appended to the very end of the transclusion, not after the selected
template.

This is now a little bit of duplicate code. We might extract this to
a method in a later patch.

Bug: T313388
Change-Id: I1327222969d1d315bdacf3998f366d88c4c26bd5
2022-07-22 15:25:59 +02:00
Thiemo Kreuz c86134a9ec Fix Ctrl+Shift+D hotkey to add undocumented parameters
The hotkey was only working when a top-level part was selected, not
when a parameter in a template was selected.

Some outdated helper methods are now marked as deprecated. They will
be replaced and removed in later patches.

Bug: T313388
Change-Id: I5ffe45fd00c36b97ee36dc0ba6831db5a941c731
2022-07-22 15:22:07 +02:00
jenkins-bot fef2e4a8c6 Merge "Template dialog sidebar: Skip glitchy jQuery animation" 2022-07-22 12:51:31 +00:00
Thiemo Kreuz cf77557a95 Fix "null is not a string" error in event logging code
This getTitle() method can return null.

Bug: T299779
Change-Id: I33c6fc0cdd03ae45a04d4098cf101dc9fa3414e3
2022-07-21 13:26:45 +02:00
Thiemo Kreuz 19edc6043a Tab to first template parameter in list, not to the selection
This is a partial revert of Iaf089f4. It restores the old behavior:
* In case there is already a highlight in the parameter list, just
  keep that. Usually there is no highlight at this point, but better
  have this check in place to be sure.
* Otherwise always start at the top.

Jumping to the selection is confusing, esp. for keyboard-only users.
The argument goes like this:
* Let's say I'm in the middle of editing values on the right side of
  the dialog.
* I want to navigate to the sidebar. How do I do this with the
  keyboard? I use the tab key.
* Pressing tab also implies I move the selection to the next
  parameter. And the next. Until I reach the end of the parameter
  list. Then the selection stays there.
* When I finally reach the sidebar and tab into the parameter list,
  the last parameter is selected. But this was merely a side-effect
  of me navigating the dialog.

Such a "selection becomes highlighting" behavior was not specified
in T311204.

This patch is requested and approved by PM.

Bug: T312647
Bug: T311204
Change-Id: Ie5b5dfd4fca132050815e6182845ca23adb5f805
2022-07-21 10:44:48 +02:00
Thiemo Kreuz 2e2a8257bd Remove unused getCurrentPageName method from two-pane layout
Change-Id: Ieb5316530f646a2515e47239b9b44c9337863cf4
2022-07-20 17:50:37 +02:00
jenkins-bot ab8bc614a8 Merge "Restructure code finding closest top-level page for readability" 2022-07-20 11:33:53 +00:00
Thiemo Kreuz ac204fd3a9 Template dialog: Make blue selection color transparent
This should make zero difference in most situations. Except you
navigate a list of parameters with the keyboard. In this case the
SelectWidget gets a dark blue outline which overlaps with the light
blue selection bar, but the outline disappears behind the bar. This
looks odd. Making the color transparent fixes this without the need
to fiddle with z-index or such.

Bug: T311204
Change-Id: I7049eb60dc0ea72c2c4620f4351525fe447e0f46
2022-07-20 12:48:49 +02:00