As this is a surface command, rather than a documentTrigger, pressing
escape will not close the editor if done elsewhere on the page, e.g.
in the site search bar, or an unrelated modal.
Move the logic to ArticleTarget as this could theoretically work
on the mobile site with a keyboard.
Allows us to remove some hacks around the ToolbarDialog that are no
longer necessary.
The command can also be used by the MWBackTool (which should be renamed)
and allows us to remove some custom logic from it.
Bug: T310694
Bug: T310695
Bug: T306763
Change-Id: I91ee6916a91d80d9872b3b44dad7eca55ad1acc4
Depends-On: I29f6af4cc7c71a63a6d1bafc53d16b9abd1b60ec
Reasoning:
* format=json must be the default. Nothing else makes sense in
the context of this code. This should not be a surprise.
* formatversion=2 is only a default when the custom
getContentApi() is used, but not when mw.Api is used. One
might argue that it's safer to always specify formatversion=2.
However, this is not done in other places in this codebase.
It should never be done or always.
* I find it confusing when the action=… is missing. Let's not
rely on this default.
Change-Id: I6ca29f76bffc0849103c5bcff4aaf28fcaaa4c52
This makes the code more readable and easier to reason about.
The ESLint rule responsible for this code style was removed
just recently.
Notes:
* I focus on classes that are relevant for what the WMDE team
does right now.
* I merge multiple `var` keywords only when the variables are
strongly connected.
* Caching the length in a for loop makes the code hard to
read, but not really faster when it's a trivial property
access anyway.
Bug: T284895
Change-Id: I621fed61d894a83dc95f58129bbe679d82b0f5f5
We have to move the activation logic from a ve.ui.Command to the
ve.ui.Tool, as the Command is unable to refer to the Target.
Previous attempt: 4984c5ffbb
reverted in fb32aa4978.
Bug: T279313
Change-Id: I3cb74aa5123b67a6c63b8e07ea7f93a6d4a07d4f
These don't add any knowledge but make the code harder to read
and maintain, and are an additional source of errors.
Change-Id: Ied57741a3f985e355adfddb4e75378d5c497faa9
This would would be correct if it was in a method of ve.ui.MWBackTool,
but this is actually a different class ve.ui.MWBackCommand (they are
both in the same file), which doesn't have a 'toolbar' property.
This partially reverts commit 4984c5ffbb
"Avoid using mw.ArticleTarget methods on global ve.init.target in tools".
Bug: T279613
Change-Id: Ia5e80e34cc5021295639cf18b3c324d2821aecf5
Reference images are moved to Cite and used by Citoid.
Bug: T170919
Bug: T171292
Depends-On: I02041246dda1b3d3ad1bcc0b014fa022e8259b62
Change-Id: Id97659ed1fa64a1223a8957fefaf2a149edd0e9c
We don't share much functionality, and we have to do a bunch
of hacks to disable functionality we don't want.
Change-Id: I9861123d8f1cbab1923f1aa5be713c2dadaed53d
Code in ve.dm.MWTransclusionNode (which ve.dm.MWSignatureNode extends)
expects the node data to have an 'attributes' property.
We could override a bunch of methods to fix this, or add checks in the
original code, but it seems more future-proof to instead ensure that
the property exists.
Bug: T248585
Change-Id: I5bd721ca73605a396509669145b740db7283afd3
And factor out the common code for using a preference with a fallback to
localStorage or a cookie.
Bug: T235566
Change-Id: Ibb983319edcd2987225fe89677fd10e3ff8f9df6
When user navigate to the version number,
the screen reader only narrates the hexadecimal number
associated with the version label without providing context
about what this number represents
Bug: T245470
Change-Id: If9cccac0d71de2de5da96a3a053d21e3deb0d80c
Tapping the toolbar save button while the save dialog is open triggers a save
because of the accesskey. It shouldn't save on a double-tap, because that's
easy to accidentally do / trigger on a slow device.
Bug: T230816
Depends-On: I4c3afce9d57c9bca737272b40b9a4862b5794bac
Change-Id: I1925b1b97de6a811f73196b616ec09a2c30c336f
When an edit notice is passed through from the API, allow
a type to be specified, and specify type 'block' if the
notice is a block notice.
If VisualEditorTrackBlockNotices config is true, track
when a message with type 'block' is shown.
Bug: T209633
Change-Id: If5fecc2c2c1c39f4b7245b9a215e1120c93b2b22
Pass through the current document when available, otherwise
assume the current surface's document.
Also add a getter for getPageName, so that can vary based
on the target document.
Bug: T193856
Change-Id: Ifdc951fdc6a43b924d102e3fcd7e59e52023757b