From cd46efb96396becac6dfc50d12913d09a2228363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8B=E7=BE=8A?= Date: Mon, 16 Mar 2020 20:26:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=B7=BB=E5=8A=A0=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor/package.json | 2 +- packages/editor/src/config/components.js | 2 + packages/editor/src/config/skeleton.js | 60 +++++++++++-------- packages/editor/src/plugins/save/index.scss | 3 + packages/editor/src/plugins/save/index.tsx | 20 +++++++ .../src/skeleton/layouts/TopArea/index.scss | 2 +- 6 files changed, 63 insertions(+), 26 deletions(-) create mode 100644 packages/editor/src/plugins/save/index.scss create mode 100644 packages/editor/src/plugins/save/index.tsx diff --git a/packages/editor/package.json b/packages/editor/package.json index 19c333e76..9a5add364 100644 --- a/packages/editor/package.json +++ b/packages/editor/package.json @@ -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", diff --git a/packages/editor/src/config/components.js b/packages/editor/src/config/components.js index 823238113..f5712c6e0 100644 --- a/packages/editor/src/config/components.js +++ b/packages/editor/src/config/components.js @@ -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), diff --git a/packages/editor/src/config/skeleton.js b/packages/editor/src/config/skeleton.js index dbd82404b..e9accff99 100644 --- a/packages/editor/src/config/skeleton.js +++ b/packages/editor/src/config/skeleton.js @@ -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: [ diff --git a/packages/editor/src/plugins/save/index.scss b/packages/editor/src/plugins/save/index.scss new file mode 100644 index 000000000..58e85e384 --- /dev/null +++ b/packages/editor/src/plugins/save/index.scss @@ -0,0 +1,3 @@ +.lowcode-plugin-save { + padding: 10px 4px; +} \ No newline at end of file diff --git a/packages/editor/src/plugins/save/index.tsx b/packages/editor/src/plugins/save/index.tsx new file mode 100644 index 000000000..9d96668e6 --- /dev/null +++ b/packages/editor/src/plugins/save/index.tsx @@ -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 = (props): React.ReactElement => { + const handleClick = (): void => { + console.log('save data:', props.editor.designer.currentDocument.schema); + }; + + return ( +
+ +
+ ); +}; + +export default Save; diff --git a/packages/editor/src/skeleton/layouts/TopArea/index.scss b/packages/editor/src/skeleton/layouts/TopArea/index.scss index a22456894..c0a132f84 100644 --- a/packages/editor/src/skeleton/layouts/TopArea/index.scss +++ b/packages/editor/src/skeleton/layouts/TopArea/index.scss @@ -21,7 +21,7 @@ } .right-area { position: absolute; - right: 12px; + right: 0; top: 0; padding: 0 16px; height: 100%;