From b189ce2825ab5d34065096568be6b26fb2a12561 Mon Sep 17 00:00:00 2001 From: Adam Wight Date: Fri, 6 May 2022 11:37:54 +0200 Subject: [PATCH] Special:CollabPad supports `importTitle` parameter This lets us begin the import from another page, for example an edit tab or button. If the CollabPad page already exists, it will be opened without overwriting with freshly-imported page contents. Change-Id: I89293b9b06253243826d8f8144a5e93d55856e7c --- modules/ve-mw-collab/ve.init.mw.CollabTarget.init.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/ve-mw-collab/ve.init.mw.CollabTarget.init.js b/modules/ve-mw-collab/ve.init.mw.CollabTarget.init.js index 82ca84f193..2b6f6cf386 100644 --- a/modules/ve-mw-collab/ve.init.mw.CollabTarget.init.js +++ b/modules/ve-mw-collab/ve.init.mw.CollabTarget.init.js @@ -237,7 +237,7 @@ history.pushState( { tag: 'collabTarget', title: title.toString() }, title.getMain(), specialTitle.getUrl() ); showPage( title, importTitle ); } else { - location.href = specialTitle.getUrl(); + location.href = specialTitle.getUrl( { import: importTitle } ); } } @@ -308,7 +308,10 @@ onImportChange(); if ( pageTitle ) { - showPage( pageTitle ); + var uri = new mw.Uri( location.href ), + importTitleText = uri.query.import, + importTitleParam = ( importTitleText ? mw.Title.newFromText( importTitleText ) : null ); + showPage( pageTitle, importTitleParam ); } else { showForm(); }