Commit graph

3447 commits

Author SHA1 Message Date
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
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 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
jenkins-bot b6a4f0b4fa Merge "Use generic "outline item selected" event for top-level parts" 2022-07-20 10:07:22 +00:00
jenkins-bot 28a671a48e Merge "Rename specific "parameter selected" event to be more generic" 2022-07-20 10:05:46 +00:00
jenkins-bot 18dade9ffa Merge "Rename confusing "itemSet" to "active parameter"" 2022-07-20 10:05:01 +00:00
jenkins-bot 4a3d83d087 Merge "Rename confusing "isSet" to "active page indicator"" 2022-07-20 10:04:58 +00:00
jenkins-bot 0d1f035dba Merge "Remove duplicate selection code from template dialog sidebar" 2022-07-20 10:02:07 +00:00
jenkins-bot 975058c4c8 Merge "Template dialog: Fix oval help button" 2022-07-20 09:42:44 +00:00
Thiemo Kreuz 7a59c4696a Rename confusing "itemSet" to "active parameter"
The main motivation is to get rid of the vague method name
"setParameter" that was previously used for three different methods
in three different classes. Now the three methods have three
different names.

Change-Id: I938de30b368daf6ce3385b2ed2bca98f316593e1
2022-07-20 11:42:42 +02:00
Thiemo Kreuz 4782987a7f Rename confusing "isSet" to "active page indicator"
We would love to name this state "selected", but that term is already
used for a template parameter that is checked/used. The idea of "set"
was to have a list of parameters where one is "set". But the word is
confusing. I suggest "active page" because the entire purpose of the
blue selection is to highlight the currently active page (i.e. the
one you currently interact with on the right side of the dialog) in
the sidebar.

Change-Id: I5a16ab4c193ea05c21bb3bf89ada2ef550d8d6bc
2022-07-20 09:38:41 +00:00
Thiemo Kreuz 66029402ee Restructure code finding closest top-level page for readability
I hope this makes it a little more readable. The two steps done in
the loop are mostly independent:
a) Find pages that should be removed.
b) Find next best top-level page when the current one is removed.

Change-Id: I600253fb206a31ef5851865e733b66c336d5014d
2022-07-20 09:25:09 +00:00
Thiemo Kreuz aaa47fdab3 Fix "current page" not being reset when page is removed
This does not have much of an effect, but can cause visual glitches
in rare situations. One goes like this: Use the keyboard and tab key
to navigate to a list of parameters in the template dialog. Press
space to enable the checkbox. The parameter gets a blue background
(= it's now the active a.k.a. "set" item). Press space again. Blue
disappears, as it should. Press space again. Blue is now missing.

Bug: T312213
Change-Id: I3071ec4d0a05e3505ec5216acc5a97b8eaf6f5d5
2022-07-20 09:22:39 +00:00
Thiemo Kreuz 74bffc5d0d Fix sidebar losing focus when unchecking params with space
1. Before, removePages() was calling setPage() with null. This makes
sense for removed top-level parts because these are really removed
from both sides of the dialog. Template parameters are never removed.
Only unchecked (and removed from the right side of the dialog, but
this is not what this code is about). When I navigate a parameter
list and uncheck a parameter I need the focus and highlighting to
stay.

2. We have a dedicated method when a parameter is unchecked. This
can check if the removed parameter is also the selected one (called
"set" in this code) and can reset this state. Without losing the
highlighting or anything else.

Bug: T312213
Change-Id: Ibb717ca49cae805617ebee196937c79daa72f1c1
2022-07-20 09:19:59 +00:00
Thiemo Kreuz e2cce0dd3d Minor fixes and optimizations to ParameterSelectWidget
Optimization: Don't search for a checkbox that represents a not yet
named parameter placeholder. There is never one.

Fix: Store null, not undefined.

Bug: T312213
Change-Id: I395008f15d13133ad456d0a77571b7aa1c7a7fc9
2022-07-19 16:36:30 +02:00
Thiemo Kreuz 7156cd693e Remove duplicate selection code from template dialog sidebar
Steps to reproduce:
* Set a breakpoint or debug.log() at the start of
  TransclusionOutlineWidget.setSelectionByPageName()
* Edit a multi-part template.
* Use the keyboard to navigate to a template name in the sidebar.
* Press space.

This is currently triggered twice. Let's get rid of the more obscure
one. It was introduced as part of Ic4ee673. I don't really know why.

Bug: T313207
Change-Id: I3ddc072f5d42c17249abc82026e0bf1a4be1dc6e
2022-07-19 13:06:44 +02:00
Thiemo Kreuz 60b69c575e Use generic "outline item selected" event for top-level parts
This also means we have to move the declaration/documentation of the
event up one level into the generic "part" widget.

Change-Id: I1b803201f8955b58136ee7f37c04c01edcd47395
2022-07-19 11:05:32 +00:00
Thiemo Kreuz ee7a398ffc Rename specific "parameter selected" event to be more generic
The code that receives this event does not need to know that the
source is a "parameter". It's just some "item" in the sidebar. The
idea is to reuse the event for both top-level parts as well as
parameters. This will be done in the next patch.

Change-Id: I858040f5adf8e156b6013caaa527b3237b7bac0f
2022-07-19 11:05:18 +00:00
Thiemo Kreuz 10691ec44a Template dialog: Fix oval help button
In my tests this issue was only visible with the Minerva skin.

Bug: T310762
Change-Id: Idf1a5d11fb9ea5d874574f8176c1bd4a66e63892
2022-07-19 13:01:43 +02:00
Ed Sanders 33546466eb Add 'vector-body' hack to TargetWidgets
Bug: T313221
Change-Id: I06366d4601342435b70d311742ee985e01b0477b
2022-07-18 14:12:10 +01:00
Thiemo Kreuz 2bdd2b4fb9 Template dialog sidebar: Skip glitchy jQuery animation
What I found is a single `$container.animate( animations )` that's
responsible for the misbehavior described in T312768.

This method is called from a few places. I think none of these places
benefits from making this an animation. This is often more distracting
than helpful, especially when navigating with the keyboard.

Bug: T312768
Change-Id: I90a80d6ae8c1b47ee22297d2520255cad890b90e
2022-07-18 14:05:54 +02:00
jenkins-bot 684a69c17e Merge "Unhighlight parameter on blur" 2022-07-18 11:47:08 +00:00
jenkins-bot 458264a505 Merge "Merge redundant sidebar selection events in two-pane layout" 2022-07-18 11:38:27 +00:00