Commit graph

1286 commits

Author SHA1 Message Date
jenkins-bot 4997f3d41d Merge "Move getters for the currently selected part to two-pane layout" 2022-07-26 12:30:41 +00: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
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
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
jenkins-bot e8ece4da06 Merge "Drop unused "editable" configuration from template dialog" 2022-06-28 07:28:12 +00:00
jenkins-bot 8c94e2b5aa Merge "Move template dialog sidebar clearing to more appropriate place" 2022-06-28 07:13:27 +00:00
Thiemo Kreuz b0ce363e2b Drop unused "editable" configuration from template dialog
This defaults to false. It looks like this default is used in the
MWTemplateDialog base class. However, it also looks like this base
class is never used on it's own. All users we know use the subclass
MWTransclusionDialog where "editable" is true.

https://codesearch.wmcloud.org/search/?q=%2C%5Cs*ve%5C.ui%5C.MWT(emplate%7Cransclusion)Dialog&files=%5C.js%24

In the process I also remove some comments that literally repeat the
code and don't add any knowledge because of this.

Bug: T310867
Change-Id: Ie245aab80d1e77a8406f5591062e9cf49fd9613f
2022-06-28 09:11:31 +02:00
jenkins-bot 5d2d36f9d7 Merge "Remove dead code (not) selecting first template parameter" 2022-06-28 07:03:22 +00:00
jenkins-bot 6641f7da85 Merge "Move .addPromptedParameters() calls to more canonical places" 2022-06-28 06:59:49 +00:00
Thiemo Kreuz fd0b32fe31 Remove dead code (not) selecting first template parameter
This code was meant to select the first parameter of a template the
moment it is added. It's at least partly broken because it doesn't
consider the so called "prompted" parameters that have been added
just a few lines above. It's a questionable feature anyway. We are
going to refine all focus-related behavior anyway. Let's remove this
broken stuff and reimplement it later (probably in a different place)
when we continue working on this.

The FIXME was added in I720ce1a.

Bug: T311223
Change-Id: I1801efe38387b5e7a1b76417c1e5d7db4e4b96d0
2022-06-28 08:42:59 +02:00
Thiemo Kreuz 76f563c929 Move .addPromptedParameters() calls to more canonical places
This was done in 3 rather "random" places:
1. Whenever a template is manually added. But rather late, after the
   template was added, in an event handler that is about focus
   behavior. It should not continue to manipulate the template that
   was just added.
2. When the dialog opens with a template preloaded by name, as it is
   done from the citation menu.
3. When the dialog is about to finish loading.

This patch fixes 2 issues:
* Get rid of a duplicate call (number 2 and 3) when using the
  citation menu.
* Move number 1 to a place where it's executed much earlier, and
  only when the user clicks "add template" in a template placeholder.
  There is no other way to add a template to an existing transclusion,
  but it's still a more appropriate place I feel.

Bug: T311069
Change-Id: I8a65ad703b95ba2092e9ef73493e9903e96b0dd6
2022-06-28 08:40:24 +02:00
Adam Wight b1a12aeaab Simplify focusing a parameter
We can use setPage, thereby removing a dependency on the
OutlineSelectWidget.

Bug: T310866
Change-Id: If097c9218fe56e63d9c003b10789c94513c20c93
2022-06-27 13:36:46 +02:00
Adam Wight 33d9f9958b Remove findClosestPage logic
This causes one small behavior change: when deleting one of several
wikitext transclusions or a part following a template without
parameters, the selection would previously be set to the *previous*
part, and now it's the *next* part.  This is arguably more consistent
with the behavior when removing eg. templates with parameters, after
which the next part is selected.

Doesn't affect removing parameters.

TODO: We might want to restore the already-broken behavior to focus
the first parameter of a newly-inserted template.

Bug: T310866
Change-Id: Ic5f47e31512d1a3949caf60613bd05b9a3bdf478
2022-06-27 13:36:44 +02:00