Skip to content

Commit b1affa5

Browse files
committed
cleanup references to search and find
1 parent dc11e3d commit b1affa5

File tree

5 files changed

+11
-857
lines changed

5 files changed

+11
-857
lines changed

client/modules/IDE/components/Editor/codemirror.js

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { closeBrackets } from '@codemirror/autocomplete';
99
// import 'codemirror/addon/search/jump-to-line';
1010

1111
import { debounce } from 'lodash';
12+
import { openSearchPanel } from '@codemirror/search';
1213

1314
import {
1415
getFileMode,
@@ -19,9 +20,6 @@ import { useEffectWithComparison } from '../../hooks/custom-hooks';
1920
import tidyCodeWithPrettier from './tidier';
2021

2122
// ----- GENERAL TODOS (in order of priority) -----
22-
// - autocomplete (hinter)
23-
// - p5-javascript
24-
// - search, find & replace
2523
// - color themes
2624
// - any features lost in the p5 conversion git merge
2725
// - javascript color picker (extension works for css but needs to be forked for js)
@@ -194,13 +192,9 @@ export default function useCodeMirror({
194192
return updatedFile;
195193
};
196194

197-
// TODO: Add find and replace functionality.
198-
// const showFind = () => {
199-
// cmInstance.current.execCommand('findPersistent');
200-
// };
201-
// const showReplace = () => {
202-
// cmInstance.current.execCommand('replace');
203-
// };
195+
const showSearch = () => {
196+
openSearchPanel(cmView.current);
197+
};
204198

205199
const tidyCode = () => {
206200
const fileMode = getFileMode(file.name);
@@ -211,8 +205,7 @@ export default function useCodeMirror({
211205
setupCodeMirrorOnContainerMounted,
212206
teardownCodeMirror,
213207
getContent,
214-
tidyCode
215-
// showFind,
216-
// showReplace
208+
tidyCode,
209+
showSearch
217210
};
218211
}

client/modules/IDE/components/Editor/index.jsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,8 @@ function Editor({
8787
teardownCodeMirror,
8888
// cmInstance,
8989
getContent,
90-
tidyCode
91-
// showFind,
92-
// showReplace
90+
tidyCode,
91+
showSearch
9392
} = useCodeMirror({
9493
theme,
9594
lineNumbers,
@@ -115,9 +114,7 @@ function Editor({
115114
provideController({
116115
tidyCode,
117116
getContent,
118-
// TODO: Reimplement these.
119-
showFind: () => {},
120-
showReplace: () => {}
117+
showSearch
121118
});
122119
}, [getContent]);
123120

client/modules/IDE/components/Header/MobileNav.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ const MoreMenu = () => {
420420
<MobileMenuItem onClick={cmRef.current?.tidyCode}>
421421
{t('Nav.Edit.TidyCode')}
422422
</MobileMenuItem>
423-
<MobileMenuItem onClick={cmRef.current?.showFind}>
423+
<MobileMenuItem onClick={cmRef.current?.showSearch}>
424424
{t('Nav.Edit.Find')}
425425
</MobileMenuItem>
426426
<b>{t('Nav.Sketch.Title')}</b>

client/modules/IDE/components/Header/Nav.jsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,6 @@ const ProjectMenu = () => {
162162
shareSketch
163163
} = useSketchActions();
164164

165-
const replaceCommand =
166-
metaKey === 'Ctrl' ? `${metaKeyName}+H` : `${metaKeyName}+⌥+F`;
167165
const newFileCommand =
168166
metaKey === 'Ctrl' ? `${metaKeyName}+Alt+N` : `${metaKeyName}+⌥+N`;
169167

@@ -237,14 +235,10 @@ const ProjectMenu = () => {
237235
{t('Nav.Edit.TidyCode')}
238236
<span className="nav__keyboard-shortcut">{metaKeyName}+Shift+F</span>
239237
</MenubarItem>
240-
<MenubarItem id="edit-find" onClick={cmRef.current?.showFind}>
238+
<MenubarItem id="edit-find" onClick={cmRef.current?.showSearch}>
241239
{t('Nav.Edit.Find')}
242240
<span className="nav__keyboard-shortcut">{metaKeyName}+F</span>
243241
</MenubarItem>
244-
<MenubarItem id="edit-replace" onClick={cmRef.current?.showReplace}>
245-
{t('Nav.Edit.Replace')}
246-
<span className="nav__keyboard-shortcut">{replaceCommand}</span>
247-
</MenubarItem>
248242
</MenubarSubmenu>
249243
<MenubarSubmenu id="sketch" title={t('Nav.Sketch.Title')}>
250244
<MenubarItem

0 commit comments

Comments
 (0)