Commit graph

10 commits

Author SHA1 Message Date
Umherirrender 4e94b88f99 Remove the VisualEditorHookRunner service
The HookRunner class is a lightweight class and not designed to be a
service, the needed HookContainer should be injected instead and a hook
runner created when needed.
The overhead from the service wiring is the same as using new objects
when needed.
This follows practice from core and the documentation in
core/docs/Hooks.md in the section "Hook runner classes"

Change-Id: Ib42281dfae8a5a260005d82ed3bb7da12e1b645e
2024-01-31 20:02:36 +01:00
Arlo Breault 2c1989c338 Stop injecting ServiceOptions in VisualEditorParsoidClientFactory
Change-Id: I7a3c5ef6435a38ef136e830b343dc19166659ef0
2023-08-30 17:05:17 +02:00
Arlo Breault de2935928c Remove unused VisualEditorParsoidClientFactory options
Looks like these were introduced in b029fd8 and could have gone out in
f2bb8cf.

Bug: T341614
Change-Id: I4f77a7fabb1016864cafb15848c0199028a7b6bb
2023-08-30 14:58:55 +00:00
Derick Alangi f2bb8cf45d Remove VirtualRESTService code from VisualEditor
This follows the event of VE no longer using RESTBase anything. All
actions related to stashing and Parsoid and now handled in MW core.

Bug: T339227
Change-Id: I50b20ed5abb721a6ac8987cac37a6f395a4816dc
2023-07-11 19:38:05 +02:00
daniel f36572432b Use PageRestHelperFactory
This isolates this extension from knowledge about the constructor
signature of the helper classes. Constructore signatures are not stable
interfaces.

Needed-By: Ie430acd0753880d88370bb9f22bb40a0f9ded917
Depends-On: I10af85b2da96568cfffd03867d1cb299645fb371
Change-Id: If1914dbfbefc3501b4d4cef4beb1fae307c36455
2022-11-19 21:21:11 +00:00
msantos 72b4f8cdbb Rename HTMLTransform related classes
* Rename imported classes in VE that will be renamed in core
* Re-enable tests that would fail when the core patch is merged

Depends-On: I506f3303ae8f9e4db17299211366bef1558f142c
Change-Id: I59ebeb24fa0de5f10d1501cc0830c7e4805e1003
2022-11-04 11:43:36 +00:00
daniel 35cb550747 Local implementation of ParsoidClient (DirectParsoidClient)
* DirectParsoidClient makes use of parsoid directly for performing
transformations on both wikitext and/or HTML contents.

* Also, it's used to fetch HTML from parsoid's parser cache. Before,
this operation was done via RESTBase but now it's being fetched in
core's parsoid parser cache.

* This patch also enables VE clients to transform HTML to
Wikitext when switching from HTML to source mode on. It
makes use of the HtmlInputTransformHelper to perform this
transformation.

* Now, VE client can make use of core code for switching
between HTML to source mode and back without RESTBase.

Change-Id: I5c7cfcc4086d8da7905897194d8601aa07418b59
2022-10-11 18:34:06 +01:00
daniel 0cd6c90d5a Extract RESTbase client code into VRSParsoidClient.
This makes the "direct" client and the VRS based client
implement the same interface, so the caller doesn't have to know
which one it is using.

It looks like ParsoidHelper will not be needed if we use this approach.

Change-Id: Ib1c1d7355951fc0765227dd01a9edfc554fc448d
2022-09-14 18:20:36 +01:00
Derick Alangi b029fd8ede Introduce VisualEditorParsoidClientFactory
This patch introduces a factory service for creating VE Parsoid
clients.

NOTE: This patch also injects a GlobalIdGenerator to the client
 and avoids usage of deprecated UIDGenerator class.

Change-Id: I787c0afb227308aab56770d14d62e08eb0084a6c
2022-09-06 12:47:43 +01:00
Kosta Harlan f035ce51f1 Introduce VisualEditorApiVisualEditorPostSaveHook
What:

Add hook that runs after a save attempt is made in ApiVisualEditorEdit.
The hook receives the same data available in ApiVisualEditorEdit, and
implementations of the hook can modify the API response.

Also introduce templated
parameters (https://www.mediawiki.org/wiki/API:Templated_parameters) in
the API parameters; this allows plugins to pass arbitrary data along
with their request using e.g. plugins=linkrecommendation&data-linkrecommendation=foo

Add ServiceWiring files, a PHP namespace, and a HookRunner class to
support the above changes.

Why:

VE plugins may wish to send additional data when saving an edit and take
action based on that data on the server-side. See for example the
AddLink plugin in I7a052f8e which sends annotation data, and then uses
the new hook to perform a database operation.

Change-Id: I392691475fbdcec766acbd832600e82efcb5bfe8
2021-04-30 20:50:01 +02:00