Skip to content

Commit

Permalink
Add find-and-replace plugin to plugins README and d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
WebCoder49 committed Feb 18, 2024
1 parent 1d1203f commit 1e19033
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
19 changes: 19 additions & 0 deletions code-input.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,25 @@ export namespace plugins {
constructor(delayMs: number);
}

/**
* Add Find-and-Replace (Ctrl+F for find, Ctrl+H for replace by default) functionality to the code editor.
* Files: find-and-replace.js / find-and-replace.css
*/
class FindAndReplace extends Plugin {
/**
* Create a find-and-replace command plugin to pass into a template
* @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)`.
* @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)`.
*/
constructor(useCtrlF?: boolean, useCtrlH?: boolean);
/**
* Show a find-and-replace dialog.
* @param {codeInput.CodeInput} codeInputElement the `<code-input>` element.
* @param {boolean} replacePartExpanded whether the replace part of the find-and-replace dialog should be expanded
*/
showPrompt(codeInput: CodeInput, replacePartExpanded: boolean): void;
}

/**
* Add basic Go-To-Line (ctrl-G by default) functionality to the code editor.
* Files: go-to-line.js / go-to-line.css
Expand Down
7 changes: 7 additions & 0 deletions plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ Files: [autodetect.js](./autodetect.js)

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

### Find and Replace
Add Find-and-Replace (Ctrl+F for find, Ctrl+H for replace by default, or when JavaScript triggers it) functionality to the code editor.

Files: [find-and-replace.js](./find-and-replace.js) / [find-and-replace.css](./find-and-replace.css)

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

### Go To Line
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.

Expand Down
2 changes: 1 addition & 1 deletion plugins/find-and-replace.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Add basic Find-and-Replace (Ctrl+F for find, Ctrl+H for by default) functionality to the code editor.
* Add Find-and-Replace (Ctrl+F for find, Ctrl+H for replace by default) functionality to the code editor.
* Files: find-and-replace.js / find-and-replace.css
*/
codeInput.plugins.FindAndReplace = class extends codeInput.Plugin {
Expand Down

0 comments on commit 1e19033

Please sign in to comment.