mirror of https://github.com/buster-so/buster.git
add global vars
This commit is contained in:
parent
70780a3773
commit
40454d2519
|
@ -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",
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -18,5 +18,3 @@ export const GlobalVariablePlugin = createPlatePlugin<
|
|||
mode: 'default'
|
||||
}
|
||||
});
|
||||
|
||||
export const GlobalVariableKit = [GlobalVariablePlugin];
|
||||
|
|
|
@ -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
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue