import { Plugin } from '@chamaeleon/core';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
// we declare our function that will return the plugin
export function Root(): Plugin {
return {
// unique plugin name
name: 'root',
// apply method is called when the plugin is applied
//
// editor - this is the Editor Instance
//
// methods - is a set of methods for adding blocks,
// various components for changing parameters, etc.
apply(editor, methods) {
// addBlock accepts our block specification
methods.addBlock({
// unique block name
name: 'root',
// allowContent configures what blocks our block can have
// name: ['*', '!root'] - indicates that
// this block can have all blocks except itself in its children
allowContent: {
name: ['*', '!root'],
},
// a set of components for displaying a block in different states
components: {
// view - to display the block in view mode
view: ({ children }) => {
return children;
},
// editor - to display the block in edit mode
editor: ({ children }) => {
return children;
},
// palette - is the component view when
// selecting components to add a new block
palette: () => {
return <Typography>Root</Typography>;
},
},
});
},
};
}