Commit graph

242 commits

Author SHA1 Message Date
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
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
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 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
Adam Wight 3e2d594148 Minor doc updates
Change-Id: I87156e203c131545c463bfa2307b2d8f7c5507ca
2022-07-04 10:40:02 +02: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
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
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 8c94e2b5aa Merge "Move template dialog sidebar clearing to more appropriate place" 2022-06-28 07:13:27 +00: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
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 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
jenkins-bot a536a66799 Merge "Never attach outlineSelectWidget to the DOM" 2022-06-23 11:24:21 +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
jenkins-bot b14f3a5965 Merge "Remove duplicate "add parameters" method from template dialog" 2022-06-23 11:17:12 +00: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
Thiemo Kreuz 8854d03552 Inline template parameter id to page name connection
It's never used in a different way. A lot of other code depends
heavily on this fact. Let's hard-code it.

Bug: T310859
Change-Id: I65bbaea47341d74b49ce447c896eb2340f730e17
2022-06-23 12:24:08 +02:00
Thiemo Kreuz 14ba08d406 Remove duplicate "add parameters" method from template dialog
The method in the model (where it belongs) was added via Iaf28035 in
2016. The other via I073c585 in 2014.

Bug: T310859
Change-Id: Idea322aec175600e3055a859ca987afc1fe6dd8c
2022-06-23 12:11:12 +02:00
Adam Wight 004adeef80 Switch to forked BookletLayout
Bug: T310865
Change-Id: If6fcac589fcafffd46beba0b7ea6a6bfb6c0061c
2022-06-23 10:33:12 +02:00
Adam Wight 8788e3174d Revert workaround for oojs when removing selected item
This hasn't been necessary since ooui-js Id9cf086771, it was to prevent the
BookletLayout from scrolling to the top when removing the currently
selected item.

Reverts I0c1fddfa32b76621a9f1328c8173f0158386aee8

Change-Id: I5752fb273d0e2a3f0e7b6a044e69d68dc3e4b657
2022-06-22 11:57:21 +00:00
Thiemo Kreuz a04d56b6a6 Remove some "pocSidebar" related pieces from template dialog
This is a direct follow up for what was done in I83bbb48.

Bug: T310868
Change-Id: Icd9ed2e8f93b269d0d2d8b0fcfae4febab5e45de
2022-06-21 15:50:23 +00:00
WMDE-Fisch ac2e91d1f9 Remove dead code in MWTemplateDialog
Bug: T310859
Change-Id: I04dc450ceb3751e68dc2179a865f45b19a350b43
2022-06-21 16:31:04 +02:00
Svantje Lilienthal a5831da808 Rename template dialog pocSidebar
Bug: T310868
Change-Id: I83bbb480163532ff56ba6a3a36322d107c737cac
2022-06-20 16:12:50 +02:00
WMDE-Fisch 5dd32ea95d Bold parameters that contain some value
Value changes are triggerd and tracked from the parameter page and
change events will be forwared to the outline, if they are relevant.

Initial value is read from the model.

Bug: T308730
Change-Id: I0a3b0faf40aee44889404dcce31d850714360580
2022-06-20 10:27:59 +02:00
Thiemo Kreuz 6458c346d8 Limit template dialog back button to 1 of 3 entry points
There are 3 ways to enter the dialog:
* Editing an existing template.
* Start empty.
* Start with a known template name.

The back button should only ever appear in one of the three modes.

The last mode is the one that's used in the Cite dialog.

Bug: T310602
Change-Id: Id23d3ac5e1715387c78916adeb8ca5f675005a5c
2022-06-20 07:46:03 +00:00
Thiemo Kreuz 218ac78960 Remove obsolete "search for a parameter" page and widgets
… as well as messages, CSS, and icons that are now unused.

Bug: T310859
Change-Id: I1a2797728788cf1a86299414c1430ded0b362d4e
2022-06-17 10:23:00 +02:00
WMDE-Fisch b35ea59de5 Hide unused paramters by default on multipart
Covers the base functionality to hide the parameters. Performance
optimizations could be done in a follow up.

Bug: T300640
Change-Id: Ia99b5da392273f1445e475a0720a656460612dcf
2022-02-08 15:56:40 +01:00
Adam Wight 28e706b3dd Reuse touched-content logic
Without changing behavior, consolidate the logic for detecting
whether the editor has made changes to the template.  This is
responsible for enabling and disabling the "Apply changes" button.

Change-Id: Ic4755b13f30fb738a7cb1eebaddef0435ea61d34
2022-01-11 17:39:22 +00:00
jenkins-bot 6dc75d8283 Merge "Remove obsolete performance bottleneck from TransclusionModel" 2021-12-17 13:24:19 +00:00
Thiemo Kreuz 845cd69bf5 Don't scroll to template parameters while the dialog loads
Bug: T296743
Change-Id: Icd501ae89695a202e8c264d1b5e9811e812a56d1
2021-12-09 14:57:20 +01:00
Thiemo Kreuz fd669a4d16 Remove obsolete performance bottleneck from TransclusionModel
This sorting algorithm was introduced via Ic6bc348 (T274544). Note
there is no index parameter in the .onReplacePart() handler at this
point. When a part was moved, it was removed and simply appended
to the end. The additional sorting was needed to move it back to the
correct position.

This changed a few days later via Iafe29f1. There is now an index
parameter. The .onReplacePart() handler does the same as before, but
puts the part at the correct position right away. The additional
sorting is pointless since then.

The removed code alone is responsible for 1/3 of the total blocking
time when the template dialog opens.

Bug: T296335
Change-Id: I6c3fa70b532d34cd29d59c3b48ab81ebf608d548
2021-12-06 17:36:53 +00:00
WMDE-Fisch 1467800331 Remove temporary hacks that got fixed upstream
Fixes are part of OOUI v0.42.1

Change-Id: Ic133d6cc503538fb8b4319bed037bc6e8596bd1c
2021-12-02 13:27:40 +01:00
Thiemo Kreuz 29ef00fa29 Rework all code using template type related conditions
This is a more radical change, compared to the previous patch.
I will post more detailled explanations as comments on Gerrit.

Change-Id: I6909b3f0b2c153b7ee9995441e995ffa793eab40
2021-10-22 10:42:16 +00:00
Adam Wight 5a451e0dd8 Workaround to prevent removing the selected item
Removing the selected item causes StackLayout to select (and scroll
to) its first item.  To prevent this, we preemptively unselect.

Note that even when an unselected item is removed, StackLayout still
clears the selection, so this patch doesn't lose any useful
behaviors.

Fix should be pushed down into OOUI, unless there's a use case where
we want to select the first item?

Bug: T293635
Change-Id: I0c1fddfa32b76621a9f1328c8173f0158386aee8
2021-10-20 00:07:18 +02:00