diff --git a/apps/web/.eslintrc.json b/apps/web/.eslintrc.json index aebdd3b6b..f7eb8d931 100644 --- a/apps/web/.eslintrc.json +++ b/apps/web/.eslintrc.json @@ -16,6 +16,7 @@ "@typescript-eslint/no-unused-vars": "off", "@typescript-eslint/ban-ts-comment": "off", "@typescript-eslint/ban-types": "off", + "@typescript-eslint/no-empty-object-type": "off", "no-console": "off", "react/no-array-index-key": "off", "react-hooks/exhaustive-deps": "off", diff --git a/apps/web/src/components/ui/report/editor-kit.ts b/apps/web/src/components/ui/report/editor-kit.ts index 4db796c1b..6553f59eb 100644 --- a/apps/web/src/components/ui/report/editor-kit.ts +++ b/apps/web/src/components/ui/report/editor-kit.ts @@ -37,11 +37,9 @@ import { TableKit } from './plugins/table-kit'; import { TocKit } from './plugins/toc-kit'; import { ToggleKit } from './plugins/toggle-kit'; import { BusterStreamKit } from './plugins/buster-stream-kit'; -import { GlobalVariableKit } from './plugins/global-variable-kit'; export const EditorKit = [ // Editing - ...GlobalVariableKit, ...SlashKit, ...AutoformatKit, ...CursorOverlayKit, diff --git a/apps/web/src/components/ui/report/plugins/global-variable-kit.tsx b/apps/web/src/components/ui/report/plugins/global-variable-kit.tsx index 1aa3dbca5..e2ae0c2a2 100644 --- a/apps/web/src/components/ui/report/plugins/global-variable-kit.tsx +++ b/apps/web/src/components/ui/report/plugins/global-variable-kit.tsx @@ -18,5 +18,3 @@ export const GlobalVariablePlugin = createPlatePlugin< mode: 'default' } }); - -export const GlobalVariableKit = [GlobalVariablePlugin]; diff --git a/apps/web/src/components/ui/report/useReportEditor.tsx b/apps/web/src/components/ui/report/useReportEditor.tsx index 8b23143a4..e099cfae2 100644 --- a/apps/web/src/components/ui/report/useReportEditor.tsx +++ b/apps/web/src/components/ui/report/useReportEditor.tsx @@ -6,6 +6,7 @@ import { useMemo } from 'react'; import { EditorKit } from './editor-kit'; import { FIXED_TOOLBAR_KIT_KEY } from './plugins/fixed-toolbar-kit'; import { CUSTOM_KEYS } from './config/keys'; +import { GlobalVariablePlugin } from './plugins/global-variable-kit'; export const useReportEditor = ({ value, @@ -24,26 +25,19 @@ export const useReportEditor = ({ filteredKeys.push(FIXED_TOOLBAR_KIT_KEY); } - if (filteredKeys.length > 0) { - return EditorKit.filter((plugin) => !filteredKeys.includes(plugin.key)); - } - - return EditorKit; - }, [useFixedToolbarKit]); - - console.log('mode in useReportEditor', mode); + return [ + ...EditorKit, + GlobalVariablePlugin.configurePlugin(GlobalVariablePlugin, { + options: { + mode + } + }) + ]; + }, []); return usePlateEditor({ plugins, value, - options: { - [CUSTOM_KEYS.globalVariable]: { - mode - }, - swag: { - mode - } - }, readOnly: disabled }); };