@@ -17,7 +17,7 @@ import { showMWErrorMessage } from './err_msg';
17
17
*/
18
18
let previewCurrentPanel : vscode . WebviewPanel | undefined ;
19
19
20
- export function getPageViewFactory ( ) {
20
+ export function getPageViewFactory ( ) {
21
21
return async function getPageView ( ) : Promise < void > {
22
22
const config : vscode . WorkspaceConfiguration = vscode . workspace . getConfiguration ( "wikitext" ) ;
23
23
@@ -65,19 +65,20 @@ export function getPreviewFactory(extension: vscode.ExtensionContext) {
65
65
/** document text */
66
66
const sourceText : string | undefined = vscode . window . activeTextEditor ?. document . getText ( ) ;
67
67
if ( ! sourceText ) { return undefined ; }
68
- const { content } = getContentInfo ( sourceText ) ;
68
+ const contentInfo = getContentInfo ( sourceText ) ;
69
69
70
70
/** arguments */
71
- const args : Record < string , string > = {
71
+ const args : Record < string , string | undefined > = {
72
72
'action' : Action . parse ,
73
- 'text' : content ,
73
+ 'text' : contentInfo . content ,
74
+ 'title' : ! ( contentInfo . info ?. pageTitle ) ? undefined : contentInfo . info . pageTitle ,
74
75
'prop' : alterNativeValues (
75
76
Prop . text ,
76
77
Prop . displayTitle ,
77
78
Prop . categoriesHTML ,
78
79
( config . get ( "getCss" ) ? Prop . headHTML : undefined )
79
80
) ,
80
- 'contentmodel' : ContextModel . wikitext ,
81
+ 'contentmodel' : ! ( contentInfo . info ?. contentModel ) ? ContextModel . wikitext : contentInfo . info . contentModel ,
81
82
'pst' : "why_not" ,
82
83
'disableeditsection' : "yes"
83
84
} ;
@@ -117,7 +118,7 @@ export function getPreviewFactory(extension: vscode.ExtensionContext) {
117
118
* @param baseURI url base
118
119
* @returns task
119
120
*/
120
- export async function showViewer ( currentPanel : vscode . WebviewPanel | string , viewerTitle : string , args : Record < string , string > , tBot : MWBot , baseURI : string ) : Promise < void > {
121
+ export async function showViewer ( currentPanel : vscode . WebviewPanel | string , viewerTitle : string , args : Record < string , string | undefined > , tBot : MWBot , baseURI : string ) : Promise < void > {
121
122
const config : vscode . WorkspaceConfiguration = vscode . workspace . getConfiguration ( "wikitext" ) ;
122
123
123
124
const barMessage : vscode . Disposable = vscode . window . setStatusBarMessage ( "Wikitext: Getting view..." ) ;
0 commit comments