From 7567678aea50e4441496727f256bc18918a465be Mon Sep 17 00:00:00 2001
From: wibetter <365533093@qq.com>
Date: Thu, 23 Jun 2022 12:19:50 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B1=9E=E6=80=A7=E9=85=8D=E7=BD=AE?=
=?UTF-8?q?=E9=9D=A2=E6=9D=BF=E5=A4=96=E5=B1=82tab=E4=BD=BF=E7=94=A8?=
=?UTF-8?q?=E6=96=B0=E7=89=88icon?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Change-Id: I9a8c301524f4164ee45f5365fa06ecdc8809a243
---
packages/amis-editor-core/scss/_rightPanel.scss | 7 +++++++
.../src/component/Panel/RightPanels.tsx | 17 +++++++++++++----
packages/amis-editor-core/src/plugin.ts | 2 ++
.../src/plugin/BasicToolbar.tsx | 1 -
4 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/packages/amis-editor-core/scss/_rightPanel.scss b/packages/amis-editor-core/scss/_rightPanel.scss
index 10859d574..4f51979ea 100644
--- a/packages/amis-editor-core/scss/_rightPanel.scss
+++ b/packages/amis-editor-core/scss/_rightPanel.scss
@@ -190,6 +190,13 @@ $category-2-height: px2rem(32px);
height: 45px;
color: #151b26;
}
+
+ // 新版icon
+ > svg.pluginIcon {
+ width: 20px;
+ height: 20px;
+ color: #151b26;
+ }
}
}
diff --git a/packages/amis-editor-core/src/component/Panel/RightPanels.tsx b/packages/amis-editor-core/src/component/Panel/RightPanels.tsx
index 9392df230..9e49a11f3 100644
--- a/packages/amis-editor-core/src/component/Panel/RightPanels.tsx
+++ b/packages/amis-editor-core/src/component/Panel/RightPanels.tsx
@@ -1,10 +1,10 @@
import {observer} from 'mobx-react';
import React from 'react';
-import {Icon} from 'amis';
+import {Tab, Tabs, Icon} from 'amis';
+import cx from 'classnames';
import {EditorManager} from '../../manager';
import {EditorStoreType} from '../../store/editor';
-import cx from 'classnames';
-import {Tab, Tabs} from 'amis';
+import {Icon as PluginIcon} from '../../plugin-icons/index';
import {autobind} from '../../util';
import {findDOMNode} from 'react-dom';
import {PanelItem} from '../../plugin';
@@ -144,7 +144,16 @@ export class RightPanels extends React.Component<
editor-tooltip={panel.title}
tooltip-position="left"
>
-
+ {
+ panel.pluginIcon && (
+
+ )
+ }
+ {
+ !panel.pluginIcon && (
+
+ )
+ }
}
className={`editorPanel-tabs-pane ae-Editor-${panel.key}Pane`}
diff --git a/packages/amis-editor-core/src/plugin.ts b/packages/amis-editor-core/src/plugin.ts
index d4dcccfd3..48babd8fb 100644
--- a/packages/amis-editor-core/src/plugin.ts
+++ b/packages/amis-editor-core/src/plugin.ts
@@ -421,6 +421,7 @@ export interface PanelItem {
nodeId?: string;
key: string;
icon: string;
+ pluginIcon?: string; // 新版icon(svg)
title: string | JSX.Element; // 标题
component?: React.ComponentType;
order: number;
@@ -955,6 +956,7 @@ export abstract class BasePlugin implements PluginInterface {
panels.push({
key: 'config',
icon: plugin.panelIcon || plugin.icon || 'fa fa-cog',
+ pluginIcon: plugin.pluginIcon,
title: plugin.panelTitle || '设置',
render: this.manager.makeSchemaFormRender({
definitions: plugin.panelDefinitions,
diff --git a/packages/amis-editor-core/src/plugin/BasicToolbar.tsx b/packages/amis-editor-core/src/plugin/BasicToolbar.tsx
index 2343a581c..76f4bf51d 100644
--- a/packages/amis-editor-core/src/plugin/BasicToolbar.tsx
+++ b/packages/amis-editor-core/src/plugin/BasicToolbar.tsx
@@ -8,7 +8,6 @@ import {
BuildPanelEventContext,
PluginEvent,
InsertEventContext,
- PluginInterface
} from '../plugin';
import {registerEditorPlugin} from '../manager';
import type {MenuItem} from 'amis-ui/lib/components/ContextMenu';