mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
Merge "Fix duplicate wikitext parse for displaytitle"
This commit is contained in:
commit
54b938e629
|
@ -186,7 +186,7 @@ class ApiVisualEditor extends ApiBase {
|
|||
$apiParams = array(
|
||||
'action' => 'parse',
|
||||
'page' => $title->getPrefixedDBkey(),
|
||||
'prop' => 'text|revid|categorieshtml',
|
||||
'prop' => 'text|revid|categorieshtml|displaytitle',
|
||||
);
|
||||
$api = new ApiMain(
|
||||
new DerivativeRequest(
|
||||
|
@ -205,16 +205,25 @@ class ApiVisualEditor extends ApiBase {
|
|||
$links = isset( $result['parse']['links'] ) ? $result['parse']['links'] : array();
|
||||
$revision = Revision::newFromId( $result['parse']['revid'] );
|
||||
$timestamp = $revision ? $revision->getTimestamp() : wfTimestampNow();
|
||||
$displaytitle = isset( $result['parse']['displaytitle'] ) ?
|
||||
$result['parse']['displaytitle'] : false;
|
||||
|
||||
if ( $content === false || ( strlen( $content ) && $revision === null ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( $displaytitle !== false ) {
|
||||
// Escape entities as in OutputPage::setPageTitle()
|
||||
$displaytitle = Sanitizer::normalizeCharReferences(
|
||||
Sanitizer::removeHTMLtags( $displaytitle ) );
|
||||
}
|
||||
|
||||
return array(
|
||||
'content' => $content,
|
||||
'categorieshtml' => $categorieshtml,
|
||||
'basetimestamp' => $timestamp,
|
||||
'starttimestamp' => wfTimestampNow()
|
||||
'starttimestamp' => wfTimestampNow(),
|
||||
'displayTitleHtml' => $displaytitle
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -147,15 +147,6 @@ class ApiVisualEditorEdit extends ApiVisualEditor {
|
|||
$view->displayTag();
|
||||
}
|
||||
$result['contentSub'] = $this->getOutput()->getSubtitle();
|
||||
|
||||
$content = new WikitextContent( $wikitext );
|
||||
$parserOutput = $content->getParserOutput( $page );
|
||||
if ( $parserOutput ) {
|
||||
$result['displayTitleHtml'] = $parserOutput->getDisplayTitle();
|
||||
} else {
|
||||
wfDebug( '[VE] ApiVisualEditorEdit - parserOutput was false' );
|
||||
}
|
||||
|
||||
$lang = $this->getLanguage();
|
||||
|
||||
if ( isset( $saveresult['edit']['newtimestamp'] ) ) {
|
||||
|
|
Loading…
Reference in a new issue