schlechtenburg/packages/core/lib/components/GlobalInsert.tsx

33 lines
784 B
TypeScript
Raw Normal View History

2021-03-22 19:58:25 +00:00
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>,
}}
/>
: ''
);
},
});