Commit graph

48 commits

Author SHA1 Message Date
Adam Wight 14deb729a4 Rewrite handlers using canonical setPage
More idempotent approach to state change, using a common function
that has all the side-effects.

Bug: T311987
Change-Id: I13e64ff5262295a60c28572855cfe36da7c3ff41
2022-07-04 13:41:19 +02:00
Adam Wight 8448f513a4 Two-pane layout setPage has all the desired side-effects
This becomes the canonical method to call when we want to update the
template dialog to select a new item.

Bug: T311987
Change-Id: Ie7880bfde41b77f0e6367cc8e3a78edb299391ce
2022-07-04 13:31:06 +02:00
Adam Wight 0c4716aaaf Replace event wiring for stackLayout.set with explicit call
Call the handler directly.  This avoids the `set` event handling for
add and remove parameters, causing minor behavior changes:

Moves the "reselect" logic after removing pages, from StackLayout to
the two-pane layout class.

Bug: T311987
Change-Id: I46454d184d4718bed45caf9f41487364611f1f44
2022-07-04 13:26:56 +02:00
Adam Wight a104d0c888 Use local state rather than stackLayout.currentItem
Bug: T311987
Change-Id: I62ddc013ae255bcbaf3478c7f0949238245988e6
2022-07-04 10:40:35 +02:00
Adam Wight 3e2d594148 Minor doc updates
Change-Id: I87156e203c131545c463bfa2307b2d8f7c5507ca
2022-07-04 10:40:02 +02:00
Adam Wight d93e35a0d1 Reconnect "soft select" event
Bug: T311296
Bug: T311711
Change-Id: Ic4ee673d339ec0b4b5f54f3d7a878e3ab03f7113
2022-07-01 12:30:01 +02:00
Adam Wight 68e2f6279a Remove set event with no listeners
Change-Id: I4bdabf0129b65d76281f9f18b92ba202bb9840d3
2022-06-30 15:55:17 +02:00
Svantje Lilienthal b4ed246db2 Re-add refreshControls to TwoPaneDialog
809881 removed one refreshControl too many

Bug: T311296
Change-Id: I72eb03e3db948213117a94d86d79401448759342
2022-06-30 14:31:13 +02:00
jenkins-bot a9ac3052db Merge "Rely on selection changed event for updating controls" 2022-06-30 08:18:35 +00:00
jenkins-bot 7570742468 Merge "Calculate controls using sidebar selection" 2022-06-30 08:00:15 +00: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
Adam Wight 699c73893d Calculate controls using sidebar selection
In an important use case (spacebar selection of sidebar parts), the
content pane selection isn't updated.  This patch switches to read
the sidebar selection rather than the content pane selection.

Bug: T311296
Change-Id: I684a9edf04b6615cc840bbb89e8c1d03a0ab8e94
2022-06-30 08:53:15 +02:00
Thiemo Kreuz 5077780216 Remove all BookletLayout OutlineItem code
No longer need to manage the connection between outline items and
content pane pages.

Bug: T310866
Change-Id: I8dae7efa18e97ce5e1c84d963f1a32f09dd7e7cb
2022-06-30 05:29:46 +00:00
Adam Wight d6ebbf0ea3 Remove outlineSelectWidget (old sidebar)
It seems that the controls widget was the only side-effect we still
needed for maintaining existing behavior.

Bug: T310866
Change-Id: I507dacef4e56946b836b0fca31effce611260aec
2022-06-29 17:08:51 +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 3326eb7240 Drop unused chainable signatures
Change-Id: If0de666db6004f08fbd3a08a0414b66184bb95a0
2022-06-29 10:09:10 +00:00
jenkins-bot 3018a57a10 Merge "Create new refreshControls function in TwoPane" 2022-06-29 10:06:52 +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 8d47e7119c Hide access to outlineSelectWidget
Other classes no longer need this function.

Bug: T310866
Change-Id: I368bd797c31a4ec600cfbee674aebf27210a1ee9
2022-06-28 15:14:34 +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 1ce7340e55 Merge "Remove old code to focus first input" 2022-06-28 09:19:36 +00: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
Thiemo Kreuz 0a5b47eee3 Unhoist variables & remove dead code from BookletLayout fork
Declaring variables only when they are needed makes the code more
readable.

Bug: T310859
Change-Id: I454cc622dc5e83ec2c148d0bf59c62124dbd85e8
2022-06-28 08:52:24 +02:00
Adam Wight 28bdc0a9fb Remove old code to focus first input
This still works for a dialog with just the template placeholder,
because the page is already chosen as "current" in the stackLayout.

Bug: T310866
Change-Id: Ibc1d33b02d34f70548d9f7365e085847ef0b2a51
2022-06-28 08:27:04 +02:00
jenkins-bot b44132753b Merge "Remove unused resetScroll function" 2022-06-27 15:11:20 +00:00
jenkins-bot d34c95e4ff Merge "Fork OutlineControlsWidget" 2022-06-27 15:02:14 +00:00
Adam Wight bbe0356f43 Remove unused resetScroll function
Also removes some logic that could only be reached when
`this.scrolling` is true.

Bug: T310866
Change-Id: Id60cfd9d72fd0e38872f58386ea0f0b64a268214
2022-06-27 14:50:00 +00:00
Adam Wight 6de61ccf77 Fork OutlineControlsWidget
Bug: T311223
Change-Id: Id2f9fc89c607c8001e8b150add1ffbcaa318993a
2022-06-27 16:46:11 +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
jenkins-bot 36e534719c Merge "Remove unused events from forked BookletLayout" 2022-06-27 08:58:39 +00:00
Andrew Kostka 54f4b47794 Add initial tests for ve.ui.MWTwoPaneTransclusionDialogLayout
Bug: T311116
Change-Id: Ie4e1f9f203055f68add6fea0cf04b03215a32942
2022-06-26 17:15:11 +02:00
Thiemo Kreuz 8788077754 Move template dialog sidebar clearing to more appropriate place
This place is much better in so far that it much more obviously gives
us the guarantee that the sidebar and the content pane are always in
sync.

Bug: T311069
Change-Id: I01a7914fcba5d573abb957d0e34fa895874bd94e
2022-06-24 15:24:58 +02:00
jenkins-bot 958082378b Merge "Merge set handler into two-pane class" 2022-06-24 13:11:21 +00:00
Adam Wight 32a14d888b Merge set handler into two-pane class
Bug: T311069
Change-Id: I4cb7e63349904588bb27541d176378aa874d0a63
2022-06-24 12:32:16 +00:00
Thiemo Kreuz 5201c03d04 Reduce barely used "autoFocus" code in template dialog
According to my test one of the two places where this property was
used is impossible to reach with the property set to false. This is
the one I remove in this patch.

This also removes a related method that is entirely unused.

Bug: T310867
Change-Id: I9579a5d894d60560cec77dad7f1e796f8dfca06f
2022-06-24 14:01:57 +02:00
jenkins-bot 8fb649e979 Merge "Drop unused "continuous" configuration" 2022-06-23 12:29:57 +00:00
jenkins-bot 65170a656a Merge "Push ownership of the sidebar down into the two-pane layout" 2022-06-23 12:20:12 +00:00
Adam Wight 9f04a2516e Drop unused "continuous" configuration
Bug: T310867
Change-Id: I6773f657d2ad08bb9cdfb1fe2d480fee1d175412
2022-06-23 12:12:05 +00:00
Adam Wight 90179c48ed Push ownership of the sidebar down into the two-pane layout
Leaves a reference in the TemplateDialog so that we can slowly
migrate the many usages.

Makes no other changes to how the sidebar is managed (yet!).

Bug: T311069
Change-Id: I45403cd32e3adbe357ebad7bbc851f60d92751e5
2022-06-23 11:22:08 +00:00
Thiemo Kreuz 8eb5cd3815 Remove unused events from forked BookletLayout
The only event in use is "set". The others are never used. Which makes
sense. The driver for everything related to adding or removing parts
is the model. This widget is at the receiving end.

Bug: T310867
Change-Id: I4ef7e59ff05cb02aca59b76fdffa4f1fced76e33
2022-06-23 12:55:28 +02:00
Adam Wight b39bb342ec Never attach outlineSelectWidget to the DOM
Bug: T310867
Bug: T310866
Change-Id: I8e3a12693bbe9f91a171484a03316c9d4c94a2be
2022-06-23 10:50:51 +00:00
Adam Wight 9f2c8f0928 Copy BookletLayout implementation from ooui-js 0.44.0
Bring over the ES and Less implementation from ooui-js and rename to
fit it into the VE hierarchy, but don't make any other substantial
changes.

Inlines the wikimediaui-themed styles, ignoring apex styles, and
hardcodes the Less constants.

Bug: T310865
Change-Id: Id43dafdf11c5df0d7d78112e5f62a8599bdbc879
2022-06-21 11:06:44 +02:00