File size: 977 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
import type { CellPlugin } from '@react-page/editor';
import React from 'react';
import { defaultSettings } from './default/settings';
import type { ImageSettings } from './types/settings';
import type { ImageState } from './types/state';
const createPlugin = (settings?: ImageSettings): CellPlugin<ImageState> => {
const mergedSettings = { ...defaultSettings, ...settings };
const Controls = mergedSettings.Controls;
return {
controls: {
type: 'custom',
Component: (props) => (
<Controls
{...props}
translations={mergedSettings.translations}
imageUpload={mergedSettings.imageUpload}
/>
),
},
Renderer: mergedSettings.Renderer,
id: 'ory/editor/core/content/image',
version: 1,
icon: mergedSettings.icon,
title: mergedSettings.translations?.pluginName,
isInlineable: true,
description: mergedSettings.translations?.pluginDescription,
};
};
export default createPlugin;
|