Skip to content

Commit e7d76c0

Browse files
use preview parameter when previewing templates
1 parent a5fd408 commit e7d76c0

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/MwApi.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default class MwApi {
1414
parameters: {
1515
format: 'json',
1616
formatversion: 2,
17-
utf8: 1,
17+
utf8: true,
1818
errorformat: 'html',
1919
errorlang: mw.config.get( 'wgUserLanguage' ),
2020
errorsuselocal: true

src/modules/ante/models/AttributionNotice.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { MediaWikiData, TemplateData, TemplateDataModifier } from './MediaWikiDa
33
import { AttributionNoticePageLayout } from '../ui/pages/AttributionNoticePageLayout';
44
import { AttributionNoticePageGenerator } from '../ui/AttributionNoticePageGenerator';
55
import { CTEParsoidTransclusionTemplateNode } from './CTEParsoidTransclusionTemplateNode';
6+
import MwApi from '../../../MwApi';
67

78
/**
89
* The AttributionNotice abstract class serves as the blueprint for other
@@ -165,13 +166,11 @@ export default abstract class AttributionNotice
165166
* @return {Promise<string>}
166167
*/
167168
async generatePreview() {
168-
return new mw.Api().post( {
169+
return MwApi.action.post( {
169170
action: 'parse',
170-
format: 'json',
171-
formatversion: '2',
172-
utf8: 1,
173171
title: this.parsoid.getPage(),
174172
text: this.toWikitext(),
173+
preview: true,
175174
disableeditsection: true
176175
} ).then( ( data ) => data.parse.text );
177176
}

0 commit comments

Comments
 (0)