Skip to content

Commit 1e19033

Browse files
committed
Add find-and-replace plugin to plugins README and d.ts
1 parent 1d1203f commit 1e19033

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

code-input.d.ts

+19
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,25 @@ export namespace plugins {
123123
constructor(delayMs: number);
124124
}
125125

126+
/**
127+
* Add Find-and-Replace (Ctrl+F for find, Ctrl+H for replace by default) functionality to the code editor.
128+
* Files: find-and-replace.js / find-and-replace.css
129+
*/
130+
class FindAndReplace extends Plugin {
131+
/**
132+
* Create a find-and-replace command plugin to pass into a template
133+
* @param {boolean} useCtrlF Should Ctrl+F be overriden for find-and-replace find functionality? If not, you can trigger it yourself using (instance of this plugin)`.showPrompt(code-input element, false)`.
134+
* @param {boolean} useCtrlH Should Ctrl+H be overriden for find-and-replace replace functionality? If not, you can trigger it yourself using (instance of this plugin)`.showPrompt(code-input element, true)`.
135+
*/
136+
constructor(useCtrlF?: boolean, useCtrlH?: boolean);
137+
/**
138+
* Show a find-and-replace dialog.
139+
* @param {codeInput.CodeInput} codeInputElement the `<code-input>` element.
140+
* @param {boolean} replacePartExpanded whether the replace part of the find-and-replace dialog should be expanded
141+
*/
142+
showPrompt(codeInput: CodeInput, replacePartExpanded: boolean): void;
143+
}
144+
126145
/**
127146
* Add basic Go-To-Line (ctrl-G by default) functionality to the code editor.
128147
* Files: go-to-line.js / go-to-line.css

plugins/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ Files: [autodetect.js](./autodetect.js)
2929

3030
[🚀 *CodePen Demo*](https://codepen.io/WebCoder49/pen/eYLyMae)
3131

32+
### Find and Replace
33+
Add Find-and-Replace (Ctrl+F for find, Ctrl+H for replace by default, or when JavaScript triggers it) functionality to the code editor.
34+
35+
Files: [find-and-replace.js](./find-and-replace.js) / [find-and-replace.css](./find-and-replace.css)
36+
37+
[🚀 *CodePen Demo*](https://codepen.io/WebCoder49/pen/oNVVBBz)
38+
3239
### Go To Line
3340
Add a feature to go to a specific line when a line number is given (or column as well, in the format line no:column no) that appears when (optionally) Ctrl+G is pressed or when JavaScript triggers it.
3441

plugins/find-and-replace.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Add basic Find-and-Replace (Ctrl+F for find, Ctrl+H for by default) functionality to the code editor.
2+
* Add Find-and-Replace (Ctrl+F for find, Ctrl+H for replace by default) functionality to the code editor.
33
* Files: find-and-replace.js / find-and-replace.css
44
*/
55
codeInput.plugins.FindAndReplace = class extends codeInput.Plugin {

0 commit comments

Comments
 (0)