* feat: iframe-block plugin done * refactor: iframe html filed type changed * refactor: remove built-in actions in the ACL * refactor: use built-in resource action * fix: add iframe-block in built-in plugins * refactor: remove id collection schema * fix: fix iframe-block permission * fix: fix iframe-block permission * fix: improve code * fix: src * fix: bug Co-authored-by: chenos <chenlinxh@gmail.com>
19 lines
667 B
TypeScript
19 lines
667 B
TypeScript
import { SchemaInitializerContext } from '@nocobase/client';
|
|
import { useContext } from 'react';
|
|
|
|
export const IframeBlockInitializerProvider = (props: any) => {
|
|
const initializes = useContext(SchemaInitializerContext);
|
|
const mediaItem = initializes.BlockInitializers.items.find((item) => item.key === 'media');
|
|
const hasIframeBlockInitializer = mediaItem.children.some(
|
|
(initialize) => initialize.component === 'IframeBlockInitializer',
|
|
);
|
|
!hasIframeBlockInitializer &&
|
|
mediaItem.children.push({
|
|
key: 'iframe',
|
|
type: 'item',
|
|
title: '{{t("Iframe")}}',
|
|
component: 'IframeBlockInitializer',
|
|
});
|
|
return props.children;
|
|
};
|