From c25a29700ee4b1a29a422c90f4da465687553882 Mon Sep 17 00:00:00 2001 From: wangyuzhen01 Date: Sun, 29 Jan 2023 09:33:02 +0800 Subject: [PATCH] =?UTF-8?q?amis-saas-8146=201.=20=E5=AD=90=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=20subEditor=20=E4=B8=8D=E5=86=8D=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E8=AE=BE=E7=BD=AE=20editorStore;=202.=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=20ListItem=20=E5=92=8C=20ButtonToolbar=20=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I724fcd3569afc57a8fbf010a1a366c998ce1aeeb --- .../src/plugin/Form/ButtonToolbar.tsx | 3 +- packages/amis-editor/src/plugin/ListItem.tsx | 129 +++++++----------- 2 files changed, 52 insertions(+), 80 deletions(-) diff --git a/packages/amis-editor/src/plugin/Form/ButtonToolbar.tsx b/packages/amis-editor/src/plugin/Form/ButtonToolbar.tsx index c06449628..e9b5d64ff 100644 --- a/packages/amis-editor/src/plugin/Form/ButtonToolbar.tsx +++ b/packages/amis-editor/src/plugin/Form/ButtonToolbar.tsx @@ -1,4 +1,4 @@ -import {registerEditorPlugin} from 'amis-editor-core'; +import {registerEditorPlugin, translateSchema} from 'amis-editor-core'; import {BasePlugin, RegionConfig, BaseEventContext} from 'amis-editor-core'; import {getSchemaTpl} from 'amis-editor-core'; @@ -85,6 +85,7 @@ export class ButtonToolbarControlPlugin extends BasePlugin { minLength: 1, draggable: true, editable: false, + pipeIn: (value: any) => translateSchema(value), items: [ { type: 'tpl', diff --git a/packages/amis-editor/src/plugin/ListItem.tsx b/packages/amis-editor/src/plugin/ListItem.tsx index 3c2495857..a39a94fae 100644 --- a/packages/amis-editor/src/plugin/ListItem.tsx +++ b/packages/amis-editor/src/plugin/ListItem.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import {registerEditorPlugin} from 'amis-editor-core'; +import {getI18nEnabled, registerEditorPlugin} from 'amis-editor-core'; import { BaseEventContext, BasePlugin, @@ -37,84 +37,55 @@ export class ListItemPlugin extends BasePlugin { ]; panelTitle = '列表项'; - panelBody = getSchemaTpl('tabs', [ - { - title: '基本', - body: [ - // { - // children: ( - // - // ) - // }, - // { - // children: ( - //
- // - //
- // ) - // }, - // { - // type: 'divider' - // }, - getSchemaTpl('layout:originPosition', {value: 'left-top'}), - { - name: 'title', - type: 'input-text', - label: '标题', - descrition: '支持模板语法如: ${xxx}' - }, - { - name: 'subTitle', - type: 'input-text', - label: '副标题', - descrition: '支持模板语法如: ${xxx}' - }, - { - name: 'avatar', - type: 'input-text', - label: '图片地址', - descrition: '支持模板语法如: ${xxx}' - }, - { - name: 'desc', - type: 'textarea', - label: '描述', - descrition: '支持模板语法如: ${xxx}' - } - ] - }, - { - title: '外观', - body: [ - getSchemaTpl('className', { - name: 'avatarClassName', - label: '图片 CSS 类名', - pipeIn: defaultValue('thumb-sm avatar m-r') - }), - getSchemaTpl('className', { - name: 'titleClassName', - label: '标题 CSS 类名' - }) - ] - } - ]); + panelBodyCreator = (context: BaseEventContext) => { + const i18nEnabled = getI18nEnabled(); + return getSchemaTpl('tabs', [ + { + title: '基本', + body: [ + getSchemaTpl('layout:originPosition', {value: 'left-top'}), + { + name: 'title', + type: i18nEnabled ? 'input-text-i18n' : 'input-text', + label: '标题', + descrition: '支持模板语法如: ${xxx}' + }, + { + name: 'subTitle', + type: i18nEnabled ? 'input-text-i18n' : 'input-text', + label: '副标题', + descrition: '支持模板语法如: ${xxx}' + }, + { + name: 'avatar', + type: 'input-text', + label: '图片地址', + descrition: '支持模板语法如: ${xxx}' + }, + { + name: 'desc', + type: i18nEnabled ? 'textarea-i18n' : 'textarea', + label: '描述', + descrition: '支持模板语法如: ${xxx}' + } + ] + }, + { + title: '外观', + body: [ + getSchemaTpl('className', { + name: 'avatarClassName', + label: '图片 CSS 类名', + pipeIn: defaultValue('thumb-sm avatar m-r') + }), + getSchemaTpl('className', { + name: 'titleClassName', + label: '标题 CSS 类名' + }) + ] + } + ]) + }; getRendererInfo({ renderer,