Commit graph

13319 commits

Author SHA1 Message Date
Adam Wight b3e5478221 Show the "other actions" toolbar when unknown buttons are available
For example, the Citoid extension adds a "change reference type"
button which should be visible when editing a citation template.

TODO: Decide whether we want to hide the "hide options" button in
this case.  This should be handled in a separate patch and possibly
in a follow-up phase, it requires deeper changes to the logic.

Bug: T294351
Change-Id: I1c6c322fe48044d7e726bf20ba7cd2eda422cd8b
2021-10-27 13:10:23 +02:00
Thiemo Kreuz 96adda0d13 Add safe-guard for early template dialog resize events
I can't reproduce this error, but I feel better having this safe
guard in place. In theory it's possible to trigger resize events
before the TransclusionModel is initialized.

Change-Id: I4bbac0f73873813629ff854ee728465c6e2a4ba7
2021-10-27 12:50:20 +02:00
Thiemo Kreuz 597bacd63b Fix rebase mistake in TransclusionDialog class
I6909b3f0b2c153b7ee9995441e995ffa793eab40 was rebased, but
I0226ca7d39e04a69617c0d8a5d3c293cfc9e0709 was merged in the meantime.

Bug: T293202
Change-Id: I3cfec9ebc135eaf998a0982f458cfe75bfb2f01c
2021-10-26 10:34:26 +02:00
jenkins-bot 3e74dd7b9a Merge "Use <span> for the outline part headers" 2021-10-25 12:06:27 +00:00
WMDE-Fisch 37e7f930c4 Use <span> for the outline part headers
We're mainly interested in the layout of a button here. From a
semantic perspective this is just a header to an editable area
and not a button.

Bug: T291284
Change-Id: I683cca2e7d6549e652bd03ae1e46f4eff8c07d0a
2021-10-25 12:11:10 +02:00
jenkins-bot a932e5b6b3 Merge "Fix/cleanup template dialog methods dealing with parts vs. items" 2021-10-25 10:02:04 +00:00
jenkins-bot c9222cf111 Merge "Fix strange dialog title when using subst:" 2021-10-25 09:12:13 +00:00
jenkins-bot 6484f8dad3 Merge "Rework all code using template type related conditions" 2021-10-25 08:55:32 +00:00
jenkins-bot db07d0c290 Merge "Move var declarations inline" 2021-10-22 19:40:49 +00:00
jenkins-bot dbbf62e1b7 Merge "Make text fields and related information accessible to screen readers" 2021-10-22 12:40:37 +00:00
jenkins-bot 4de710ca71 Merge "Add a11y label to sidebar parameter selection" 2021-10-22 11:51:44 +00:00
Svantje Lilienthal b2852f5cb5 Make text fields and related information accessible to screen readers
Bug: T291273
Change-Id: I0746bf42eee321a4c239dd56b2008610a0d21488
2021-10-22 13:49:41 +02:00
jenkins-bot 6653b2cab7 Merge "Use cheaper jQuery constructor for minor template param label" 2021-10-22 11:38:13 +00:00
jenkins-bot 9a0d34aeae Merge "Add title to sidebar search" 2021-10-22 11:34:04 +00:00
jenkins-bot 8a295512d3 Merge "Don't try to focus a removed template parameter" 2021-10-22 11:09:46 +00: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
WMDE-Fisch 6e7332193b Add title to sidebar search
Also to improve screen reader a11y.

Bug: T291284
Change-Id: Ib56d3ee542cb880edd7788ff524a72436e102627
2021-10-22 12:34:57 +02:00
WMDE-Fisch 79f1270593 Add a11y label to sidebar parameter selection
Bug: T291284
Change-Id: I581800d2c92c06c3585ac48be0242860f476022b
2021-10-22 12:31:24 +02:00
jenkins-bot 66bcfc856b Merge "Set aria-multiselect on OutlineParameterSelectWidget" 2021-10-22 08:53:14 +00:00
Thiemo Kreuz 0a13fd9459 Use cheaper jQuery constructor for minor template param label
This is done for a lot of the elements in this class. They are trivial
jQuery elements instead of OOUI widgets. While we usually want to use
OOUI widgets, this is different in this case. Think of a template with
1000 parameters.

Bug: T291284
Change-Id: Ie1960ee706dca17aa4963c23a2e89c1cfff106f9
2021-10-21 15:55:13 +02:00
WMDE-Fisch b84d5f99d6 Set aria-multiselect on OutlineParameterSelectWidget
Bug: T291284
Change-Id: Iedb731d528b7f73c188aaa40eba74ba18dc8781e
2021-10-21 15:54:01 +02:00
Thiemo Kreuz 937352a138 Don't try to focus a removed template parameter
The event "focusTemplateParameterById" targets the right side of the
dialog. The input field for the parameter should be focussed. This
doesn't make any sense when the parameter was just removed (i.e.
unselected).

Change-Id: Ie75b1edaebe9d0444b98e66cb56a5c7774393bea
2021-10-21 08:46:37 +00:00
Isabelle Hurbain-Palatin 3a3437007a Handle annotation tags as nodes rather than metaitems.
Preserve the place of annotation meta tags; adds information for the
users about annotation and, if necessary, annotation range extension.
The messages and individual handling of annotations for the annotation
range can be defined by the extensions: see I0b58a418 for an example
of how that can look like.

The structure of this patch closely follows the one from I104e7abbd
(handling of <noinclude> et al.).

Bug: T261181
Change-Id: I39029e4a63d22b37107edec066006557bcff34bf
2021-10-21 10:39:04 +02:00
jenkins-bot fed17e94b6 Merge "Give skins/extensions ability to trigger VisualEditor" 2021-10-20 23:45:14 +00:00
jdlrobson d5b3d2bcbe Give skins/extensions ability to trigger VisualEditor
It should be possible for extensions/skins to trigger the click event

It should be possible to do $('#ca-edit').trigger('click') so that
Vector's sticky header can trigger the VisualEditor.

Bug: T293159
Change-Id: I58625ffca982edfbc4cdcb14a666d79093e1b89d
2021-10-20 16:20:02 -07:00
jenkins-bot 1d6d0b6264 Merge "Change template dialog hotkeys" 2021-10-20 18:35:30 +00:00
WMDE-Fisch 2f9fe11231 Change template dialog hotkeys
Changed to be less conflicting see investigation in ticket.

Bug: T290262
Change-Id: If2b75cb1dd8bb26c685f8e51beebfa0e6ab6599c
2021-10-20 10:53:44 +02: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 abcd8428fa Fix rendering of render-less templates in preview snippets
The signature of createInvisibleIcon was changed but this
was never updated.

This fixes invisible template renderings inside previews, e.g.
inside the reference context item for:
<ref>{{InvisibleTemplate}} Content</ref>

Change-Id: I3d1b7a177408032957ac3fa8ead813438aa6bda7
2021-10-19 15:32:00 +01:00
Bartosz Dziewoński 9f9f27eb08 Fix unintentional raw HTML message
Change-Id: Ib5d37d4bdc8a36f7b077995d35cea70fb84e4476
2021-10-18 22:37:25 +02:00
jenkins-bot dfa08be3f5 Merge "Don't close the old sidebar when the add parameter button is pressed" 2021-10-18 14:02:21 +00:00
jenkins-bot 99f7acddf7 Merge "Auto hide the sidebar when only a single placeholder is present in narrow mode" 2021-10-15 08:13:41 +00:00
jenkins-bot 2873d4b328 Merge "Fix broken focus when using the add parameter button in the old sidebar" 2021-10-15 08:08:06 +00:00
jenkins-bot 9521442b04 Merge "Add mobile 'content' class to visual diff" 2021-10-14 19:18:07 +00:00
jenkins-bot c5e6c9f9e1 Merge "Minor documentation fixes" 2021-10-14 19:07:09 +00:00
jenkins-bot 9d199fb287 Merge "Replace IIFE with block scope in ES6 code" 2021-10-14 17:55:55 +00:00
Ed Sanders 789519012e Add mobile 'content' class to visual diff
Bug: T293392
Change-Id: I7d0d6fee5a50fc2d965ebf0ad20c49dd26c70901
2021-10-14 17:26:03 +01:00
Ed Sanders e1fb20d8be Replace IIFE with block scope in ES6 code
Change-Id: I635f72a62ae44943a7705d28e92c9a0d265800b6
2021-10-14 15:11:45 +01:00
Andrew Kostka bf846d2313 Don't close the old sidebar when the add parameter button is pressed
Change-Id: I635d741a028196d9ad3b68cb26e5eac58b199fe5
2021-10-14 13:59:46 +02:00
Andrew Kostka 18964cdf2c Fix broken focus when using the add parameter button in the old sidebar
Bug: T293203
Change-Id: I9b9658ea05afe9c0d76e0956e8037842f540f74d
2021-10-14 13:43:35 +02:00
Svantje Lilienthal 9b9c6ff492 Remove focus from first input field when clicking on template name in sidebar
Bug: T293250
Change-Id: I017bd9fa5e566762b78e354f9ff94902b2c8968a
2021-10-14 10:25:34 +00:00
Andrew Kostka 0350b742c8 Auto hide the sidebar when only a single placeholder is present in narrow mode
Bug: T293202
Change-Id: I0226ca7d39e04a69617c0d8a5d3c293cfc9e0709
2021-10-14 11:37:23 +02:00
Ed Sanders 295d139ef1 Minor documentation fixes
Change-Id: I6822c04c8d160431510e62752783e6829950dc36
2021-10-13 14:02:57 +01:00
Ed Sanders 3801aa1bac Move var declarations inline
Change-Id: I12639c515e33b3d9e7a819581b5022ea42fd7046
2021-10-13 14:02:31 +01:00
jenkins-bot ebeeed35bb Merge "Remove duplicate load error handling code" 2021-10-12 16:07:07 +00:00
jenkins-bot 48f6436034 Merge "ve.dm.MWExtensionNode: Clarify documentation of 'extensionName'" 2021-10-12 13:52:20 +00:00
Bartosz Dziewoński e603613a7c ve.dm.MWExtensionNode: Clarify documentation of 'extensionName'
Bug: T291900
Change-Id: I70db47747aef7693ade6b8b7ea68e6212f78fe29
2021-10-12 00:16:42 +02:00
Bartosz Dziewoński 33bbd5bcf2 Remove duplicate load error handling code
Load errors are already handled in the MobileFrontend part of the
mobile visual editor, by this code:

66c55573e5/src/mobile.init/editor.js (L375-L387)

    // Wait for the data to load before we show the editor overlay
    overlay.getLoadingPromise().then( function () {
    	...
    }, function ( error, apiResponse ) {
    	// Could not load the editor.
(1) 	overlayManager.router.back();
    	if ( error.show ) {
    		// Probably a blockMessageDrawer returned because the user is blocked.
    		document.body.appendChild( error.$el[ 0 ] );
    		error.show();
    	} else if ( apiResponse ) {
(2) 		mw.notify( editorOptions.api.getErrorMessage( apiResponse ) );
    	} else {
    		mw.notify( mw.msg( 'mobile-frontend-editor-error-loading' ) );
    	}
    } );

Compared to our code:

    ve.init.mw.MobileArticleTarget.prototype.loadFail = function ( code, errorDetails ) {
    	...
(1) 	this.overlay.onExitClick( $.Event() );
(2) 	mw.notify( this.extractErrorMessages( errorDetails ) );
    };

The lines marked with (1) and (2) do basically the same thing. And
the function parameters "error, apiResponse" and "code, errorDetails"
are actually the same objects, just with confusingly different names.

This causes the popup with error message to appears twice (although it
isn't too obvious, since the two popups appear in the same place, so
only one is visible), and also causes bogus data to be sent in event
logging (T237063).

Bug: T237063
Change-Id: I7fe7a944707fe585251ce9e16bbb78ccd123a7ed
2021-10-11 23:20:43 +02:00
Andrew Kostka 0fa54f2f9e Check whether to show the sidebar after adding the parts
Bug: T292852
Change-Id: I18309164ae4838d9a7aa9fc842012806fbd0c845
2021-10-11 10:50:05 +02:00
Thiemo Kreuz 74e3dd3f4b Fix strange dialog title when using subst:
When I type e.g. "subst:example" as the template name, we made this
work as the user would expect: the template named "Example" is found
and it's TemplateData documentation used. But the dialog title shows
"Subst:example". Note the uppercase "S". It means this string is
parsed as a title, including the "subst:". This is confusing. Just
show the template name.

Change-Id: I9817786991a8379cf48b0a664aef1413abddee2d
2021-10-08 16:00:29 +02:00
Thiemo Kreuz dc85603c0e Remove redundant variable from TransclusionOutlineWidget
Change-Id: I27a890069748d9e689c96fa7c515568fb38e9973
2021-10-08 13:38:44 +02:00
jenkins-bot 871dd4486c Merge "Fix sidebar bottom position when pressing Ctrl+Shift+E" 2021-10-08 11:19:51 +00:00
jenkins-bot 990d5372e9 Merge "Fix first click on parameter page causing bad scroll" 2021-10-08 10:50:15 +00:00
Thiemo Kreuz f77ef7d7f4 Fix/cleanup template dialog methods dealing with parts vs. items
Some cleanup to improve readability and reduce the amount of code.
Relevant bits:
* One method name was wrong. It can actually return parameter ids,
  not only top-level part ids.
* I got rid of some fail-safe checks that are never needed or moved
  them to a more central place.

Change-Id: I08f2ad7bc7d3f985d6189dff170dda554f3d37c2
2021-10-08 07:43:23 +00:00
Thiemo Kreuz 25ee94ee07 Don't reset narrow screen mode when it's already active
Bug: T292693
Change-Id: I39f4655115c6162a0bc7984702bebe28f12563fe
2021-10-08 06:44:12 +00:00
Thiemo Kreuz 893a3d5cf0 Fix sidebar bottom position when pressing Ctrl+Shift+E
This patch fixes two issues:
* The bottom corner of the new sidebar was never correct because of
  a `padding: 2px` that was introduced later, but never compensated
  for.
* The moment the toolbar is shown it's not a single-template dialog
  any more. This implies minor style changes.

Bug: T290262
Bug: T292727
Change-Id: I08da73880c469085994ee4beb3fcdd973f80ae11
2021-10-07 18:46:47 +00:00
jenkins-bot 8e025e4af0 Merge "Skip flaky test for now" 2021-10-07 17:57:14 +00:00
jenkins-bot 02e3aff969 Merge "Refactor how namespaces with subpages are exposed to JavaScript" 2021-10-07 17:57:11 +00: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
Adam Wight 1142ca3ce0 Skip flaky test for now
Bug: T292318
Change-Id: I03437d33f26c48208b84a578ff185bff6f9034a7
2021-10-07 15:00:14 +02:00
jenkins-bot 8dd098905c Merge "Use .localeCompare() when sorting undocumented parameters" 2021-10-07 10:31:19 +00:00
Andrew Kostka 7e9d50ff05 Use .localeCompare() when sorting undocumented parameters
Bug: T292643
Change-Id: I5d89d64bcce656fa0881f69b5d0d0fef65871c0c
2021-10-07 11:57:18 +02:00
Adam Wight 2f4ce7df69 Rewrite style so it can be flipped by cssjanus
"to right" is the same as "90deg", but can be matched and flipped in
rtl interfaces.

Bug: T292690
Change-Id: I985d4b0206112e07c2f5a481145b8abc88cb50ea
2021-10-07 10:11:44 +02:00
jenkins-bot 0ba300554f Merge "Move some logic into the TransclusionModel class" 2021-10-07 07:51:54 +00:00
jenkins-bot 74a49255cf Merge "Harden …TemplateTitleInputWidget to avoid JS console spam" 2021-10-06 23:31:02 +00:00
Thiemo Kreuz 866547d081 Harden …TemplateTitleInputWidget to avoid JS console spam
I run into this in some local test. There are two reasons this code
can be reached:
* When a wiki doesn't have the TemplateData extension, the
  additional API call from line #154 will fail. But the original
  search query succeeded. We have the `originalResponse` and can
  return it. This makes the code behave as if the additional
  TemplateData API call was never done.
* But what if the original search query failed? We still end in
  line #183 – as we should. But this time it can't return anything
  but undefined. This will be considered a valid, successful API
  response. But it isn't.

There might be a better way to clean up this chain of promises.
This is the smallest fix I found.

Change-Id: I02d3d053156da222ee424382007621f314777015
2021-10-06 20:14:55 +00:00
DannyS712 2984539f42 Refactor how namespaces with subpages are exposed to JavaScript
Instead of using an object mapping namespace ids to if they have
subpages enabled or not, pass an array of the namespaces where
subpages are enabled, reducing the size of the configuration that
gets loaded on all requests. Only requires a minor update to the
JavaScript that uses the value (check for array index instead of
object value).

Bug: T291729
Change-Id: Ia0ecac71721eceed52cc90f39ecc560bdf1b7f9b
2021-10-06 20:11:37 +00: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
jenkins-bot 9213741db4 Merge "Pages outside of Template: namespace can have TemplateData" 2021-10-06 10:30:10 +00:00
jenkins-bot b9fc01dc8e Merge "Fix hiding of 'add image' button in gallery dialog" 2021-10-05 19:57:37 +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
jenkins-bot 352075c815 Merge "Add more keyboard shortcuts for VE template dialog" 2021-10-05 10:05:08 +00:00
Ed Sanders fe6e097d1d Fix hiding of 'add image' button in gallery dialog
Change-Id: I755abc3b28b32350f33d96e2938cb7d7d3caa5e5
2021-10-04 13:53:25 +01:00
Thiemo Kreuz dba40bab22 Reduce duplicate/dead code when checking for single templates
I hope this code is a little cleaner. This patch doesn't change how
the dialog behaves.

Bug: T292210
Change-Id: I237812b3404437948eb76d8b36dcca2a4c688d6d
2021-10-01 15:47:09 +02:00
WMDE-Fisch 15e825c603 Add more keyboard shortcuts for VE template dialog
Bug: T290262
Change-Id: I9a3c29e9925b903c6d6f2424a4912ae1c9ecfe2c
2021-10-01 14:56:10 +02:00
Adam Wight f64522304b Keyboard shortcut to add a new template
Bug: T290262
Change-Id: Ie548d3813374466638a1b196fa4014519d7228fe
2021-10-01 12:40:15 +00:00
jenkins-bot 50faec38c3 Merge "Don't get stuck on a narrow mode sidebar" 2021-10-01 11:07:31 +00:00
WMDE-Fisch 2a4e4ea202 Don't get stuck on a narrow mode sidebar
Bug: T292210
Change-Id: I0d7d69e775d65cdabe7377851a695c8dc7ac7e67
2021-10-01 10:23:57 +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
jenkins-bot 3f23cc79ee Merge "Add missing @fires documentation tags" 2021-09-30 16:35:02 +00:00
Thiemo Kreuz caab2a191c Pages outside of Template: namespace can have TemplateData
The TemplateData extension is not limited to the Template: namespace.
And even if pages outside of the Template: namespace typically don't
have TemplateData information, the API is still able to automatically
extract parameter information from every page.

Or:

It's rare that a page outside of the Template: namespace is used as
a template. But if it is, this is not a mistake. The code here in
VisualEditor should not try to be "more clever" than the user is. If
this is what the user want's to do, let's not block them.

Bug: T291883
Change-Id: Iaf3fd5530b74fab7cedfc85ce04c8c40632df11f
2021-09-30 18:06:32 +02:00
Thiemo Kreuz a625669380 Add missing @fires documentation tags
Change-Id: I0c9b2aa827a6806004480b642c23f320b190b6ab
2021-09-30 15:50:33 +00:00
jenkins-bot 13e0cccb36 Merge "Fix more/less button placement for different feature flag combinations" 2021-09-30 15:02:13 +00:00
jenkins-bot 0eb7934500 Merge "Better method name for the parameter name validation update" 2021-09-30 14:56:03 +00:00
jenkins-bot ac0ff80b23 Merge "Hack out forced scroll to first BookletLayout element" 2021-09-30 14:55:59 +00:00
jenkins-bot abd115c054 Merge "First QUnit test for dialog classes" 2021-09-29 11:57:30 +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
Andrew Kostka 2e377f4497 Fix more/less button placement for different feature flag combinations
Bug: T291907
Change-Id: Ibca51ab2b1faae37890e69a977f9dc4e700acc27
2021-09-29 11:19:40 +02:00
Adam Wight d70941593d First QUnit test for dialog classes
Wrote a first test, that checks the parameter checkboxes showing up.

Bug: T291155
Change-Id: Ie79272442a0d0532607fe93e9ea538635812e671
2021-09-29 10:00:34 +02:00
jenkins-bot 8b539794a7 Merge "Cover suggestedvalues feature in MWParameterPage class" 2021-09-28 16:29:08 +00:00
jenkins-bot 7f5eb2952f Merge "Remove obsolete …OutlineWikitextWidget test" 2021-09-28 16:01:45 +00:00
jenkins-bot 84937964bf Merge "Add/remove some TODO comments" 2021-09-28 14:21:17 +00:00
jenkins-bot 84e6019701 Merge "Make function overridable by subclasses" 2021-09-28 14:10:00 +00:00
Thiemo Kreuz 66d5f13dfb Remove obsolete …OutlineWikitextWidget test
The feature set is (almost) fully covered by other tests, notably
the tests for the …OutlinePartWidget base class and the other two
subclasses.

The only bit that's not covered any more is the
"visualeditor-dialog-transclusion-wikitext" message. But that's
super minor and not worth a separate QUnit test.

Bug: T291157
Change-Id: I574f9cff0baf3dff885094769c124a9e05a1d1c8
2021-09-28 08:37:47 +00:00
Thiemo Kreuz 152f5edae2 Add/remove some TODO comments
Change-Id: I99bf367025ba4830fb683add93087d42dce4566d
2021-09-28 09:55:47 +02:00
DannyS712 e6a39d70ac Stop adding $wgSVGMaxSize to JavaScript config variables
The code that uses it is commented out

Bug: T291729
Follow-up: I7af2bc91524e832555b66f090a671672cd14f294
Change-Id: I4cceb9ca83a2274fa93783af3608b9486b773522
2021-09-27 18:45:08 +00:00
Thiemo Kreuz 61df64d7ae Better method name for the parameter name validation update
It's not only used as an event handler, but called as an ordinary
method as well. Let the name reflect this better.

Change-Id: Ie5a0d9c4cd072063a164886f18d0859327b3f267
2021-09-27 18:24:20 +02:00
Thiemo Kreuz 33b4d0dfc6 Cover suggestedvalues feature in MWParameterPage class
… as well as improve the coverage of MWAddParameterPage a bit.

Bug: T291156
Change-Id: Ibacb602298e5200b00a23092e5b9b211c43d6719
2021-09-27 18:22:10 +02:00
jenkins-bot 33e4f6da0b Merge "Add @private tags to template dialog related methods" 2021-09-27 11:10:37 +00:00
jenkins-bot 149cdc935a Merge "Move .containsValuableData() method from dialog to model" 2021-09-27 09:46:08 +00:00
jenkins-bot c5ee1889b1 Merge "Rename misleading updateOutlineControlButtons event and handler" 2021-09-27 09:19:09 +00:00
Thiemo Kreuz ffb7d76263 Move .containsValuableData() method from dialog to model
… where it belongs.

Change-Id: I522b888e366f066b28983a18041a8728d11623df
2021-09-27 11:16:54 +02:00
jenkins-bot bb31dd62e5 Merge "Implement basic Ctrl+Shift+Up/Down/Del support in new sidebar" 2021-09-27 09:08:44 +00:00
Thiemo Kreuz 58f5882957 Implement basic Ctrl+Shift+Up/Down/Del support in new sidebar
Note this patch is somewhat incomplete. The feature fully works and
I would like to see this patch merged as it is. But whenever you
press one of the keys the focus is stolen by some element on the
right side of the dialog. This makes it impossible to e.g. press
Ctrl+Shift+Down multiple times. The idea is to work on this in the
next patch.

Bug: T290262
Change-Id: Ic67f2a696c94f1e5c71134d681161221aecbfdf6
2021-09-27 08:29:12 +00:00
Adam Wight 02c637ad16 Sync panels in narrow-view mode
Reasserts scroll and highlighting when toggling the sidebar, in the
case that the other panel is hidden (narrow-view mode).

FIXME: Doesn't reassert focus because the page.focus() and
bookletLayout.focus() methods don't seem to work, maybe the bug is
especially prominent when the item to focus was already marked
active.

FIXME: Stopped working for right-to-left sync on wikitext elements.
This is a less common use case and can be addressed in follow-up.

Bug: T290975
Change-Id: I94f5709e810c63ee5fd7729a192ac7b92686b88f
2021-09-27 10:12:36 +02:00
Thiemo Kreuz f68c1e3794 Add @private tags to template dialog related methods
… obviously only to methods that are meant to be private, i.e.
only called from within the class (and possibly tests).

Change-Id: I581558078dc7210abac5f5724f71316ac45745e6
2021-09-26 11:51:36 +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
jenkins-bot 37c5e5978e Merge "Move data model tests to correct directory" 2021-09-24 11:52:36 +00:00
jenkins-bot 72681d45d2 Merge "Rename outline "container" widget" 2021-09-24 11:14:30 +00:00
jenkins-bot 12e6d4dd2d Merge "Unhighlight all items when highlighting" 2021-09-24 10:47:13 +00: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 bd7a1b0997 Unhighlight all items when highlighting
This prevents multiple highlighting, which was possible to achieve by clicking
sequentially in the input fields of two parameters from different templates.

Change-Id: I404936f1569ab544b693a9bc6921381636ea8f40
2021-09-24 09:26: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
jenkins-bot 8a66d01760 Merge "Prevent scrolling sidebar to heading of subitem" 2021-09-24 08:10:39 +00:00
jenkins-bot 694d07ddaa Merge "Don't automatically focus first element" 2021-09-24 08:10:36 +00:00
Adam Wight 64c7859c9f Prevent scrolling sidebar to heading of subitem
Scroll was landing in the wrong place.  Subitem should be kept
on-screen after click.

Change-Id: I3c1901b7b53ac523bcc0d33172b674b97421c06d
2021-09-24 07:53:01 +00:00
jenkins-bot 8f3215b30a Merge "Give the categories box a highlight on hover" 2021-09-23 20:50:34 +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
David Lynch 760ae6643f Give the categories box a highlight on hover
Most block-level things that can be interacted with by clicking have a
highlight. Categories don't, and that makes it harder to discover that
you can edit them.

Change-Id: I6be3824c34b36bd09bbae8cab9a9f36b6bcdb767
2021-09-22 21:17:40 -05:00
Thiemo Kreuz 8125644ac2 Move data model tests to correct directory
Bug: T291062
Change-Id: I7425f047d07eceeae29b54106f7f7806fc929aa2
2021-09-22 14:09: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
jenkins-bot 78c1f282c7 Merge "Always update mode on replace part" 2021-09-22 10:14:31 +00:00
jenkins-bot 228bf34ff7 Merge "Make up/down/remove buttons behave sane on …AddParameterPage" 2021-09-22 09:44:24 +00:00
jenkins-bot 0656541d7b Merge "Fix existing templates without TemplateData not showing a link" 2021-09-22 09:41:31 +00:00
WMDE-Fisch 129551d869 Always update mode on replace part
AddPart in the resetDialog also triggers replace part
so this call could be removed there.

Bug: T291365
Change-Id: Id6c0f5bf3aaece45da37ffab75a4d99c113944f6
2021-09-22 11:30:52 +02:00
jenkins-bot 34156b8cef Merge "Consolidate messages about missing/bad templates" 2021-09-22 09:15:53 +00:00
Thiemo Kreuz 4ad151c13e Fix existing templates without TemplateData not showing a link
Bug: T290140
Change-Id: Ic6d5decbf3838868e8add1b860828a784dc8af3a
2021-09-22 08:58:27 +00:00
Thiemo Kreuz 224cc9ab12 Consolidate messages about missing/bad templates
This is mostly re-arranging existing code. Actual changes made:
* Remove the message that claims a template can't exist. We can't
  really know this.
* Instead show the message about "modifiers" in cases where curly
  braces and other wikitext syntax is involved.

Bug: T290140
Change-Id: I713d7f54cad2510f9a02c113600980cba8c3e58b
2021-09-22 10:12:16 +02:00
jenkins-bot acacece321 Merge "Document optional parameter" 2021-09-22 07:40:58 +00:00
jenkins-bot 5bcde3beff Merge "Merge custom "focusin" with "set" event handler" 2021-09-22 07:21:44 +00:00
jenkins-bot 461fd05b48 Merge "Toggle the watchlist-expiry dropdown's disabled state" 2021-09-21 16:50:17 +00:00
Adam Wight 7d9a61ded7 Document optional parameter
This function can also be used to unhighlight.

Change-Id: Ic95d75dfa862951613d7c3bc21a19ec967cf9805
2021-09-21 16:36:49 +02:00
WMDE-Fisch 34cbc3f3b5 Use getTemplateDataQueryTitle to distinguish template title cases
The titles in the link cache do not include subst: anymore so to see
if these pages exist we need to use the same link title used in the
query.

Bug: T290140
Change-Id: I18de81e0bf46212c2199a948f7ca89182aa19eff
2021-09-21 12:47:02 +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
jenkins-bot e88c445920 Merge "Add tests for MWTemplateSpecModel.getTitle()" 2021-09-20 14:41:30 +00:00
jenkins-bot 22b4c635aa Merge "Scroll template dialog element into view when pressing space" 2021-09-20 14:35:35 +00:00
Thiemo Kreuz 696d066829 Add tests for MWTemplateSpecModel.getTitle()
I was (again) wondering why the try-catch is there. But it's actually
needed. Now covered by a test.

Bug: T290140
Bug: T291062
Change-Id: Iccc7274ed9e7b81b8491dbca7d3d771706b0ed09
2021-09-20 16:04:22 +02:00
jenkins-bot 58c28c13fd Merge "Improve messaging for when a template is not found" 2021-09-20 13:14:58 +00:00
Bartosz Dziewoński 86583d52e0 Toggle the watchlist-expiry dropdown's disabled state
Using the same logic as mediawiki.action.edit/watchlistExpiry.js
in MediaWiki core.

Bug: T251348
Change-Id: Ic9c67d24b5282d13de2bd496a4cb681dc9b092ac
2021-09-20 10:23:52 +00:00
Adam Wight 23e4fe240b Make function overridable by subclasses
We will hook into this from MWCitationDialog.

Bug: T291241
Change-Id: I56f006023569c65d9cd55f30856adf2f81cfbd92
2021-09-20 11:43:18 +02: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 3adef5c23c Merge "Drop substitution prefixes before querying for TemplateData" 2021-09-20 08:36:49 +00:00
jenkins-bot 866052c7b2 Merge "Fix Cite dialog failing with new sidebar" 2021-09-20 08:23:32 +00:00
Andrew Kostka 65e3ce0787 Drop substitution prefixes before querying for TemplateData
Bug: T290140
Change-Id: I57924df9b6d4d6e24c54b85f044072e216478e68
2021-09-20 10:17:39 +02:00
jenkins-bot 4f34e9b049 Merge "Regression: Update selection in new sidebar relative to content" 2021-09-17 16:53:29 +00:00
Thiemo Kreuz 48b9a58737 Regression: Update selection in new sidebar relative to content
We broke something with the change I166b971. When we renamed that
method it started to override (and therefor disable) the method
with the same name from the base class.

I decided to move all code in the subclass for the moment. It might
be misplaced there (note how almost all code related to the new
sidebar is in the base class). But this is cleanup work for later.

Bug: T289043
Bug: T291151
Change-Id: Id255585e78967eee0f72c27727cd23211674923c
2021-09-17 16:45:24 +02:00
Thiemo Kreuz d91e356780 Fix Cite dialog failing with new sidebar
The most basic fix. The "outlined" flag is set to false for the
cite dialog, in contrast to the transclusion dialog. It's always
true for the transclusion dialog. Note it doesn't mean the sidebar
is visible, but specifies if a sidebar is created in the first
place.

Bug: T291241
Change-Id: I5a8b538949e9fd0b8e85a6a91ca2420ef72e4612
2021-09-17 16:15:20 +02:00
Thiemo Kreuz 9f783d962a Regression: Fix selection of first transclusion element
We removed this line of code in a recent patch, but it turns out
it's still necessary in at least one situation:
* Make sure you have a multi-part template where the first part is
  a wikitext snippet.
* Edit the template.
* Click the very first item in the sidebar.

Nothing happens. But the text cursor should be in the wikitext
field.

Another situation:
* Put the text cursor in the first wikitext field.
* Press shift + tab. Now a button in the bottom toolbar should have
  the focus.
* Click the 1st element in the sidebar. Again, nothing happens.

The extra .focus() call is redundant in many situations. But it also
doesn't hurt to repeat it. It will just re-focus the element that's
already focused.

Bug: T289043
Change-Id: Iccbe376b98a1b1e5469cd17e1c95d5d8869442d3
2021-09-17 14:46:06 +02:00