schlechtenburg/packages/core/lib/components/GlobalInsert.tsx
2021-03-22 20:58:25 +01:00

33 lines
784 B
TypeScript

import { defineComponent } from 'vue';
import { TreeNode } from '../types';
import { useBlockTree } from '../use-block-tree';
import { useActivation } from '../use-activation';
import { SbBlockPicker } from './BlockPicker';
import { SbButton } from './Button';
import './GlobalInsert.scss';
export const SbGlobalInsert = defineComponent({
name: 'sb-global-insert',
setup() {
const { blockTree } = useBlockTree();
const {
activate,
activeBlockId,
} = useActivation();
return () => (
blockTree.value
? <SbBlockPicker
class="sb-global-insert"
v-slots={{
default: ({ toggle }: { toggle: Function }) => <SbButton {...{ onClick: toggle }}>+</SbButton>,
}}
/>
: ''
);
},
});