New changes:
91a762803 ve.dm.ModelRegistry: Disallow unknown types on tag and tag+func matches
8575e8ad8 PreviewElement: Document event
d24f96874 Allow unknown types for ve.dm.AlienMetaItem
106354b38 Follow-up I534ce003d: Fix height restriction calculation of desktop context
Local changes:
* Allow unknown types for ve.dm.MWExternalLinkAnnotation, it is meant
to match all <a> tags and handles unknown types in toDataElement()
Depends-On: I785be75f389136769084a8e14832a09e3a519fc1
Bug: T303298
Bug: T304847
Change-Id: I75d1e82a43f5f96a9093cd334c524527918efaa5
This was added to make the context a bit more consistent
with the regular link inspector, however with I2fec865570
we making these delete buttons strictly mobile only.
Change-Id: I52936919e332aee851ccd11a862367c97eb41b39
This code is optimized for the 2 most relevant use cases:
1. When Cirrus finds 10 results, we still want to search for the top 1
prefix match. This is critical for templates like !!. This will appear
at the top. unshiftPages() makes sure the limit of 10 is enforced.
2. When Cirrus fails to find anything, we search for 10 prefix matches
and use these instead.
The code can also handle everything in between. For example, when
Cirrus finds 5 results, we search for 5 more prefix matches and add
them when Cirrus missed them. The total number in the end might be 5 to
10 depending on the number of duplicates. This is intentional. Why?
Let's say we always search for 10 prefix matches and add them to the
top when Cirrus missed them. This might remove _all_ Cirrus results.
This shouldn't happen. This extra code is only to fill in glaring gaps,
not to replace Cirrus. 5 results are fine.
Bug: T303524
Change-Id: Ib0471795124c0c7001b6901edaf8e7b380e426b1
There is already some kind of "fallback" to prefixsearch. We always
check if the top-1 prefixsearch result is part of the result set.
Because of this the current worst-case scenario is that only this
1 result is shown.
This patch implements a full fallback to prefixsearch. But only when
there are 0 CirrusSearch results. Further tuning might be done in
later patches.
Bug: T304925
Change-Id: I1927eedad60c9b9ac2021481a85376c08ccf6fdb
.test() is the dedicated syntax for a boolean "does match? yes/no?"
check. .match() returns an array of matches, or null. This is just not
needed in these situations.
Change-Id: Ibb996ab843d1a6c7d7af98d6a112990665d543b2
Also invert logic and rename variables to make tests in tryTeardown
and switchToWikitextSection identical.
Bug: T294463
Change-Id: Icb86a676c3f315e4a3d229f46eb383dcd7959973
We ended mixing two concepts in a single method:
* We need a method that allows us to create the parameter list widget
when it's needed, even if it's empty. This is relevant when a template
is entirely empty, and the first parameter is added. This wasn't
working. Instead the parameter list was created with all parameters.
* On initialization we either want all parameters to be shown, or only
used ones. But this code is only needed once, on initialization. I
ended inlining this code in this patch.
Bug: T300640
Bug: T304046
Change-Id: I6620a870e4420dcb8fecf522b3274458eeec891d
A class, mw-broken-media, was added in
I92359048b42d32fe8a0f2cb79cd348cf5f2c56cc
Bug: T304010
Bug: T270150
Change-Id: I542d7d879868c9030ce00b2686cdfd0077e49491
These two lines forcefully enabled the review/preview buttons, even
when the review/preview panel is already active.
Bug: T300448
Change-Id: I6dbe6ee88728a65233a455b768f17bff668fe3a8
In the mobile view, parameters don't have left padding so some styles
should only be applied to the desktop stylesheet.
Bug: T304167
Change-Id: I1846512c21aae36f212fe142b7d96ac91e46854b
Currently in VE desktop, items which can be deleted with
delete/backspace do not have this button. If that situation is
considered a problem it sould be solved consitently for all
focusable nodes as part of a wider fix.
Adding a delete button to template contexts makes them inconsistent
with other focusable nodes.
Bug: T274263
Change-Id: I2f7508a605852274ba8f40b2afd1dfd56600aa36
This fixes a styling issue with inline descriptions, for the scenario
when the inline description feature is enabled but the new sidebar is
disabled.
Bug: T304167
Change-Id: Ida4da4605da5143de2a27725d87d5876aea7065c
The Apex skin (not to be confused with the Apex OOUI theme)
is abandonware. Keeping files around that pretend to support it
is just maintenance debt.
Change-Id: I176e4e25307ab8ca4166a6e9b55e3bec4f058d05
Parsoid added a class and, without it, we get selser complaining
about wrappers being modified, similar to T214649.
The "image" class is removed since Parsoid never added it (although it
now has "mw-file-description" for a similar purpose) and the legacy
parser doesn't apply it indiscriminately.
It doesn't seem like VE supports editing the |link= media option; it
just tries to roundtrip what's there and drops it on edit. The patch
here works with that limitation.
Galleries are found to drop href's, breaking selser, and should be fixed
in a follow up.
Bug: T292657
Bug: T303469
Change-Id: I92359048b42d32fe8a0f2cb79cd348cf5f2c56cc
Due to the stickyness we need to scroll the header and the first
visible item from the parameter list to have the best result in all
cases.
We also only want to scroll when the user triggered hiding the
fields. Not when the template outline view is initialized.
Bug: T302965
Change-Id: I84d293888a7dbf13ec655c293c0fc3a79edca698
It removes some indirection.
* Find: \$\( '<.+?' \)\.toArray\(\)
* Replace with: $.parseHTML( \1 )
(also replaced a few by hand that weren't caught by that regexp)
Change-Id: I2639cc4a26bc960046a189504dd8058344e14d60
New changes:
cf7b2a9c4 Restore margin between wrapper paragraphs and document edge
629109b6b ve.ce.Surface tests: Sometimes assert originalDomElements in paste tests
3a5bd323c Use wrapper paragraphs in fixUpInsertion
Local changes:
* Update tests to ignore some internal properties
Bug: T299815
Bug: T299817
Change-Id: Ie52348f62320eb135c2f950ac78a77d9c665fef2
This was added back in 2020 so mw:DisplaySpace would work while the
RESTBase cache still contained old data. It's been two years, it should
be good now.
Follow-up to ed3579245e
Change-Id: I65665231b78198633682d52c48068c89807df55e
Once we determined a link is internal from the first regex, we don't to
check if it matches the wgScript path as well. This would cause
"/index.php/Article" style paths to be detected as external as they failed
this second check.
Change-Id: I560d8080c513c523c68f2750be332e9fd91de192
This logic has been moved to the relevant extensions which can
now disable VE using a hook.
Depends-On: I47880be15b6ce1a93f389a32aff304cc3b798bcb
Depends-On: If188e8fcceb248738fc625ddd5afec351c01c484
Bug: T174180
Change-Id: I245295373af3caffb1d4cbc288e8d2bd008520b7
* I can't guarantee this fixes T301914. But I suspect the bug can not
be triggered any more with this plus If9b6050 in place.
* I wasn't able to reproduce the issue locally. But I learned that
1. it's related to the hotkey, and
2. it's because the dialog looses focus, and the focus ends on the
VE surface in te background. Pressing Esc there closes VE. That's
intended behavior.
* I tried to use .trigger( 'click' ), but it doesn't make much of a
difference. The only magic check is if the button is disabled. But no
visibility checks are done.
Bug: T301914
Change-Id: I2f66fc2411144c60cd08baae58452d336b4e9802
In a test case with 200 templates where all but a few parameters are
unused the loading time is cut in half.
Bug: T300974
Change-Id: Ice850cb9e5e95b9e3a19ff511b3a4f32117c7199
Our theory is that browser plugin spam shouldn't reach
the DM document unless we've made a coding error like
I194ff1d57. Log future errors so if there is more plugin
spam in the future, we can investigate the cause.
Bug: T298147
Depends-On: I705195bc5d0f76a38da5d2cc09fab184a2c32401
Change-Id: I3403859906ceaa51be63b0d79f474f0289ab4408
Same random finds while working on something else. I carefully
checked and made sure these methods are actually called without the
optional parameter.
Change-Id: Iab36fd130258322985b5d6e7f8e1f7b4ee235ba2
This focuses on a few trivial cases where the syntax helps making
the code more readable. One level of indirection is gone with this.
Change-Id: Ibf25d7eaa06952e69b36bd5a78a48d04ac62890c
These are only needed when we need to access a specific `this` from
within another `function () {}` context. This is not the case in the
situations here.
This is split from Ibf25d7e to make it smaller and easier to argue
about.
Change-Id: Ide1476de91fc343aa992ad92a1321d3a38b06dd0
The `.` character class matches any character *except* line terminators,
but edit summaries can contain those. Use [^] to match truly everything
in the comment part. (In the section part, I assume `.` is okay.)
Bug: T302103
Change-Id: I29fcdd7489d118674bab5cfe5c0a15b8e4efac64
Passing the useskin parameter ensures that output hooks are run
on the new page HTML. This already happens because we request
the 'subtitle' and 'categorieshtml' props which also trigger
skin mode (along with the 'headhtml' which we don't request).
However it is better for us to be explicit that we want the rendering
for a specific skin, rather than relying on these props to trigger
the correct mode.
Also pass through mobileformat param, which is added by a hook
in MobileFrontend.
Change-Id: I1cd2c5c5c13ae0b90cc32e441b453532343a434a
This ensures the full loading sequence is shown when the
user opens VE using history navigation.
Bug: T301843
Change-Id: Ia7a641c8bd5a036f23c9da94bc539d8cf66c5021
Previously we were adding an event listener every time the
target was opened, and not removing the old ones.
Change-Id: I0ce609f1d9e2d6fb00b605dcade6f27e7a887b9d
Found via Iaf989bc50363a (patch set 6):
> FAILED TESTS:
> ve.init.mw.DesktopArticleTarget
> ✖ init
> Died on test #1
> TypeError: Cannot set property 'pageLanguageCode' of null
> at Object.<anonymous>
Bug: T89434
Change-Id: I8ad2cc4c115224eb276d1488091b9518fde739f9
* Append the toolbar before starting the scroll
* If the toolbar is floating set the anchor to full height
immediately. This shouldn't cause the content to jump down
due to scroll anchoring:
(https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-anchor/Guide_to_scroll_anchoring)
But add our own logic for it for browsers which don't support that.
* Now the browser only has to deal with the scroll animation,
and not the height animation of the toolbar anchor at the
same time, making it smoother and less buggy.
Bug: T301773
Change-Id: I61d533d40758d559b03c858e0006ef2e4f0fcd16
Previously, a toolbar with the extra tool could be shown for a moment
while the editor was loading.
Bug: T301626
Change-Id: I7f5d01ef6e64ef85141a38a236fe2a1d1ada00e8
When the editor is loading, and the browser window is narrow enough
that we should use the narrow toolbar, the wide toolbar would appear
for a moment. It was particularly jarring when it caused it to wrap
over two lines.
Bug: T301626
Change-Id: I551a66edab40235c4a26751eed163b5b30ef698f
Make sure it works on pages which don't trigger DT, such as full-page
wikitext editing.
Bug: T301497
Change-Id: Id3d46eef319f278ee71fbbedbddd16d5ffd540d8
* Pass 'noPrompt' to #tryTeardown
* #loadFail gets triggered by the data promise being aborted,
so if 'activating' has been cleared at this point, don't
prompt about there being load error.
* Retry/cancel dialog assumed you were coming from a wikitext
editor. Rewrite the logic to handle teardown the target if
the user is coming from read mode.
Change-Id: If9e5d1fbf00f8359f4d06fe7fc3064cc7e349bc9
I bit more logic was needed to make sure, the state of the widget
resets when all unused fields are added during search.
Bug: T299811
Change-Id: I3006c233fda5490e323bc3a3e631bf0c1199bda3
Covers the base functionality to hide the parameters. Performance
optimizations could be done in a follow up.
Bug: T300640
Change-Id: Ia99b5da392273f1445e475a0720a656460612dcf
The behavior is now consistant with what would happen when the
buttons are triggered.
Instead of emitting a button click I directly wired the methods
that will by triggerd by the click. This might make it easier to
remove the old sidbar later.
To avoid movement when the buttons should be disabled, an
additional check was added to the onMove method. It's not identical
to the more complex check in the outlineControlsWidget, but should
be enough for our use case. The onDelete method already just does
nothing if nothing is selected.
Bug: T300971
Change-Id: I8a278c9657c91fd648944b5a8c1204c9fff75b7e
This option was added in 0.43.0. Now that the close button is handled,
the remaining functionality (store a flag in local storage, and fixing
link targets) doesn't really justify a separate class, especially as
it's currently only used once.
Change-Id: I0fd81cadccc077dbf957302f9f41409c5a1f4f20
Previous attempt in 005a8d24ef,
reverted in 3c1d167b33.
The deduplicateStyles() function lacked a check for fosterable
positions, which caused T299767. This is now fixed.
Also added tests.
Bug: T287675
Bug: T299251
Change-Id: I0d22be9b66d26d09373cee63dd6ce52c1659e62d
This prevents an unwanted scroll when the main edit link is used
and the first section is below the viewport.
Change-Id: Ib99ebe2dc5c105c3fcbd687ef5740166267f5536
This doesn't change the position of the loading bar, but it keeps it
still if any scrolling happens. Previously we expected the user probably
wouldn't scroll while VE is loading, but in subsequent commits we
will trigger automatic scrolling in section editing mode.
Change-Id: I1404ccd77583d808ef79291c6cb4f561e76bd41c
We introduced these methods in Idc0cccbe but didn't update this
logic in MW.
This prevents focus being put inside an image caption if the section
starts with a block image.
Change-Id: I4cc1a116c1dcc8e1c642359ea768b6f5265a061b
Parsing it in the RL module caused the module cache key to depend
on the parse, which is slow and makes ResourceLoader sad. The usual
approach for solving this (I206bb05d28) can't be used, because of
how EditPage generates this message.
Bonus #1:
Generate the message for the correct page title. MediaWiki allows
customizing it per-namespace or even per-title, which we haven't
supported before.
Bonus #2:
Pass the context for message localisation (depends on I5f7c77970d).
EditPage::getCopyrightWarning() was parsing messages without the
interface flag, causing some needless processing elsewhere.
Depends-On: I5f7c77970d0525c0ff394f8bd72c69dcb5d00623
Bug: T298822
Change-Id: Iaa626f0e6379a5a370f9c465cea8528bb5bde7f7
New changes:
e5963f084 DiffElement: Remove doc-child-change wrappers
90a359f79 Follow-up Ia593dad8: Use modifyData when sanitizing
f5c7f0f20 Localisation updates from https://translatewiki.net.
Local changes:
* Update tests for the removal of doc-child-change wrappers
Change-Id: Ib29f23625de9151d50e0f3b7796b15ca9ed89133
Do show a confirmation when editing templates without parameters,
but don't show the confirmation when you're only on the template search
page.
Bug: T299394
Change-Id: I8205bb6a0f92b7b535a80f7f6a43674f1aa5b51b
We were using addItems() incorrectly, and it stopped working after
change Ib1241f93d214e8a7d2f757a120f84de3879575af in OOUI.
Bug: T299818
Change-Id: I2d00cb929673a419789ca6f8bc308721373e1da8