File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,8 @@ export type MarkupConfig = {
118118 disabledExtensions ?: CreateCodemirrorParams [ 'disabledExtensions' ] ;
119119 /** Additional keymaps for codemirror instance */
120120 keymaps ?: CreateCodemirrorParams [ 'keymaps' ] ;
121+ /** Overrides the default placeholder content. */
122+ placeholder ?: CreateCodemirrorParams [ 'placeholder' ] ;
121123 /**
122124 * Additional language data for markdown language in codemirror.
123125 * Can be used to configure additional autocompletions and others.
@@ -300,7 +302,7 @@ export class EditorImpl extends SafeEventEmitter<EventMapInt> implements EditorI
300302 this . #markupEditor = new MarkupEditor (
301303 createCodemirror ( {
302304 doc : this . #markup,
303- placeholderText : i18n ( 'markup_placeholder' ) ,
305+ placeholder : this . #markupConfig . placeholder ?? i18n ( 'markup_placeholder' ) ,
304306 onCancel : ( ) => this . emit ( 'cancel' , null ) ,
305307 onSubmit : ( ) => this . emit ( 'submit' , null ) ,
306308 onChange : ( ) => this . emit ( 'rerender-toolbar' , null ) ,
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ type Autocompletion = Parameters<typeof autocompletion>[0];
4747
4848export type CreateCodemirrorParams = {
4949 doc : EditorViewConfig [ 'doc' ] ;
50- placeholderText : string ;
50+ placeholder : Parameters < typeof placeholder > [ 0 ] ;
5151 onCancel : ( ) => void ;
5252 onSubmit : ( ) => void ;
5353 onChange : ( ) => void ;
@@ -69,22 +69,22 @@ export type CreateCodemirrorParams = {
6969export function createCodemirror ( params : CreateCodemirrorParams ) {
7070 const {
7171 doc,
72- placeholderText,
7372 reactRenderer,
7473 onCancel,
7574 onScroll,
7675 onSubmit,
7776 onChange,
7877 onDocChange,
79- extensions : extraExtensions ,
8078 disabledExtensions = { } ,
8179 keymaps = [ ] ,
8280 receiver,
8381 yfmLangOptions,
82+ extensions : extraExtensions ,
83+ placeholder : placeholderContent ,
8484 autocompletion : autocompletionConfig ,
8585 } = params ;
8686
87- const extensions : Extension [ ] = [ gravityTheme , placeholder ( placeholderText ) ] ;
87+ const extensions : Extension [ ] = [ gravityTheme , placeholder ( placeholderContent ) ] ;
8888
8989 if ( ! disabledExtensions . history ) {
9090 extensions . push ( history ( ) ) ;
You can’t perform that action at this time.
0 commit comments