From 9af8236cdb15180fd9a4a7b4a9c72f913408b2df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Fri, 9 Oct 2026 23:51:32 +0200 Subject: [PATCH] add codemirror edits --- client/components/codeEditor/codeEditor.jsx | 2 + client/homebrew/navbar/navbar.jsx | 39 ++++++++++++------- .../utils/commonEditPageFunctions.jsx | 2 +- 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/client/components/codeEditor/codeEditor.jsx b/client/components/codeEditor/codeEditor.jsx index bda7e3b73..68c560f7b 100644 --- a/client/components/codeEditor/codeEditor.jsx +++ b/client/components/codeEditor/codeEditor.jsx @@ -394,6 +394,8 @@ const CodeEditor = forwardRef( undo : ()=>undo(viewRef.current), redo : ()=>redo(viewRef.current), + + find: () => openSearchPanel(viewRef.current), historySize : ()=>{ const view = viewRef.current; diff --git a/client/homebrew/navbar/navbar.jsx b/client/homebrew/navbar/navbar.jsx index 86a5ab0c2..b524d97f9 100644 --- a/client/homebrew/navbar/navbar.jsx +++ b/client/homebrew/navbar/navbar.jsx @@ -11,12 +11,13 @@ import Account from './account.navitem.jsx'; const { both: RecentNavItem } = RecentNavItems; import Nav from './nav.jsx'; -const Navbar = ({ children, brew, title = '', props }) => { +const Navbar = ({ children, brew, editor, title = '', props }) => { const version = global.version || '0.0.0'; const isMac = navigator.platform.toUpperCase().includes('MAC'); const mod = isMac ? '⌘' : 'Ctrl'; const isBrew = !!brew && brew.shareId; const account = global.account; + console.log(editor); const slots = React.Children.toArray(children).reduce((acc, child) => { if (React.isValidElement(child)) { @@ -83,26 +84,36 @@ const Navbar = ({ children, brew, title = '', props }) => { return ( Edit} icon={null} key={'edit'}>
- {slots.edit} - + {slots.edit?.props.children} + editor?.undo()} kbd={mod + ' + z'} disabled={!isBrew}> Undo - + editor?.redo()} kbd={mod + ' + Shift + z'} disabled={!isBrew}> Redo - - cut - - - copy - - - paste - - + editor?.find()} kbd={mod + ' + f'} disabled={!isBrew}> Find / Replace + editor?.foldCode()} disabled={!isBrew}> + Fold all lines + + editor?.unfoldCode()} disabled={!isBrew}> + Unfold all lines +
+ {/* +
+ editor?.cut()} kbd={mod + ' + x'} disabled={!isBrew}> + cut + + editor?.copy()} kbd={mod + ' + c'} disabled={!isBrew}> + copy + + editor?.paste()} kbd={mod + ' + v'} disabled={!isBrew}> + paste + +
+ */}
); }; diff --git a/client/homebrew/utils/commonEditPageFunctions.jsx b/client/homebrew/utils/commonEditPageFunctions.jsx index b0a7fc171..1f02d5f24 100644 --- a/client/homebrew/utils/commonEditPageFunctions.jsx +++ b/client/homebrew/utils/commonEditPageFunctions.jsx @@ -402,7 +402,7 @@ export default function useCommonEditPageFunctions(dependencies) {
{(pageName == 'editPage') && } - + {error ? () : (Save}>