File tree Expand file tree Collapse file tree 6 files changed +23
-4
lines changed Expand file tree Collapse file tree 6 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ export type PlaygroundProps = {
67
67
sanitizeHtml ?: boolean ;
68
68
prepareRawMarkup ?: boolean ;
69
69
splitModeOrientation ?: 'horizontal' | 'vertical' | false ;
70
+ searchPanel ?: boolean ;
70
71
stickyToolbar ?: boolean ;
71
72
initialSplitModeEnabled ?: boolean ;
72
73
renderPreviewDefined ?: boolean ;
@@ -114,6 +115,7 @@ export const Playground = memo<PlaygroundProps>((props) => {
114
115
sanitizeHtml,
115
116
prepareRawMarkup,
116
117
splitModeOrientation,
118
+ searchPanel,
117
119
stickyToolbar,
118
120
renderPreviewDefined,
119
121
height,
@@ -237,6 +239,7 @@ export const Playground = memo<PlaygroundProps>((props) => {
237
239
parseInsertedUrlAsImage,
238
240
renderPreview,
239
241
splitMode : splitModeOrientation ,
242
+ searchPanel,
240
243
} ,
241
244
} ,
242
245
[
@@ -245,6 +248,7 @@ export const Playground = memo<PlaygroundProps>((props) => {
245
248
linkifyTlds ,
246
249
breaks ,
247
250
splitModeOrientation ,
251
+ searchPanel ,
248
252
renderPreviewDefined ,
249
253
renderPreview ,
250
254
experimental ?. needToSetDimensionsForUploadedImages ,
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ export type PlaygroundMiniProps = Pick<
15
15
| 'sanitizeHtml'
16
16
| 'prepareRawMarkup'
17
17
| 'splitModeOrientation'
18
+ | 'searchPanel'
18
19
| 'stickyToolbar'
19
20
| 'initialSplitModeEnabled'
20
21
| 'renderPreviewDefined'
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ export const args: Meta<PlaygroundMiniProps>['args'] = {
12
12
sanitizeHtml : false ,
13
13
prepareRawMarkup : false ,
14
14
splitModeOrientation : 'horizontal' ,
15
+ searchPanel : true ,
15
16
stickyToolbar : true ,
16
17
initialSplitModeEnabled : false ,
17
18
renderPreviewDefined : true ,
Original file line number Diff line number Diff line change @@ -309,6 +309,7 @@ export class EditorImpl extends SafeEventEmitter<EventMapInt> implements EditorI
309
309
autocompletion : this . #markupConfig. autocompletion ,
310
310
directiveSyntax : this . directiveSyntax ,
311
311
receiver : this ,
312
+ searchPanel : this . #markupConfig. searchPanel ,
312
313
} ) ,
313
314
) ;
314
315
}
Original file line number Diff line number Diff line change @@ -163,6 +163,11 @@ export type MarkdownEditorMarkupConfig = {
163
163
* The function, used to determine if the pasted text is the image url and should be inserted as an image
164
164
*/
165
165
parseInsertedUrlAsImage ?: ParseInsertedUrlAsImage ;
166
+ /**
167
+ * Show search panel in the editor.
168
+ * @default true
169
+ */
170
+ searchPanel ?: boolean ;
166
171
} ;
167
172
168
173
// do not export this type
Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ export type CreateCodemirrorParams = {
88
88
autocompletion ?: Autocompletion ;
89
89
directiveSyntax : DirectiveSyntaxContext ;
90
90
preserveEmptyRows : boolean ;
91
+ searchPanel ?: boolean ;
91
92
} ;
92
93
93
94
export function createCodemirror ( params : CreateCodemirrorParams ) {
@@ -111,6 +112,7 @@ export function createCodemirror(params: CreateCodemirrorParams) {
111
112
parseInsertedUrlAsImage,
112
113
directiveSyntax,
113
114
preserveEmptyRows,
115
+ searchPanel = true ,
114
116
} = params ;
115
117
116
118
const extensions : Extension [ ] = [ gravityTheme , placeholder ( placeholderContent ) ] ;
@@ -268,12 +270,17 @@ export function createCodemirror(params: CreateCodemirrorParams) {
268
270
}
269
271
} ,
270
272
} ) ,
271
- SearchPanelPlugin ( {
272
- anchorSelector : '.g-md-search-anchor' ,
273
- receiver,
274
- } ) ,
275
273
) ;
276
274
275
+ if ( searchPanel ) {
276
+ extensions . push (
277
+ SearchPanelPlugin ( {
278
+ anchorSelector : '.g-md-search-anchor' ,
279
+ receiver,
280
+ } ) ,
281
+ ) ;
282
+ }
283
+
277
284
if ( preserveEmptyRows ) {
278
285
extensions . push (
279
286
keymap . of ( [
You can’t perform that action at this time.
0 commit comments