Ori.livneh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/78399


Change subject: Load 'Edit' schema & register EL as ve.track handler
......................................................................

Load 'Edit' schema & register EL as ve.track handler

This change completes the migration of the 'schema.Edit' module to CoreEvents.
It complements change dfdf69266, which removes 'schema.Edit' from VisualEditor.
The patch also introduces a module, 'ext.coreEvents.veHandler.js', the sole
purpose of which is to register EL as the handler of ve.track-emitted events.

Change-Id: Ic14aa83772c8c9e5568176d0d16972166b45cc32
---
M CoreEvents.php
A modules/ext.coreEvents.veHandler.js
2 files changed, 25 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CoreEvents 
refs/changes/99/78399/1

diff --git a/CoreEvents.php b/CoreEvents.php
index 37aa5b6..fbe13c6 100644
--- a/CoreEvents.php
+++ b/CoreEvents.php
@@ -27,10 +27,30 @@
 
 // Messages
 
+$wgCoreEventsModules = array(
+       'schema.Edit' => array(
+               'class'  => 'ResourceLoaderSchemaModule',
+               'schema' => 'Edit',
+               'revision' => 5664452,
+       ),
+       'ext.coreEvents.veHandler' => array(
+               'scripts' => 'ext.coreEvents.veHandler.js',
+               'dependencies' => 'schema.Edit',
+               'localBasePath' => __DIR__ . '/modules',
+               'remoteExtPath' => 'CoreEvents/modules',
+       ),
+);
+
+$wgResourceModules += $wgCoreEventsModules;
+
 $wgExtensionMessagesFiles['CoreEvents'] = __DIR__ . '/CoreEvents.i18n.php';
 
 // Hooks
 
+$wgHooks['BeforePageDisplay'][] = function ( &$out, &$skin ) {
+       $output->addModules( array_keys( $wgCoreEventsModules ) );
+}
+
 /**
  * Log server-side event on successful page edit.
  * @see https://www.mediawiki.org/wiki/Manual:Hooks/PageContentSaveComplete
diff --git a/modules/ext.coreEvents.veHandler.js 
b/modules/ext.coreEvents.veHandler.js
new file mode 100644
index 0000000..4622e3c
--- /dev/null
+++ b/modules/ext.coreEvents.veHandler.js
@@ -0,0 +1,5 @@
+mw.hook( 've.activationComplete' ).add( function () {
+       if ( window.ve && ve.trackRegisterHandler ) {
+               ve.trackRegisterHandler( mw.eventLog.logEvent );
+       }
+} );

-- 
To view, visit https://gerrit.wikimedia.org/r/78399
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic14aa83772c8c9e5568176d0d16972166b45cc32
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CoreEvents
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to