Commit graph

1335 commits

Author SHA1 Message Date
thiemowmde aa6a5c3bf2 Start using design tokens in .less files relevant for VE
Note this actually changes the "subtle" color to be darker. As far
as I understand this is an intentional decision. The old color token
from OOUI is deprecated and intentionally made darker in Codex.
See Ie667c35 and most notably T313502.

Change-Id: I37ad25aa6821d61fe3321e1390d1ccf987075250
2024-07-19 17:45:17 +02:00
thiemowmde 7f33002411 Fix reference search not working with uppercase groups/names
The internal search index is optimized and expects everything to be
lowercase. This was already done for the text, but not for the name
and group. As far as I can see in the Git history this problem always
existed ever since this code was written.

This fixes an 11 (!) year old bug.

Bug: T53838
Change-Id: I12b3b7c23d34d49b630e9151525409dbddfac24e
2024-07-19 09:59:35 +00:00
Translation updater bot 9b8478bb59
Localisation updates from https://translatewiki.net.
Change-Id: I443bd05a6453c2d330080c736b3404a7e2bcd92d
2024-07-19 09:39:41 +02:00
WMDE-Fisch eb6624a6f9 Remove static leftovers that moved to MWReferenceEditPanel
When Citoid uses these from the new class they can be removed here.

Bug: T369005
Depends-On: I46fa9fe72b4d095291a01c208cac6c98df2ec088
Change-Id: I1aef5d6a05308191d7d8608902a38c801039af7e
2024-07-18 20:34:29 +02:00
WMDE-Fisch 36d9270c1c Introduce MWReferenceEditPanel to extract editing UI
First step to move the UI parts that are relevant for creating,
editing (and extending) a reference to it's own class.

There remains some duplication because of the sub-referencing in
Citoid currently depending on the static properties to build its
own editing interface.

More patches follow, I just wanted to keep it small for reviewers.

Bug: T369005
Change-Id: I8588cde1a54cd505a57a36ed97fc591653c9fb6f
2024-07-18 14:46:23 +02:00
thiemowmde a62e855697 Disallow recursively extending already extended references
Note that the duplicated search panel is most probably a temporary
solution anyway. We probably want a single search panel that can do
both kinds of "reuse with/without different details".

This is also inconsequential for production. Nothing related to
extended references is currently visible on production.

Added to the otherwise unrelated T369005 for code review purposes.

Bug: T369005
Change-Id: Iedee38dacc01ae59fb1a681e49e655ca91b25b64
2024-07-18 08:59:50 +00:00
Translation updater bot f2146c043f
Localisation updates from https://translatewiki.net.
Change-Id: I6acdd975ff86c3accd32db596c69682a11452d75
2024-07-17 09:33:23 +02:00
WMDE-Fisch e7443560f0 Introduce a clearSearch method for the ReferencesSearchWidget
Mainly to support the activity tracking use case where we want to
track an active use everytime the user starts anew in this UI.

Bug: T368533
Change-Id: Iecf7e697bbbd637c4a00a44debf615c2351eb390
2024-07-16 16:21:35 +02:00
WMDE-Fisch dc67570f96 Use the term reuse for code related to that use case
I found that the code is in some cases not clear with the
terminlogy. Let's start by making it at least more clear what's
related to the "reuse" use case.

Change-Id: I5325489be3b14276b0163d8cb8b84215b55d041e
2024-07-16 13:41:55 +00:00
jenkins-bot d4573aab0d Merge "Wire subref counting into the numbering renderer" 2024-07-15 12:06:21 +00:00
jenkins-bot 6315e0da7b Merge "Use existing extends warning i18n" 2024-07-15 07:39:26 +00:00
Adam Wight 5b2cbc48bd Wire subref counting into the numbering renderer
Significant change is that footnote marker numbers are changed from
being a CSS-rendered marker to using the rendered "fallback" text.
This could be avoided using the same trick as is implemented for the
reflist: send an inline style variable with the marker content; but
let's only do this if really necessary for user experience.

Template-produced refs are still wrong, but this patch continues to
render them as they come from Parsoid, in the content script.

TODO in later patches:
* reuse of a subref is rendered as '3.2.1' in reader view but '3.0'
and '3.1' in the editor.
* subref numbering is backwards in RTL languages

Bug: T247921
Change-Id: Ieff73769f8ebbc3724f6a9b498487c4e7d09aa2e
2024-07-15 07:08:06 +00:00
WMDE-Fisch 9266cce141 Ignore placeholders when getting refs from document
Citoid uses placeholder refs to preview where a new/re-used ref
would be added. This also influences the counting and preview in
the reference list for the moment the placeholder is visible.

I can image this that this might become a feature in the future
but for the moment it's a distraction IMO.

Bug: T247921
Change-Id: I5c5e84ae4b183f99530fda0736a58139e9e25d1a
2024-07-12 18:14:36 +02:00
Adam Wight a0af51b476 Fix: safely handle refs which have no "firstNode"
This can apparently happen when pasting refs from another document.

Bug: T247921
Change-Id: Ibe8c4d1625d2b6c9a11d9b4fea85c305f84265fa
2024-07-12 12:41:01 +02:00
WMDE-Fisch c0d98cdd4f Use existing extends warning i18n
Also introducing a line break to make the difference a bit more
clear what's part of the message.

We still probably want parsed content and not only text here.

Bug: T247922
Change-Id: If545ab2fe1d807a6bcbcdfc0c3b7de83817554e6
2024-07-11 13:16:14 +02:00
Translation updater bot 81bb451395
Localisation updates from https://translatewiki.net.
Change-Id: I0ae952009d28914848da86ee6b290a41b8cb2686
2024-07-08 09:32:30 +02:00
jenkins-bot 5dc88f01db Merge "Promote orphaned subrefs to the top level" 2024-07-05 11:25:58 +00:00
jenkins-bot 1f4175593b Merge "Display extends warning message when editing a reference" 2024-07-05 10:55:58 +00:00
jenkins-bot 0030cfde68 Merge "Don't update the editors re-use warning when re-using a reference" 2024-07-05 10:55:57 +00:00
jenkins-bot 0122adb8ba Merge "Extract some methods around the reference insert/update workflow" 2024-07-05 10:55:57 +00:00
Adam Wight de7f294f91 Promote orphaned subrefs to the top level
This isn't the ideal solution since it doesn't exactly match the
rendered reader view, but it's a reasonable workaround and an
improvement on "undefined" numbering.

Bug: T247921
Change-Id: Ic0d88123d50e2fcb7f25e897280dbfdb6d494501
2024-07-05 11:46:26 +02:00
Translation updater bot 12c9c1c0e6
Localisation updates from https://translatewiki.net.
Change-Id: I1fb24fb5e14c718ecc0fe2e952dde653d1321aa8
2024-07-05 09:47:23 +02:00
jenkins-bot c5a9012b67 Merge "Replace "shield" hack in MWReferenceResultWidget with CSS" 2024-07-04 07:38:00 +00:00
Translation updater bot b1a4ad72a4
Localisation updates from https://translatewiki.net.
Change-Id: I5e7cc90b15a75387d0f11ac5456eb34a0258c9e2
2024-07-04 09:23:20 +02:00
mareikeheuer 2ffbf1fa66 Display extends warning message when editing a reference
MVP implementation for adding a warning when editing a reference
that's the extension of another. In the current approach we're
just using the elements .text() like we do when you create an
extended reference.

Bug: T247922
Change-Id: I2fc574152059937b4aa3fc25ee486d363cc809d5
2024-07-03 07:18:35 +02:00
WMDE-Fisch f317419bb9 Don't update the editors re-use warning when re-using a reference
We only need to set some values that are needed by the `insert`
action triggered that then handles the insertion of the ref.

The form to edit or add a reference will never be visible
in the re-use workflow. No need to update that message then.

Change-Id: I710862bdc1bde6a8ce663d863d721cbf075494f0
2024-07-02 12:30:26 +02:00
WMDE-Fisch b483c829ab Extract some methods around the reference insert/update workflow
Includes renaming the method so it's more clear what it's doing.

As preparation for adding the extends warning to the edit pane and
to allow easier identification of parts belonging to the edit
workflow.

Change-Id: If84c5dbdee19c0ebc0a28b50dda93fef3f558c6e
2024-07-02 12:30:11 +02:00
Adam Wight 2748f659a8 Render subrefs indented under parent
With this patch, we show reflists in a hierarchical view with subrefs
listed under their parent.

TODO in follow-up patch: numbering of subrefs is still incorrect.

Change-Id: Ia82658af72caebd29241b9bd329d236ddc3f1e6d
2024-07-02 09:20:53 +00:00
Adam Wight d03d2d8d20 [refactor] switch reflist rendering source of truth
Pure refactor which shouldn't change output in production.  Switches
to interfacing with MWDocumentReferences to get refs in index order.
Temporarily suppresses any subrefs, we only show top-level refs.

Bug: T247921
Change-Id: I9c8347b064173027f436722c87e15e0381c958bd
2024-07-02 11:20:16 +02:00
Translation updater bot 94ebc6a8f8
Localisation updates from https://translatewiki.net.
Change-Id: I3e0ad8d57b6cd23accc955beb2284b64c57fe3f0
2024-06-28 09:40:54 +02:00
Translation updater bot da045950b0
Localisation updates from https://translatewiki.net.
Change-Id: I4cfed8bf3be5afe4bc6ce04c487b21710edb6449
2024-06-26 09:21:04 +02:00
WMDE-Fisch 20c3798055 Fix re-use search activity tracking name
C&P mistake in the original implementation. Otherwise we end up
with an undefined in the name.

Bug: T362347
Change-Id: I5c6957ca9fc81e6a5211aab050025eea5d0addbe
2024-06-25 17:02:04 +02:00
Ed Sanders 66fb3e661a Fix some documentation warnings
Change-Id: I7a97c99a919796f987a05ba17e25357fb5ef14c5
2024-06-21 18:00:45 +01:00
Ed Sanders 43333cd6b8 Re-enable pointer events in reference preview
This partially reverts I7e82e03ecfe.

Bug: T368119
Change-Id: Ibfd917b2413e306073e1ef4b3e50f06066a7c967
2024-06-21 12:49:53 +01:00
Adam Wight a2eec914cd [refactor] Split out reflist item rendering
Should be a no-op.

This change is made to prepare for recursively rendering subrefs.

Bug: T247921
Change-Id: Iebf546743c29a4a591ec1f085cc2e1b3496a38fa
2024-06-19 12:29:50 +02:00
thiemowmde bc7f1a7005 Replace "shield" hack in MWReferenceResultWidget with CSS
Same as in I7e82e03. The extra "shield" element was added in
2013 (!), see Ib244ff6. Back then we couldn't use the CSS property.
But nowadays we can.

Bug: T360034
Bug: T367030
Change-Id: Ib41e062491e65eabc8a52facefe283ba04ce16ff
2024-06-18 12:06:37 +00:00
Translation updater bot eeb4852be3
Localisation updates from https://translatewiki.net.
Change-Id: I3c2ca5242030964eec5b61b6bd72103ae39f76e7
2024-06-17 09:30:17 +02:00
jenkins-bot c197e9e519 Merge "Fix preview of parent reference in context item" 2024-06-15 07:02:12 +00:00
WMDE-Fisch 15bcfdcc70 Implement support to convert extended notes with auto names
To make sure also the parent gets a name even if it is not re-used
we need to iterate the list of reference to see if there's at least
one child that matches the parent.

The rest will be taken care of by getUniqueListKey that makes sure
that the matching temporary names will result in matching literal
names.

TODO:
- Write a ve.dm.Convertor test which shows the auto-name being
added.

Bug: T367031
Change-Id: I6ef42c8ffc8a4ff9224bfb2a910682d2c44f0dd2
2024-06-14 13:05:52 +00:00
thiemowmde 44afa99d49 Fix preview of parent reference in context item
I believe this was a mistake in the previous patch Idd57997. Using
only the .text() of the parent reference is not sufficient. Think of
a reference that contains a <math> formula or – even worse – is
nothing but a <math> formula. The preview will be empty in this case.

Click handlers in the preview need to be disabled. It's only a
preview.

Bug: T367030
Change-Id: I7e82e03ecfeb4e9cf132985684cff5e191506307
2024-06-14 14:32:21 +02:00
WMDE-Fisch aa5368ad32 Use full listKey for extends in the model
This makes it much easier to deal with the internal auto names
used on new elements created during one edit session.

We're ignoring the correct generation of the auto name literals
for now.

Bug: T367031
Bug: T367030
Change-Id: Idd579970cb64500dac27053213e9b116f23b6d76
2024-06-14 14:03:07 +02:00
Translation updater bot 04b0547c25 Localisation updates from https://translatewiki.net.
Change-Id: I53193a27f67f715e04fb5b5cd98a7c9b9592ab1d
2024-06-11 09:53:43 +02:00
jenkins-bot f415239d11 Merge "build: Update eslint-config-wikimedia to 0.28.0" 2024-06-06 19:00:16 +00:00
jenkins-bot 20c6967f76 Merge "Preserve reflist CSS in dynamic mode" 2024-06-06 18:00:29 +00:00
Ed Sanders 77b7f347c8 build: Update eslint-config-wikimedia to 0.28.0
Change-Id: I9f69e865d47e7cf4a8273bb0fdffbb9dac28b5cb
2024-06-06 16:28:53 +01:00
jenkins-bot e3dbe7dd3a Merge "MWCitationDialog: Use const instead of let" 2024-06-05 10:10:16 +00:00
jenkins-bot 70dd8cf815 Merge "Use array spread syntax instead of Array#concat" 2024-06-05 10:10:16 +00:00
jenkins-bot 27dc7e46b5 Merge "Remove unnecessary local variable for this" 2024-06-05 10:07:47 +00:00
jenkins-bot 863dd201ad Merge "ESLint: Enforce prefer-arrow-callback" 2024-06-05 10:07:46 +00:00
Translation updater bot 943326590e Localisation updates from https://translatewiki.net.
Change-Id: I7e122c6273d34aabba5f3e797e915c5eb27ed0cf
2024-06-05 09:22:31 +02:00
Ed Sanders cc2105e4a3 MWCitationDialog: Use const instead of let
Change-Id: I4f516505566ade57ede2a5c644f6215c786920c5
2024-06-03 12:31:33 +01:00
Ed Sanders d468e9fd55 Use array spread syntax instead of Array#concat
Change-Id: I38db1d3db51033e99dd55ccc867fb6ad0452640f
2024-06-03 12:31:33 +01:00
Ed Sanders aaeedee289 Remove unnecessary local variable for this
Change-Id: Id71b30552597e052f861de21347d3b4f55debee3
2024-06-03 12:31:33 +01:00
Ed Sanders 5a2154de38 ESLint: Enforce prefer-arrow-callback
Change-Id: I8d96b69e8c15bc8ad84cfb0c511396e5b3e7ac20
2024-06-03 12:31:33 +01:00
Translation updater bot 85fddfb1e4 Localisation updates from https://translatewiki.net.
Change-Id: I067a734c6a89950aa56be3551e9ae3fedc4f9fed
2024-06-03 09:31:09 +02:00
thiemowmde 7981f4d430 JSDoc: convert @cfg to @param
Bug: T138401
Change-Id: I5aec31b9a05b41ceb6a4a78c75cb0395aa1880b7
2024-05-28 10:38:26 +02:00
jenkins-bot fc9a610c2f Merge "Streamline code dealing with (undeployed) extends attribute" 2024-05-24 10:57:03 +00:00
Translation updater bot 59b733969b Localisation updates from https://translatewiki.net.
Change-Id: Iaac4b948ab0596347cba67c87b32cd32e794db84
2024-05-23 09:26:46 +02:00
Translation updater bot 422bd03b74 Localisation updates from https://translatewiki.net.
Change-Id: I010fd555406fe85013cb0bc5d2b68bd88589a430
2024-05-21 09:27:42 +02:00
thiemowmde 6c5c2dc6cb Remove separate private deferDoc property in ve.dm.MWReferenceModel
This is a direct follow-up for what I started in I3c9b9bb. Again all
this does is moving existing code around. The separate this.deferDoc
property is never used anywhere:
https://codesearch.wmcloud.org/search/?q=deferDoc&files=%5C.js%24
Instead I store the deferred function directly in the target property
this.doc and resolve it when needed.

Note that the concept of a parentDoc still exists. I tried to make
this as obvious as possible via comments and by arranging the code
accordingly:
1. A lot of code calls setDocument which directly sets this.doc. The
   parentDoc is never used in this case.
2. The parentDoc is only needed to auto-generate the (empty) document
   for the reference when a new reference is created.

That's also why the existing code always calls the constructor with
the parentDoc, even if this ends being unused in many cases: It's a
simple fallback.

Bug: T363096
Change-Id: I7874f187b2b397ed511b695ca9ff95838fcff302
2024-05-13 22:25:06 +02:00
thiemowmde 81f774c789 Don't call things "attrs" that aren't mw.attrs
mw.attrs does have a special meaning in this code. Together with
mw.body it reflects 1:1 what was written in the original wikitext
in the <ref …> and <references …> tags. Let's avoid using the same
(or almost same) variable name for other kinds of attributes.

Bug: T363096
Change-Id: I3e599ab910b9639e121f9b9d532b0f57f08f1e73
2024-05-13 18:37:17 +02:00
jenkins-bot 0c846421b3 Merge "Consolidate duplicate "is reference list empty" code paths" 2024-05-13 13:28:20 +00:00
jenkins-bot f9ba47d7f0 Merge "Drop separate MWReferenceModel.parentDoc property" 2024-05-13 13:01:26 +00:00
thiemowmde c921c76dd2 Consolidate duplicate "is reference list empty" code paths
Introduce a static method so we don't need to copy paste code.

Note that the static method still largely duplicates what the method
.buildIndex() will later do. Both loops iterate the reference groups
and the references in each group. The main difference is that the
"is empty" check stops extremely early the moment it finds any
non-empty group.

That's also why I'm convinced it's not worth caching the result.
I benchmarked it and it's nanoseconds. But there are more reasons:

The non-static .isIndexEmpty() method is currently only used when
Citoid is active the same time. Which means the cached result was
entirely unused on installations without Citoid.

Bug: T356871
Change-Id: Id5c4295086bc977ef52ad141be9962d2eecb1bcc
2024-05-07 15:51:12 +02:00
jenkins-bot 2349c3ceec Merge "Use OOUI's native "unselect all" feature" 2024-05-07 12:15:20 +00:00
WMDE-Fisch 52b9521dc9 Add tracking for VE Cite re-use interaction
Includes a minor drive by cleanup for an obsolete JSDoc block.

Bug: T362347
Change-Id: Ie4a6ebc5a468c0419001b0170c9cc7e13de616ba
2024-05-07 12:47:37 +02:00
Translation updater bot 48a4eb029e Localisation updates from https://translatewiki.net.
Change-Id: I0db6b2fce7293962a8f715ab746c3a8162a75cc1
2024-05-06 09:25:14 +02:00
Translation updater bot fd85662ab7 Localisation updates from https://translatewiki.net.
Change-Id: I80558444c309afb41efef8cbba144bbd16343a20
2024-05-03 09:28:19 +02:00
thiemowmde a531d4d82d Streamline code dealing with (undeployed) extends attribute
No need to create an expensive model here when all we need is a
single attribute.

Note this code is still behind a feature flag and not running
anywhere, except on the beta cluster.

Bug: T247922
Change-Id: Iea48837213b72a8d0f4b3cc9d9688d9a08315509
2024-05-02 17:13:24 +02:00
thiemowmde 790b46d41f Reduce minor code duplication in MWReferenceNode class
Parts of this was already done via I3edf0df.

Change-Id: Id71904ab9387c114b15757d35442e6e6632e87f2
2024-04-30 14:02:43 +02:00
jenkins-bot 29e8ba9ea0 Merge "Further delay search index build in ReferenceSearchWidget" 2024-04-30 10:49:17 +00:00
jenkins-bot 74b42ace80 Merge "Make ReferenceSearchWidget code a bit more functional" 2024-04-30 10:49:14 +00:00
jenkins-bot 18635f501d Merge "Unify and streamline code working with mw.attrs" 2024-04-30 10:39:01 +00:00
jenkins-bot a6405f230e Merge "Add safe-guard to ReferenceSearchWidget.buildIndex" 2024-04-30 10:38:09 +00:00
thiemowmde f61b840dc8 Drop separate MWReferenceModel.parentDoc property
We can re-use the existing this.deferDoc property to achieve the
same. There is apparently no need for a separate "parentDoc"
property for anything else but what can be seen in this patch.

https://codesearch.wmcloud.org/search/?q=%5CbparentDoc%5Cb

And no need to keep neither the parentDoc reference nor deferDoc
callback indefinitely. We can drop it after it got resolved.

This really just moves existing code around without changing
anything.

Bug: T363096
Change-Id: I3c9b9bbdff29a3f35d5a0710b48ca59bf592c6ab
2024-04-24 14:49:05 +02:00
thiemowmde 1391f43d03 Drop unused setters from MWReferenceModel class
These aren't used anywhere:
https://codesearch.wmcloud.org/search/?q=%5Cbset%28ExtendsRef%7CList%28Key%7CGroup%7CIndex%29%29%5Cb
These setters are reaching into internal details that currently
aren't ever modified from outside of the class, and shouldn't.
If it turns out we ever need to modify one of these we can easily
re-introduce setter functions, but probably give them more
meaningful names.

Bug: T363096
Change-Id: I2c9efc114bdc110a29b8d7fb48ea8c1814cdeb21
2024-04-24 14:17:49 +02:00
thiemowmde 14fe315c62 Mark private MWReferenceModel setters as such
This just documents the current status quo. These methods are not
used anywhere, and probably shouldn't:
https://codesearch.wmcloud.org/search/?q=%5Cbset%28ExtendsRef%7CList%28Key%7CGroup%7CIndex%29%29%5Cb
The only place these should ever be called from is from
newFromReferenceNode in the same class.

Bug: T363096
Change-Id: Ic28dbb5cbb2beb98c9fe6d283ed87d879728da0f
2024-04-24 14:16:52 +02:00
Translation updater bot d1e164ca8a Localisation updates from https://translatewiki.net.
Change-Id: I5bc4cea5b42fbd4be477cd2452df99593eb2dc0b
2024-04-22 09:27:49 +02:00
Translation updater bot cbfea786d8 Localisation updates from https://translatewiki.net.
Change-Id: If856eec18b5fc87044445ffb1a45edbfa58473c3
2024-04-19 09:46:00 +02:00
Translation updater bot 98a99171c9 Localisation updates from https://translatewiki.net.
Change-Id: I434483e134ceef88df5d6f53499ac0d60f75cfd8
2024-04-17 09:27:45 +02:00
Translation updater bot b21dbff0cc Localisation updates from https://translatewiki.net.
Change-Id: I5d6258de46d20fb6375f3bba4c481b99ef67a373
2024-04-15 09:27:38 +02:00
Translation updater bot 7b8ee26b51 Localisation updates from https://translatewiki.net.
Change-Id: Icfbf342ff65adcfcbd6013e5493a1111025fa784
2024-04-09 09:26:16 +02:00
thiemowmde e925fb4e16 Add safe-guard to ReferenceSearchWidget.buildIndex
Note this is only a bandaid patch that avoids the failure in this
place, but doesn't solve the fundamental problem. It appears like
the data coming from Parsoid (in internalList.….firstNodes and
internalList.….indexOrder) is somehow out of sync, and one of the
numbers in the .indexOrder array points to an element in .firstNodes
that doesn't exist (any more?). I don't know why.

Bug: T351550
Change-Id: Iaa4c748462d90d7783edb89713b61ffff6d70765
2024-04-09 09:23:32 +02:00
Translation updater bot 54c8aa860d Localisation updates from https://translatewiki.net.
Change-Id: Ib3b06dc0f0f3efe062ed39d674c0ed6960eda70f
2024-04-05 09:37:44 +02:00
thiemowmde 203a1cde34 Further delay search index build in ReferenceSearchWidget
The search index is really only used in a single place, in the
buildSearchResults method at the very bottom of the class. I find it
more obvious to understand what's going on when the places where the
search index is populated and used are as close together as possible.

This again really only moves existing code around without actually
changing anything.

We can also drop the extra "built" property and use a special null
value instead. This is possible because we know the only consumer of
the this.index property and can guarantee it can't get confused by
the null.

Bug: T356871
Change-Id: Iaddb3b16b3aa776f89fca2bf0350cce9b6bb1a23
2024-04-04 15:13:50 +02:00
thiemowmde e9561ade15 Make ReferenceSearchWidget code a bit more functional
This turns two methods with side-effects into more pure functions
with more obvious input and output. buildSearchIndex rebuilds the
internal search index from the internalList. buildSearchResults
filters and creates the result widgets the user will see.

This patch really only moves existing code around but doesn't change
anything. Except that this.built is set before onQueryChange is
called, not after. This avoids potential endless loops in case
onQueryChange happens to trigger buildIndex again.

Bug: T356871
Change-Id: Ib80a2dcb85779d64bec53caf90c49879d0ea2258
2024-04-04 15:12:57 +02:00
thiemowmde b02028b671 Move ve-cite QUnit tests to top-level tests/ directory
It's just hard to find and confusing when hidden in that
sub-directory.

Bug: T358851
Change-Id: I19ffe73b79fa9add52af12f477afe7abbc6db836
2024-04-03 12:03:33 +02:00
Ed Sanders 5ef2c13c48 Preserve reflist CSS in dynamic mode
Bug: T361359
Change-Id: I4c48129a54103f47ce512d685d2ab4b3c188a5b0
2024-03-29 13:04:40 +00:00
Translation updater bot c9a93cb3f4 Localisation updates from https://translatewiki.net.
Change-Id: I662c8bfc31d27125e969f8c7dfe8440effec62e8
2024-03-29 08:46:22 +01:00
jenkins-bot f4c690fa1a Merge "ce.MWReferenceListNode: Only open dialog on unmodified left clicks" 2024-03-28 16:14:32 +00:00
Ed Sanders d368f45c17 ce.MWReferenceListNode: Only open dialog on unmodified left clicks
Change-Id: I06f6e2cc89f595e6dcc931b78c908ff2270e4629
2024-03-28 15:30:43 +00:00
jenkins-bot 7906b2147a Merge "Remove confusing, unnecessary .length check on a string" 2024-03-27 08:15:09 +00:00
thiemowmde 61a49f4337 Remove confusing, unnecessary .length check on a string
I find this particularly confusing because it makes it look like this is
an array. As a reminder, while empty arrays are false in PHP they are
not in JavaScript. An extra `if ( array && array.length )` is really
critical. But this is a string. Empty strings are false in JavaScript.
No problem.

This was originally written in 2013 via Ib244ff6 as a pure .length
check. The duplication was added a year later via Id401d97 for an
unknown reason.

Bug: T356871
Change-Id: Ied335f170a9a0a7bbc8c8fd12f95b6902f401bbf
2024-03-27 07:16:54 +00:00
Translation updater bot 6ca87923bb Localisation updates from https://translatewiki.net.
Change-Id: I0c667f3a28bf61f9304ffe4f3c7844f17cf6af8e
2024-03-26 08:19:09 +01:00
jenkins-bot b0b356f4e8 Merge "Add initial QUnit tests relevant for reference re-use in VE" 2024-03-22 10:49:33 +00:00
Translation updater bot 7535cf0b3d Localisation updates from https://translatewiki.net.
Change-Id: I7b2bb4d2cf0dd4180484dc9fdd1361ddc1a576ac
2024-03-22 08:43:46 +01:00
thiemowmde d6a58cfa8d Add initial QUnit tests relevant for reference re-use in VE
Note these are more meant as regression test to better cover what's
done in other patches. Everybody should feel free to delete a test
when it gets in the way. I marked a few especially fragile places
with respective comments.

Bug: T358652
Change-Id: I7844907fe3ef4f3439717381b4ecdac9e2d0a825
2024-03-21 09:37:26 +01:00
Translation updater bot 9bc74e7694 Localisation updates from https://translatewiki.net.
Change-Id: I2d2a414f5fa41f47d6418302e8712bf2e1f30aba
2024-03-21 08:54:27 +01:00
Translation updater bot e6f17fd477 Localisation updates from https://translatewiki.net.
Change-Id: Icb746719a0a9d1b12c9ab23577a6fb4068c0957a
2024-03-20 08:23:14 +01:00
WMDE-Fisch 463e25b742 [Cypress] Streamline some selectors and click paths
Change-Id: I9c897f3c94a44f50de5c7a31822645a52cb3d70d
2024-03-19 11:33:23 +00:00
Translation updater bot 8dff3e20c5 Localisation updates from https://translatewiki.net.
Change-Id: I512a36ea005567c4acd4b5d158720922307a8351
2024-03-19 08:24:41 +01:00
jenkins-bot dbff601ebf Merge "Remove obsolete @method annotations" 2024-03-18 10:00:17 +00:00
jenkins-bot 2f1b3477f7 Merge "Remove broken CSS for ve.ui.MWReferenceGroupInputWidget" 2024-03-14 09:07:48 +00:00
Translation updater bot 5b7e331563 Localisation updates from https://translatewiki.net.
Change-Id: Ia5d8a16095d0a5893728799260bec416226e6e59
2024-03-14 09:02:36 +01:00
jenkins-bot cb725645ea Merge "Fix broken deletion of non-existing <ref refGroup="…">" 2024-03-13 16:37:43 +00:00
thiemowmde fa77ef25bd Remove broken CSS for ve.ui.MWReferenceGroupInputWidget
This CSS exists since I2ab47e7 from August 2014. The original idea
was to dim the default "General references" when you edit a <ref> or
<references> list in VisualEditor.

Steps to reproduce:
* Start VisualEditor.
* Edit a <ref> or <references> list.
* Edit the group.
* You will see the dimmed text "General references". This is not the
  CSS in this patch, but the default styling for OOUI placeholders.
* Open the dropdown. The list will show a "General references" item.
  It's not dimmed. This is where the CSS was meant to be.

The CSS class name in the OOUI mixin was actually changed from
"oo-ui-flaggableElement-…" to "oo-ui-flaggedElement-…" via I1abecd8,
just a few days later.

In addition the selector wouldn't work anyway for other reasons.
The dropdown is not inside the `.ve-ui-mwReferenceGroupInputWidget`
container any more but placed outside by the OOUI window manager.
And the selector's specifity is to low, at least since Ic57b3ff.

I argue it's not worth fixing it. Nobody missed it for 10 years.
Light gray text would be illegible anyway on the light gray/light
blue backgrounds used in the dropdown menu. Let's consider it dead
code and just remove it.

The class name doesn't appear anywhere else (any more):
https://codesearch.wmcloud.org/search/?q=flaggableElement

Change-Id: Ia802303737ba35cd4b14fae924b7227472f905fd
2024-03-12 16:36:22 +01:00
thiemowmde ae786bc2ef Fix broken deletion of non-existing <ref refGroup="…">
This can be quite confusing:
* A node does have attributes. One of the attributes is called
  "refGroup", another one "mw".
* mw contains a JSON structure with just a few elements, most
  notably a "body" and an "attrs" element. These reflect what was
  originally written in the wikitext.
* mw.attrs reflects the original properties a.k.a. attributes from
  the <ref …> or <references …> tag.

Deleting mw.refGroup doesn't do anything because the attribute is
called <ref group="…"> in the wikitext, not <ref refGroup="…">.

You can actually see this bug in action on all wikis: Go to a page
that uses references in non-standard groups, e.g.
https://en.wikipedia.org/wiki/Historic_Cherokee_settlements
Start VisualEditor. Find e.g. the [notes 1] reference. Edit it
and change the group from "notes" to "General references". Click
"Publish…" and "Review" your changes. The visual diff works because
it apparently uses other information. The wikitext diff is empty.
This is also what's saved: nothing. The edit is lost.

Bug: T359943
Change-Id: I798605d2fd60a6b8f317ec85a4e4d08fd245e084
2024-03-12 14:44:00 +00:00
Translation updater bot 7b308564e0 Localisation updates from https://translatewiki.net.
Change-Id: I1273544798e72192a48ab0219f7e1748ffb95e33
2024-03-11 08:26:28 +01:00
Translation updater bot 15663dc283 Localisation updates from https://translatewiki.net.
Change-Id: I8eb8c35e3283224b8101ea59b421648f4dca24ad
2024-03-04 08:23:03 +01:00
Adam Wight 8d0202a664 Minor logic cleanup
This didn't mean what it looked like: `||` has higher priority, so an
undefined elem would not result in an empty string.

Change-Id: I1e361842f060815b04802a1ab8f077faa1a8bc6b
2024-02-29 12:12:56 +00:00
Adam Wight 73c90a0e7d Clean up and fix some jsdoc annotations
Some of the annotations were used in a way that confused jsdoc.  This
cleans up redundant annotations and uses more canonical tags.

These changes cause all classes to now appear in the generated pages.

Includes linking to external docs.

Bug: T358641
Change-Id: Iaee1dadcc19a70c27839d0d27dfa6a07a70fb46b
2024-02-29 13:05:42 +01:00
thiemowmde 5d8e256fbc Remove obsolete @method annotations
These tags are 10 years old. Current documentation generators don't
need them.

Tagging something explicitely as being a @method can be useful in
an interface where the elements are initialized with e.g. `= null;`
instead of having an implementation. But we have implementations
here. Sure these are methods. No need to say that in the
documentation.

Also removing a comment that's obviously a copy-paste mistake from
what was the ve.ui.MWMediaSearchWidget back then. See Ib244ff6 and
before.

Change-Id: I7df6c789d10fd89e7fe97d56c942fd22c56d8458
2024-02-22 20:07:33 +01:00
thiemowmde 96da6cedfe Use OOUI's native "unselect all" feature
No need to manually scan for the currently selected item. And no
need to do it twice. The feature is a little hidden (calling the
method with no parameter) but always was supported.

Bug: T356871
Change-Id: I02401284eef5687eb0825d8d9ae0df294b3b4e03
2024-02-22 18:58:01 +01:00
thiemowmde 7151077e5f Unify and streamline code working with mw.attrs
I find it very helpful to use the name "mwAttrs" specifically for the
mw.attrs thingy that contains the original key-value pairs from the
wikitext.

An alternative is to use ve.getProp, which is helpful in other
situations.

Change-Id: I3edf0dfe5b9629fcda0bf8cb3b734215377a5c77
2024-02-21 13:52:12 +01:00
jenkins-bot 5bad2b183f Merge "Revert "Avoid creating a MWReferenceModel if not needed"" 2024-02-16 08:30:13 +00:00
DLynch 6bc1ae4146 Revert "Avoid creating a MWReferenceModel if not needed"
This reverts commit 74f66bc478.

Reason for revert: this broke reference reuse from Citoid

Change-Id: I86efea4945c1795dbfd61f4e020d78ca81a6f4d1
2024-02-16 03:54:34 +00:00
Translation updater bot 11591f72cd Localisation updates from https://translatewiki.net.
Change-Id: I6fa8273a3bb51c75ec72e928d78d00a0ed66e137
2024-02-14 08:18:28 +01:00
jenkins-bot 882f3e5ee7 Merge "Revert "Accessors to find MWReferenceNode in the document"" 2024-02-13 14:51:09 +00:00
Esanders f7c8b63ed1 Revert "Accessors to find MWReferenceNode in the document"
This reverts commit 0566a495f3.

Reason for revert: Merged too soon, while discussion of the whole
approach is still ongoing.

Change-Id: I2d3d6455cd4ea12067e2020f6b41cfbb4672bbb5
2024-02-13 12:57:02 +00:00
jenkins-bot 49e3ab6595 Merge "Accessors to find MWReferenceNode in the document" 2024-02-12 15:55:17 +00:00
Translation updater bot a68be1ceda Localisation updates from https://translatewiki.net.
Change-Id: I65f69dd188a5745c2161492029dcac902a76bce9
2024-02-12 14:49:05 +01:00
Adam Wight 0566a495f3 Accessors to find MWReferenceNode in the document
These are provides as a replacement for internalList indexes.

Bug: T336417
Change-Id: Ifd3a1b667369074e2cefa4d70e4c090e91b010b5
2024-02-09 15:37:27 +01:00
Adam Wight 74f66bc478 Avoid creating a MWReferenceModel if not needed
It's fine to copy attributes directly from the reference node rather
than go through the specialized model object.

Bug: T336417
Change-Id: Idaca192137dc762ddced2ee8446a7d838f97e317
2024-02-07 15:24:12 +01:00
Translation updater bot 8333e70453 Localisation updates from https://translatewiki.net.
Change-Id: Ic325aea9e6f28d870f3bfe5ad4962419723267ce
2024-02-01 09:01:15 +01:00
Adam Wight b0b628afd5 First tests for ve.dm.MWReferenceModel
Begin a QUnit test module for the reference model.  Tests demonstrate
that a new ref and a normal ref reuse from the full document both
behave as expected.

Bug: T336417
Change-Id: I1337806d41b50329ba971c8e68e1a62b52cc9a52
2024-01-31 13:52:40 +01:00
Translation updater bot f7d1ecb84b Localisation updates from https://translatewiki.net.
Change-Id: I4c21c3ea065de3e17672e19a7cb86907b4467d1c
2024-01-31 08:28:49 +01:00
Adam Wight 9535126304 [lint] Satisfy max-len rule
These changes mostly improve the code, and align the lint rules with
the MediaWiki base.

Change-Id: Ib4b0595fd9a9298039b8b44a0f1d4a9e90731527
2024-01-30 12:18:52 +01:00
Translation updater bot 723571b5d3 Localisation updates from https://translatewiki.net.
Change-Id: Ic56560791c1d93bde35617b594126fec2c578f9a
2024-01-28 16:05:40 +01:00
thiemowmde 16711d681b Group and nest stylesheets now they are .less files
Change-Id: Iedd9748cf9f38847ef4553459d533a67a0950645
2024-01-21 15:59:20 +01:00
Translation updater bot 2c84fbbc08 Localisation updates from https://translatewiki.net.
Change-Id: I34a16a2997cfad7578aa05a5704059a78c66b134
2024-01-18 09:24:42 +01:00
Translation updater bot 33f5611e1c Localisation updates from https://translatewiki.net.
Change-Id: If1cd1df28a06c68d35ee4b03e6ad3c9e7b01820a
2024-01-16 08:25:24 +01:00
Translation updater bot 7f71ada8f8 Localisation updates from https://translatewiki.net.
Change-Id: I14dfb64deb13f0113940b6e295fba232f941e2f6
2024-01-15 08:23:57 +01:00
Translation updater bot 9156975dae Localisation updates from https://translatewiki.net.
Change-Id: I0d9d5f9812c30d615bf8b150204ab5cab2d30858
2024-01-10 08:32:37 +01:00
Translation updater bot 086f5af8f8 Localisation updates from https://translatewiki.net.
Change-Id: I26541cfb187ee00cfee76e74d57ef702adcd8fed
2024-01-03 08:34:14 +01:00
Translation updater bot 07d75d4ebe Localisation updates from https://translatewiki.net.
Change-Id: Ie77f4c3e4e29cb1a67e40438443d4ad560404d7b
2024-01-02 08:48:22 +01:00
Translation updater bot 81502b4294 Localisation updates from https://translatewiki.net.
Change-Id: I540883ba46e78aaf77d20714bb3975ede2d676c3
2023-12-26 14:42:33 +01:00
Translation updater bot 12c414f4c4 Localisation updates from https://translatewiki.net.
Change-Id: Iaab9324e298b755d96678ac8868cbd98fc9d82f8
2023-12-22 17:45:28 +01:00
Translation updater bot 9b11e93bbe Localisation updates from https://translatewiki.net.
Change-Id: I04ba74f6fae07793f3a3180b204f3fbe89b16949
2023-12-21 19:45:01 +01:00
Translation updater bot e64d944194 Localisation updates from https://translatewiki.net.
Change-Id: Ice9b812492a0bce8ef003413a66501d9db1c75e2
2023-12-18 18:16:28 +01:00
WMDE-Fisch 2a02f5311d build: Update linter libs
* "eslint-config-wikimedia": "0.26.0"
* "grunt-eslint": "24.3.0"
* "grunt-stylelint": "0.19.0"
* "stylelint-config-wikimedia": "0.16.1"

Including auto fixes.

Change-Id: Iadacfc781a48675022144bb8c9489073d0bc19e3
2023-12-12 14:21:07 +01:00
Translation updater bot d368264120 Localisation updates from https://translatewiki.net.
Change-Id: Icdbb6a0468db59a04887413a83afe7a90e02ea64
2023-12-05 09:14:17 +01:00
Translation updater bot c784c47de5 Localisation updates from https://translatewiki.net.
Change-Id: Ie8a88219eb6691d249af60195724a3ef428c5ef2
2023-12-04 09:03:37 +01:00
Translation updater bot 30607b4cf0 Localisation updates from https://translatewiki.net.
Change-Id: I840e39ba3d0fa4cc0687e148d865da0262373f12
2023-12-01 09:38:44 +01:00
Translation updater bot f8967415a8 Localisation updates from https://translatewiki.net.
Change-Id: I191f8a688ccf3b2085d9d993265f304da45d5085
2023-11-29 08:30:38 +01:00
Translation updater bot f8010df944 Localisation updates from https://translatewiki.net.
Change-Id: I981c304635cffc265ae0aed53db3829bc569471d
2023-11-27 08:31:55 +01:00
Translation updater bot c60d8d1f2f Localisation updates from https://translatewiki.net.
Change-Id: Ia43cb04dbac14774f8bad377c23f25b76fa93009
2023-11-23 11:55:51 +01:00
Translation updater bot eb2bd5ff15 Localisation updates from https://translatewiki.net.
Change-Id: I64d02118866e006a197e094f827696f3dc014573
2023-11-22 08:19:39 +01:00
Translation updater bot a56fc64d18 Localisation updates from https://translatewiki.net.
Change-Id: I9250b0f75e11df2b8ff685a8cb0a6fe22f2a2261
2023-11-20 08:50:57 +01:00
Translation updater bot 463e002854 Localisation updates from https://translatewiki.net.
Change-Id: Icb4e8c538d29fa667786df48b99ed3fa56fa0245
2023-11-17 08:52:12 +01:00
Translation updater bot f649124a7f Localisation updates from https://translatewiki.net.
Change-Id: I86b6ea8d3c0d85f4510dc71139c229b4fde5bf20
2023-11-16 09:08:57 +01:00