Commit graph

1295 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 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
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 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 eaca5e8ad0 Merge "Simplify interface to remove pages" 2022-07-18 09:55:18 +00:00
Adam Wight 2759752a0a Simplify interface to remove pages
Makes some things easier, some harder—not sure if this is a helpful
patch.

Change-Id: If56e9b2fbc1796cd637aaeececec779d31a7921f
2022-07-18 05:31:42 +00:00
jenkins-bot 6f16d02c0c Merge "Wikitext mode: Use action=parse for preview" 2022-07-16 16:54:30 +00:00
Ed Sanders 2644c84cda Increase default debounce of live extension inspector/dialog to 1000ms
250ms gaps are pretty common when typing at a normal speed, resulting
in a lot of (often expensive) API requests (e.g. T312319). For most
use cases this level of responsiveness in the preview is not necessary.

Change-Id: I6504567d4da02a66171ee35a9c4fd35c85136909
2022-07-14 17:14:37 +01:00
Ed Sanders 3148e28f69 Wikitext mode: Use action=parse for preview
Using Parsoid HTML in the 2017WTE has enabled us to iron
out lots of rendering bugs over the past few years.

In that time Parsoid has been moved into PHP, and at some point
we also become the default parser.

Also more extensions have started to use content transform hooks,
which are only supported by the action API.

As a result it now seems like a good time to migrate back to the
content API instead of building the preview from Parsoid HTML.

Bug: T154844
Change-Id: I90d775dd71d5f5a61d651b63d946ab60a27e2ca3
2022-07-12 17:12:06 +01:00
jenkins-bot 55165649c7 Merge "Document some classes touched in the sidebar rewrite" 2022-07-12 13:53:29 +00:00
Adam Wight d77728bd4f Document some classes touched in the sidebar rewrite
Depends-On: I385dca1d95033961d3844e888521750443e49c95
Change-Id: Ic515b41863bcf2ac4daa0272f67e1d30238a4b85
2022-07-12 12:49:31 +02:00
WMDE-Fisch a0c0465d67 Don't access the stacklayout directly
Bug: T310867
Change-Id: I95cbdee26ead46c2d8803ddb3a9e06304f793407
2022-07-09 05:56:27 +00:00
jenkins-bot fd86b7f38d Merge "Autofocus template input field on dialog open" 2022-07-07 13:18:53 +00:00
Andrew Kostka 3f8387af17 Autofocus template input field on dialog open
Bug: T312205
Change-Id: Id3843b2c7ad6b3eb4a11e0c6d288dd69804973f8
2022-07-07 14:26:17 +02:00
WMDE-Fisch be05a524d1 Remove dead code when adding parameters
Both parts are not relevant anymore:
- The first part is about focusing parameter placeholder pages.
  These are added after load only when using the keyboard shortcut.
  Focus will be done separately in that case.
- The second part is dead code since some time now. Also it is not
  needed here. Scrolling to newly added parameters is done via the
  setPage() method in the layout.

Bug: T289043
Change-Id: I928afef01b9e62a9da91db10340d9df78717e125
2022-07-06 15:54:29 +00:00
Adam Wight b20b5dbe9d Focus the input after switching to the content pane
... except on mobile because the keyboard will expand.

Need to disable a spurious focus when the element isn't visible,
because this was making it impossible to focus later once it becomes
visible.

Bug: T290975
Change-Id: I0e6057d1cfbef24324a287e50e4988f935720c61
2022-07-06 14:47:50 +02:00
Adam Wight d9e56ef69a Remove unused autofocus code
Two-pane layout setPage no longer does any focusing, so this variable
is not respected anyway.

Change-Id: I1ddb06e11b68be300013a92b2dd05b90583ddc2a
2022-07-06 14:12:35 +02:00
WMDE-Fisch ed4fa49520 Fix broken scroll on sidebar toggle
This was using the currentPage from the StackLayout. It will not
be updated there anymore.

Also removing the line about focus after toggle. We do not want
that anymore afaik.

Bug: T312015
Bug: T289043
Change-Id: I8b6eedd580d49604014118171c6da62849752d53
2022-07-04 16:00:39 +02:00
Adam Wight 3e2d594148 Minor doc updates
Change-Id: I87156e203c131545c463bfa2307b2d8f7c5507ca
2022-07-04 10:40:02 +02:00
jenkins-bot e2ecb537e9 Merge "Gallery image: Use thumbUrl if src is not set (new images)" 2022-07-01 22:33:54 +00:00
Ed Sanders ce9619618b Gallery image: Use thumbUrl if src is not set (new images)
Bug: T310623
Change-Id: I5ded2dcf1864e0cb4a3df64b3b8bc873f7a35fe7
2022-07-01 13:14:03 +01:00
Adam Wight 1653815e8c Rename event to be descriptive, not prescriptive
Events should be named based on what happened, not what the
side-effect will be.

Change-Id: I563db48181e1db79ca22ef2ba1e25d5186976110
2022-07-01 12:42:23 +02:00
Adam Wight 7d023e2dce Rely on selection changed event for updating controls
This event makes other calls redundant because it's always sent from
setPage and onReplacePart.

Bug: T311296
Change-Id: If214a713ed7299320d499c3e5687eda013fe0aab
2022-06-30 08:55:38 +02:00
Thiemo Kreuz 767a928a23 Move remove button toggle code to more appropriate place
This patch does a few closely related things:
* Replace a direct dialog → sidebar access with dialog → layout →
  sidebar.
* Move the misplaced removeButton.toggle() to a more appropriate
  place.

Bug: T311069
Change-Id: I5a2802aab587a6f7de4681bce4e9961a064ef8ee
2022-06-29 16:31:25 +02:00
Adam Wight 2ff0f6d5f2 Move custom buttons into outline controls
Bug: T311296
Change-Id: I5cc45f6a05ca029e319e04e76f6e35bfd5b506a6
2022-06-29 10:08:35 +00:00
Svantje Lilienthal ead1e258d5 Create new refreshControls function in TwoPane
Bug: T311296
Change-Id: I5a06238a7cf58189616f1b812bec74e99ef7922f
2022-06-29 11:44:07 +02:00
Adam Wight d138cd04bf Fixes for focusPart
We missed some usages.  Follows up on I5f05bc119dc213d8

Change-Id: Iaecb804300c37d43108a14e8db0068deb58f503c
2022-06-28 15:31:54 +02:00
jenkins-bot c29690b1f1 Merge "Move template dialog sidebar container into forked BookletLayout" 2022-06-28 12:56:24 +00:00
Adam Wight 978cefa13b Move template dialog sidebar container into forked BookletLayout
Bug: T310867
Change-Id: I7d2a882b99e4796ecc6594b1cfb638eecd985de2
2022-06-28 12:02:01 +02:00
Adam Wight 2dd9405e38 Move last remaining sidebar event handler into forked class
These are internal to the two-pane layout and sidebar, so the dialog
doesn't need to be involved.

Bug: T310866
Change-Id: I5f05bc119dc213d8e31db62a3808a2fadaf35d99
2022-06-28 11:35:22 +02:00
Thiemo Kreuz 31d75a1738 Move sidebar-related event handlers down into BookletLayout fork
Bug: T311069
Change-Id: I95fd2637ef4c39f8547e676dcfb5de333d5278e9
2022-06-28 11:27:02 +02:00
jenkins-bot 51cd862fce Merge "Adding canGoBack to the properties" 2022-06-28 08:55:53 +00:00
WMDE-Fisch bc1e3efa4b Adding canGoBack to the properties
As disussed in Id23d3ac5e1715387c78916adeb8ca5f675005a5c

Change-Id: I1368199a4b709d5634ca6e20f04323a0227065be
2022-06-28 10:35:44 +02:00
Adam Wight d5f2767605 Remove unused parameter to focus
The one usage of this wasn't working.  FIXME: maybe we want to
restore the behavior, to focus the first parameter in the dialog
after opening.

Bug: T310866
Change-Id: Ibe0151fbedb3a9716bb231b5d398c4ae670fd667
2022-06-28 09:54:39 +02:00