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
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
These are internal to the two-pane layout and sidebar, so the dialog
doesn't need to be involved.
Bug: T310866
Change-Id: I5f05bc119dc213d8e31db62a3808a2fadaf35d99
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
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
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
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
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
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
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
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
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
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
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
Covers the base functionality to hide the parameters. Performance
optimizations could be done in a follow up.
Bug: T300640
Change-Id: Ia99b5da392273f1445e475a0720a656460612dcf
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
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
This is a more radical change, compared to the previous patch.
I will post more detailled explanations as comments on Gerrit.
Change-Id: I6909b3f0b2c153b7ee9995441e995ffa793eab40
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