From 2359b587ed749180c480d78356b4d2777a2bd82b Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Fri, 1 Mar 2024 15:37:32 +0000 Subject: [PATCH] ve.collab: Create ResouceLoader module Change-Id: I2fd9d604521901e3ccdf862afc0a4f2099c533b1 --- extension.json | 46 +++++++++++++++++++ includes/Hooks.php | 5 ++ .../ve-mw-collab/ve.init.mw.collab.init.js | 3 ++ 3 files changed, 54 insertions(+) create mode 100644 modules/ve-mw-collab/ve.init.mw.collab.init.js diff --git a/extension.json b/extension.json index 822c4173c3..b64398ec95 100644 --- a/extension.json +++ b/extension.json @@ -246,6 +246,11 @@ "lib/ve/lib/socket.io-client/socket.io.min.js" ] }, + "peerjs": { + "scripts": [ + "lib/ve/lib/peerjs/peerjs.min.js" + ] + }, "dompurify": { "scripts": [ "lib/ve/lib/dompurify/purify.js" @@ -559,6 +564,47 @@ "modules/ve-mw-collab/ve.init.mw.CollabTarget.css" ] }, + "ext.visualEditor.collab": { + "scripts": [ + "lib/ve/rebaser/src/dm/ve.dm.RebaseDocState.js", + "lib/ve/rebaser/src/dm/ve.dm.RebaseServer.js", + "lib/ve/rebaser/src/dm/ve.dm.DocumentStore.js", + "lib/ve/rebaser/src/dm/ve.dm.ProtocolServer.js", + "lib/ve/src/dm/ve.dm.RebaseClient.js", + "lib/ve/src/dm/ve.dm.SurfaceSynchronizer.js", + "lib/ve/src/ui/widgets/ve.ui.AuthorItemWidget.js", + "lib/ve/src/ui/tools/ve.ui.AuthorListPopupTool.js", + "lib/ve/src/ve.FakePeer.js", + "lib/ve/collab/ve.collab.js", + "lib/ve/collab/ve.dm.CollabTransportServer.js", + "lib/ve/collab/ve.ui.CollabProcessDialog.js", + "lib/ve/collab/ve.ui.CollabTool.js", + "modules/ve-mw-collab/ve.init.mw.collab.init.js" + ], + "styles": [ + "lib/ve/src/ui/styles/widgets/ve.ui.AuthorItemWidget.css" + ], + "dependencies": [ + "color-picker", + "peerjs", + "ext.visualEditor.core" + ], + "messages": [ + "visualeditor-collab-copy-title", + "visualeditor-collab-dialog-title", + "visualeditor-collab-dialog-privacy", + "visualeditor-collab-dialog-sessionend", + "visualeditor-collab-dialog-sharing", + "visualeditor-collab-dialog-summary-host", + "visualeditor-collab-dialog-summary-join", + "visualeditor-collab-hostbutton-label", + "visualeditor-collab-joinbutton-label", + "visualeditor-collab-url-mismatch", + "visualeditor-collab-url-placeholder", + "visualeditor-collab-url-prompt", + "visualeditor-collab-user-placeholder" + ] + }, "ext.visualEditor.ve": { "group": "visualEditorA", "scripts": "lib/ve/src/ve.js" diff --git a/includes/Hooks.php b/includes/Hooks.php index cdb3f837e8..9b5bfda72c 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -153,6 +153,11 @@ class Hooks implements ] ); $output->addModuleStyles( [ 'ext.visualEditor.desktopArticleTarget.noscript' ] ); } + // Joining a collab session + if ( $output->getRequest()->getVal( 'collabSession' ) ) { + $output->addModules( 'ext.visualEditor.collab' ); + } + // add scroll offset js variable to output $veConfig = $services->getConfigFactory()->makeConfig( 'visualeditor' ); $skinsToolbarScrollOffset = $veConfig->get( 'VisualEditorSkinToolbarScrollOffset' ); diff --git a/modules/ve-mw-collab/ve.init.mw.collab.init.js b/modules/ve-mw-collab/ve.init.mw.collab.init.js new file mode 100644 index 0000000000..618510118f --- /dev/null +++ b/modules/ve-mw-collab/ve.init.mw.collab.init.js @@ -0,0 +1,3 @@ +mw.hook( 've.activationComplete' ).add( function () { + ve.collab.join(); +} );