feat:添加保存插件

This commit is contained in:
下羊 2020-03-16 20:26:33 +08:00
parent 69e9c981a2
commit cd46efb963
6 changed files with 63 additions and 26 deletions

View File

@ -23,7 +23,7 @@
"store": "^2.0.12"
},
"devDependencies": {
"@ice/spec": "^0.1.1",
"@ice/spec": "^1.0.1",
"@types/debug": "^4.1.5",
"@types/events": "^3.0.0",
"@types/react": "^16.8.3",

View File

@ -13,11 +13,13 @@ import Settings from '../../../plugin-settings';
import undoRedo from '../plugins/undoRedo';
import Designer from '../plugins/designer';
import logo from '../plugins/logo';
import save from '../plugins/save';
import PluginFactory from '../framework/pluginFactory';
export default {
logo: PluginFactory(logo),
save: PluginFactory(save),
designer: PluginFactory(Designer),
settings: PluginFactory(Settings),
undoRedo: PluginFactory(undoRedo),

View File

@ -69,6 +69,35 @@ export default {
},
pluginProps: {}
},
{
pluginKey: 'topLinkIcon',
type: 'LinkIcon',
props: {
align: 'left',
title: 'link',
icon: 'dengpao',
linkProps: {
href: '//www.taobao.com',
target: 'blank'
}
},
config: {},
pluginProps: {}
},
{
pluginKey: 'topIcon',
type: 'Icon',
props: {
align: 'left',
title: 'icon',
icon: 'dengpao',
onClick(editor) {
alert(`icon addon invoke, current activeKey: ${editor.activeKey}`);
}
},
config: {},
pluginProps: {}
},
{
pluginKey: 'undoRedo',
type: 'Custom',
@ -89,33 +118,16 @@ export default {
}
},
{
pluginKey: 'topLinkIcon',
type: 'LinkIcon',
pluginKey: 'save',
type: 'Custom',
props: {
align: 'right',
title: 'link',
icon: 'dengpao',
linkProps: {
href: '//www.taobao.com',
target: 'blank'
}
width: 64
},
config: {},
pluginProps: {}
},
{
pluginKey: 'topIcon',
type: 'Icon',
props: {
align: 'right',
title: 'icon',
icon: 'dengpao',
onClick(editor) {
alert(`icon addon invoke, current activeKey: ${editor.activeKey}`);
}
},
config: {},
pluginProps: {}
config: {
package: '@ali/lowcode-plugin-save',
version: '1.0.0'
}
}
],
leftArea: [

View File

@ -0,0 +1,3 @@
.lowcode-plugin-save {
padding: 10px 4px;
}

View File

@ -0,0 +1,20 @@
import React from 'react';
import {Button} from '@alifd/next';
import './index.scss';
import { PluginProps } from '../../framework/definitions';
const Save: React.FC<PluginProps> = (props): React.ReactElement => {
const handleClick = (): void => {
console.log('save data:', props.editor.designer.currentDocument.schema);
};
return (
<div className="lowcode-plugin-save">
<Button type="primary" onClick={handleClick}></Button>
</div>
);
};
export default Save;

View File

@ -21,7 +21,7 @@
}
.right-area {
position: absolute;
right: 12px;
right: 0;
top: 0;
padding: 0 16px;
height: 100%;