ApiParsoidTrait depends on some ApiBase methods, which is inconvenient
when one wishes to access Parsoid HTML outside of the action API. Move
the bulk of the code into a new class ParsoidHelper, which doesn't.
Replace the uses of methods:
* dieWithError: throw a different kind of exception where it makes
sense, or change the method to return a StatusValue instead of
throwing where it doesn't
* getPageLanguage: use Title::getPageLanguage() or pass as parameter
* getConfig: pass to constructor
* getLogger: pass to constructor
* getRequest: pass the only required part to constructor,
leave some other API-specific code using it in ApiParsoidTrait
Bug: T314565
Change-Id: I90656cc74bb1cb1f2f3c82ad51cfb164cb8a4a4b
* "visualeditor-dialog-transclusion-options" was added in 2013 via
I3bcf924. It was used as the label for multiple FieldsetLayouts in
ve.ui.MWTransclusionDialog.js. In 2013 a larger rewrite was done via
I51e74b3. The FieldsetLayouts with this message don't exist any more
since then.
* "visualeditor-dialogbutton-meta-tooltip" was added in 2013 via
Ibf63329. It was used as the button label in
ve.ui.MWMetaButtonTool.js. This file was deleted in 2013 via
I3bb61d5. That patch added a new message "visualeditor-meta-tool"
that says the same as the old message". The old message is unused
since then.
* "visualeditor-savedialog-label-create" is a new key for a message
that existed before. The old key was "visualeditor-create-page". It
was used in ve.init.mw.ViewPageTarget.js as a button label. This
usage was removed in 2012 via I5f59482. The renamed message was
never used.
* "visualeditor-savedialog-label-report" was added in 2012 via
I5f59482. It was used as a button label in
ve.init.mw.ViewPageTarget.js. The feature was removed in 2013 with
no replacement, see I8a5e0ab. Some of the messages that became
unused got removed in the same patch, but not all of them.
* "visualeditor-savedialog-warning-dirty" was added in 2013 via
I3daf631. It was used for a confirmation popup in
ve.init.mw.ViewPageTarget.js. I8c0db01 moved the code to
ve.ui.MWSaveDialog.js. In 2015 the confirmation popup was removed
with no replacement, see I9091534.
Change-Id: Iae7961612d5b5be9cdd294a67a9ce40ee8cb9b4d
The message "visualeditor-dialog-template-insert" was added in 2021
via I5da4003. It was used as a dialog title in
ve.ui.MWTemplateDialog.js. In 2021 we introduced three new messages
via Ib9b76ca. One of them still says the same as the old message, but
got a new key assigned. It appears like we forgot to remove the old
message.
Change-Id: Ie3854114197e3f36b48bb7efd8dd96a1f9651198
The need for something like this was anticipated in
I2bf43c7e83283f43e047229eb53c244918fcbb0c.
As of version 2.5.0 of Parsoid's output, if alternate text is missing
for an image but a caption is present and image isn't displaying the
caption (ie. it isn't a thumb or frame), then the text content of the
caption will be set as the alt attribute. Parsoid will then drop the
alt attribute when serializing if it matches the caption text, since
it's unnecessary.
However, if the caption is modified and the alt text isn't, the alt will
be serialized. This is likely to be unexpected to editor. They may
have missed that the both the caption and alt are populated in VE and
only edited one place.
Since all of the above is happening only for images where the caption
isn't visible, it doesn't appear to be a much used feature since, at
least for inline images, the experience of caption editing was already
less than optimal.
However, because of a quirk in how galleries are rendered in Parsoid,
this affects gallery caption editing, which is visible and presumably
used more often. See T268250 for a discussion on an improved gallery
structure. But for now, gallery images are effectively inline and set
the alternate text, thus subject to the above.
Here we add a checkbox so that the default is to ignore the alt if it's
the same as the caption. And only make use of it if it differed
originally or was explicitly unchecked to modify.
Bug: T311677
Change-Id: Idf297d8a98995971c5835b0cea56c3317a3626e2
visualeditor-dialog-media-thumbdimensions
Added in 2014 via I7b4d019, but never used, as far as I can tell.
visualeditor-dialog-media-searchselect
Unused since I65aed34 from 2015.
visualeditor-dialog-meta-settings-displaytitle-enable
The feature was removed in 2017 via I46db6b1.
This patch also marks some other messages as being used via comments.
Change-Id: Ia10b6a5c0ea83dd670e2cfdbaa768c41fc0cf392