Commit graph

225 commits

Author SHA1 Message Date
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
Ed Sanders 295d139ef1 Minor documentation fixes
Change-Id: I6822c04c8d160431510e62752783e6829950dc36
2021-10-13 14:02:57 +01:00
Thiemo Kreuz be789e6387 Fix first click on parameter page causing bad scroll
The idea of this piece of code is to make sure both sides of the
dialog show the same element. But it doesn't make sense to force the
*header* of a template into view when I clicked on a *parameter*.

Bug: T292718
Change-Id: I9945f8e54c856152f05bf717e43468ab5ab24d2f
2021-10-07 15:04:20 +02:00
Thiemo Kreuz 1904698105 Move some logic into the TransclusionModel class
I moved some code around and found that quite a lot of code wants to
know:
* Is the length of this transclusion exactly 1?
* I need that 1st part.

There is more that can potentially moved from the dialog to the model.
But I don't want to make this patch to big.

Bug: T292371
Change-Id: Ia94ed0450d04dd97c4c41f5bf7c266f9a534e821
2021-10-06 16:00:18 +00:00
WMDE-Fisch 6c7f303c86 Focus initial/single template placeholder
This includes some moving of code. These helper functions seem to make
more sense in the TemplateDialog class.

Bug: T292371
Change-Id: I004405bab60a569b084f9083fefa41f44f9a5561
2021-10-05 12:58:55 +02:00
Thiemo Kreuz 1731f3cc14 Better name for .selectPartByPageName() method
This method does not only select a "part", i.e. a top-level item like
a template. It also selects sub-items like template parameters. The
new name reflects this better.

Change-Id: I51a8ddbd05b283248afba5a623cc52da7b2434f5
2021-10-01 07:00:40 +00:00
Thiemo Kreuz 7bd90b7506 Hack out forced scroll to first BookletLayout element
As a temporary standin for the mentioned OOUI patch.

Change-Id: I85d1fe542e10d83acdc0208d7cadc7a665eda0b2
2021-09-29 13:19:40 +02:00
Thiemo Kreuz 152f5edae2 Add/remove some TODO comments
Change-Id: I99bf367025ba4830fb683add93087d42dce4566d
2021-09-28 09:55:47 +02:00
Thiemo Kreuz 19bb1810c4 Rename misleading updateOutlineControlButtons event and handler
The .onUpdateOutlineControlButtons() method doesn't describe what it
actually does. This issue was introduced in I9c5478a. (Intentionally,
to not make the patch to complicated.) Let's continue to rename
things to be a) unique and b) honest about what they do.

This is an alternative to I8d98e61.

Bug: T289043
Change-Id: I4d52ffa6e9e5df2025a0c33031c1517bcb421279
2021-09-26 11:50:38 +02:00
Thiemo Kreuz 63d9969861 Rename outline "container" widget
I can't really tell what insight we get from the word "container".
Every widget is a "container" in some sense, isn't it?

This widget is just _the_ outline, I would argue.

Other suggestions?

Change-Id: I1fb27ee58c1a3dd790022504e978198dadf7ea02
2021-09-24 12:32:29 +02:00
jenkins-bot 654cf8c3a8 Merge "Document the 3 ways the template dialog can be opened" 2021-09-24 09:45:56 +00:00
Adam Wight b94f7e02f5 Don't automatically focus the first parameter of each template
This is bad for multi-template transclusions, where we focus the
first parameter of each template ending with the last.  It's also
inconsistent, we don't do the same for wikitext chunks.

Change-Id: I720ce1a380a6f4a8618c3608b63557df5fb50393
2021-09-24 08:42:05 +00:00
Adam Wight 41bb9e95e6 Don't automatically focus first element
This was damaging the UX by causing the first parameter to be marked
as selected, but without reliably focusing it.  For example, loading
a wikitext-template-wikitext multi-part transclusion would cause the
initial focus be given to the documentation link in the template
content header.  After this patch, the focus will be at the top of
the page and tab will run down window functions and then through the
sidebar.

Change-Id: I84131870ae3887dcae74d91d68c5984d1dbffd85
2021-09-23 14:50:42 +00:00
Thiemo Kreuz 91d24bf2ec Document the 3 ways the template dialog can be opened
Change-Id: I9729eb238f4a4f0712a561b77e3d97f4e9063938
2021-09-23 16:38:33 +02:00
Thiemo Kreuz d6aece09cd Disable unwanted auto-scroll feature in template dialog
The weird auto-scroll feature is described in T289043#7297679.

This also fixes T291381 different than I393a2b1. Only one of the
patches should be merged.

Bug: T289043
Bug: T291381
Change-Id: I70d87f12fd68001e880510fb6c38d7c419d64b15
2021-09-22 13:30:37 +02:00
Thiemo Kreuz e037f99930 Merge custom "focusin" with "set" event handler
This code was introduced in I8fafee6. I can't tell any more what
the "bug" mentioned in the commit message was. Let's get rid of the
duplicate code path, see if we run into regressions and deal with
them one by one. That's much easier to handle than keeping this
confusing code path around.

Note this "focusin" event handler was actually re-implementing
parts of the upstream BookletLayout, namely
OO.ui.BookletLayout.onStackLayoutFocus().

Bug: T289043
Bug: T291381
Change-Id: Ib386ae6efec08465122f0e8ee81cd6dc9a2d337a
2021-09-21 10:14:57 +00:00
Thiemo Kreuz 9e6def01d3 Scroll template dialog element into view when pressing space
Note there is still an issue with the upstream
OO.ui.BookletLayout.selectFirstSelectablePage() method stealing
the focus in some situations when you press space. Still this patch
already improves the situation. Pressing space on both top-level
template elements as well as parameters should scroll the thing into
view, but keep the focus in the sidebar. This was just not happening
at all.

Make sure to use a very long multi-part template to test this.

Bug: T289043
Change-Id: I9c5478a04b14b94ccd5d00480d48a7d59b4e0c37
2021-09-20 09:08:44 +00:00
jenkins-bot 866052c7b2 Merge "Fix Cite dialog failing with new sidebar" 2021-09-20 08:23:32 +00:00