@@ -3,7 +3,7 @@ import WordpressPlugin from './main';
33import { CommentStatus , PostStatus } from './wp-api' ;
44import { TranslateKey } from './i18n' ;
55import { WpProfileManageModal } from './wp-profile-manage-modal' ;
6- import { MathJaxOutputType } from './plugin-settings' ;
6+ import { CommentConvertMode , MathJaxOutputType } from './plugin-settings' ;
77import { WpProfile } from './wp-profile' ;
88import { setupMarkdownParser } from './utils' ;
99import { AppState } from './app-state' ;
@@ -33,13 +33,25 @@ export class WordpressSettingTab extends PluginSettingTab {
3333 }
3434 }
3535
36+ const getCommentConvertModeDesc = ( type : CommentConvertMode ) : string => {
37+ switch ( type ) {
38+ case CommentConvertMode . Ignore :
39+ return t ( 'settings_commentConvertModeIgnoreDesc' ) ;
40+ case CommentConvertMode . HTML :
41+ return t ( 'settings_commentConvertModeHTMLDesc' ) ;
42+ default :
43+ return '' ;
44+ }
45+ }
46+
3647 const { containerEl } = this ;
3748
3849 containerEl . empty ( ) ;
3950
4051 containerEl . createEl ( 'h1' , { text : t ( 'settings_title' ) } ) ;
4152
4253 let mathJaxOutputTypeDesc = getMathJaxOutputTypeDesc ( this . plugin . settings . mathJaxOutputType ) ;
54+ let commentConvertModeDesc = getCommentConvertModeDesc ( this . plugin . settings . commentConvertMode ) ;
4355
4456 new Setting ( containerEl )
4557 . setName ( t ( 'settings_profiles' ) )
@@ -147,6 +159,28 @@ export class WordpressSettingTab extends PluginSettingTab {
147159 cls : 'setting-item-description'
148160 } ) ;
149161
162+ new Setting ( containerEl )
163+ . setName ( t ( 'settings_commentConvertMode' ) )
164+ . setDesc ( t ( 'settings_commentConvertModeDesc' ) )
165+ . addDropdown ( ( dropdown ) => {
166+ dropdown
167+ . addOption ( CommentConvertMode . Ignore , t ( 'settings_commentConvertModeIgnore' ) )
168+ . addOption ( CommentConvertMode . HTML , t ( 'settings_commentConvertModeHTML' ) )
169+ . setValue ( this . plugin . settings . commentConvertMode )
170+ . onChange ( async ( value ) => {
171+ this . plugin . settings . commentConvertMode = value as CommentConvertMode ;
172+ commentConvertModeDesc = getCommentConvertModeDesc ( this . plugin . settings . commentConvertMode ) ;
173+ await this . plugin . saveSettings ( ) ;
174+ this . display ( ) ;
175+
176+ setupMarkdownParser ( this . plugin . settings ) ;
177+ } ) ;
178+ } ) ;
179+ containerEl . createEl ( 'p' , {
180+ text : commentConvertModeDesc ,
181+ cls : 'setting-item-description'
182+ } ) ;
183+
150184 new Setting ( containerEl )
151185 . setName ( t ( 'settings_enableHtml' ) )
152186 . setDesc ( t ( 'settings_enableHtmlDesc' ) )
@@ -157,7 +191,7 @@ export class WordpressSettingTab extends PluginSettingTab {
157191 this . plugin . settings . enableHtml = value ;
158192 await this . plugin . saveSettings ( ) ;
159193
160- AppState . getInstance ( ) . markdownParser . set ( {
194+ AppState . markdownParser . set ( {
161195 html : this . plugin . settings . enableHtml
162196 } ) ;
163197 } ) ,
0 commit comments