mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 16:20:52 +00:00
Merge "Add editintro to notices"
This commit is contained in:
commit
2b913fb10c
|
@ -298,6 +298,19 @@ class ApiVisualEditor extends ApiBase {
|
|||
)->parseAsBlock();
|
||||
}
|
||||
|
||||
// From EditPage#showCustomIntro
|
||||
if ( $params['editintro'] ) {
|
||||
$eiTitle = Title::newFromText( $params['editintro'] );
|
||||
if ( $eiTitle instanceof Title && $eiTitle->exists() && $eiTitle->userCan( 'read' ) ) {
|
||||
global $wgParser;
|
||||
$notices[] = $wgParser->parse(
|
||||
'<div class="mw-editintro">{{:' . $eiTitle->getFullText() . '}}</div>',
|
||||
$title,
|
||||
new ParserOptions()
|
||||
)->getText();
|
||||
}
|
||||
}
|
||||
|
||||
// Old revision notice
|
||||
if ( $restoring ) {
|
||||
$notices[] = $this->msg( 'editingold' )->parseAsBlock();
|
||||
|
@ -603,6 +616,7 @@ class ApiVisualEditor extends ApiBase {
|
|||
'wikitext' => null,
|
||||
'section' => null,
|
||||
'oldid' => null,
|
||||
'editintro' => null,
|
||||
'pst' => false,
|
||||
];
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
"apihelp-visualeditor-description": "Returns HTML5 for a page from the Parsoid service.",
|
||||
"apihelp-visualeditor-param-basetimestamp": "When saving, set this to the timestamp of the revision that was edited. Used to detect edit conflicts.",
|
||||
"apihelp-visualeditor-param-cachekey": "For serialize or diff, use the result of a previous serializeforcache request with this key. Overrides $1html.",
|
||||
"apihelp-visualeditor-param-editintro": "Edit intro to add to notices.",
|
||||
"apihelp-visualeditor-param-etag": "ETag to send.",
|
||||
"apihelp-visualeditor-param-format": "",
|
||||
"apihelp-visualeditor-param-html": "HTML to send to Parsoid to convert to wikitext.",
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
"apihelp-visualeditor-description": "{{doc-apihelp-description|visualeditor}}",
|
||||
"apihelp-visualeditor-param-basetimestamp": "{{doc-apihelp-param|visualeditor|basetimestamp}}",
|
||||
"apihelp-visualeditor-param-cachekey": "In computer science, in the context of data storage, serialization is the process of translating data structures or object state into a format that can be stored (for example, in a file or memory buffer, or transmitted across a network connection link) and reconstructed later in the same or another computer environment.\n{{doc-apihelp-param|visualeditor|cachekey}}",
|
||||
"apihelp-visualeditor-param-editintro": "{{doc-apihelp-param|visualeditor|editintro}}",
|
||||
"apihelp-visualeditor-param-etag": "{{doc-apihelp-param|visualeditor|etag}}",
|
||||
"apihelp-visualeditor-param-format": "{{doc-apihelp-param|visualeditor|format}}",
|
||||
"apihelp-visualeditor-param-html": "{{doc-apihelp-param|visualeditor|html}}",
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
( function () {
|
||||
var prefName, prefValue,
|
||||
uri = new mw.Uri(),
|
||||
conf = mw.config.get( 'wgVisualEditorConfig' ),
|
||||
pluginCallbacks = [],
|
||||
modules = [
|
||||
|
@ -37,7 +38,7 @@
|
|||
conf.enableWikitext &&
|
||||
(
|
||||
mw.user.options.get( 'visualeditor-newwikitext' ) ||
|
||||
new mw.Uri().query.veaction === 'editsource'
|
||||
uri.query.veaction === 'editsource'
|
||||
) &&
|
||||
mw.loader.getState( 'ext.visualEditor.mwwikitext' )
|
||||
) {
|
||||
|
@ -141,7 +142,8 @@
|
|||
action: 'visualeditor',
|
||||
paction: ( conf.fullRestbaseUrl || conf.restbaseUrl ) ? 'metadata' : 'parse',
|
||||
page: pageName,
|
||||
uselang: mw.config.get( 'wgUserLanguage' )
|
||||
uselang: mw.config.get( 'wgUserLanguage' ),
|
||||
editintro: uri.query.editintro
|
||||
};
|
||||
|
||||
// Only request the API to explicitly load the currently visible revision if we're restoring
|
||||
|
@ -275,7 +277,8 @@
|
|||
action: 'visualeditor',
|
||||
paction: 'wikitext',
|
||||
page: pageName,
|
||||
uselang: mw.config.get( 'wgUserLanguage' )
|
||||
uselang: mw.config.get( 'wgUserLanguage' ),
|
||||
editintro: uri.query.editintro
|
||||
};
|
||||
|
||||
// section should never really be undefined, but check just in case
|
||||
|
|
Loading…
Reference in a new issue