From 22b5828b3d9647ca85b7cd370fab1ad877dfe4f6 Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Thu, 18 Jan 2024 12:52:59 +0000 Subject: [PATCH] Move Writefull toolbar loading/initialisation into a React component (#16546) GitOrigin-RevId: 1cb6efa7cab2babb33800fef9469fca3addbdaf5 --- services/web/config/settings.defaults.js | 1 + .../source-editor/components/codemirror-editor.tsx | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/services/web/config/settings.defaults.js b/services/web/config/settings.defaults.js index ffd23cea7a..15168f4ebb 100644 --- a/services/web/config/settings.defaults.js +++ b/services/web/config/settings.defaults.js @@ -862,6 +862,7 @@ module.exports = { sourceEditorComponents: [], sourceEditorCompletionSources: [], sourceEditorSymbolPalette: [], + sourceEditorToolbarComponents: [], writefullEditorPromotion: [], langFeedbackLinkingWidgets: [], integrationLinkingWidgets: [], diff --git a/services/web/frontend/js/features/source-editor/components/codemirror-editor.tsx b/services/web/frontend/js/features/source-editor/components/codemirror-editor.tsx index dc4967723d..f58396f040 100644 --- a/services/web/frontend/js/features/source-editor/components/codemirror-editor.tsx +++ b/services/web/frontend/js/features/source-editor/components/codemirror-editor.tsx @@ -24,6 +24,10 @@ const sourceEditorComponents = importOverleafModules( 'sourceEditorComponents' ) as { import: { default: ElementType }; path: string }[] +const sourceEditorToolbarComponents = importOverleafModules( + 'sourceEditorToolbarComponents' +) as { import: { default: ElementType }; path: string }[] + function CodeMirrorEditor() { // create the initial state const [state, setState] = useState(() => { @@ -59,6 +63,11 @@ function CodeMirrorEditor() { + {sourceEditorToolbarComponents.map( + ({ import: { default: Component }, path }) => ( + + ) + )} {sourceEditorComponents.map(