Merge branch 'master' into pre-release

This commit is contained in:
jiatianqi 2022-09-28 14:47:26 +08:00
commit 2298aaca96
2 changed files with 184 additions and 150 deletions

View File

@ -1,4 +1,4 @@
import {getSchemaTpl} from 'amis-editor-core';
import {BaseEventContext, getSchemaTpl} from 'amis-editor-core';
import {registerEditorPlugin} from 'amis-editor-core';
import {BasePlugin} from 'amis-editor-core';
@ -33,7 +33,11 @@ export class RichTextControlPlugin extends BasePlugin {
};
panelTitle = '富文本';
panelBody = [
panelBodyCreator = (context: BaseEventContext) => {
// 有设置这个就默认使用 froala
const hasRichTextToken = this.manager.env?.richTextToken ? true : false;
return [
getSchemaTpl('switchDefaultValue'),
{
type: 'textarea',
@ -51,7 +55,7 @@ export class RichTextControlPlugin extends BasePlugin {
type: 'select',
name: 'vendor',
label: '编辑器类型',
value: 'tinymce',
value: hasRichTextToken ? 'froala' : 'tinymce',
options: ['tinymce', 'froala']
},
getSchemaTpl('fieldSet', {
@ -161,26 +165,56 @@ export class RichTextControlPlugin extends BasePlugin {
name: 'height'
},
{
type: 'textarea',
name: 'plugins',
label: '启用的插件',
description:
'使用空格分开配置,<a target="_blank" href="https://www.tiny.cloud/docs/general-configuration-guide/basic-setup/">参考文档</a>',
value:
'advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking table emoticons template paste help'
'<a target="_blank" href="https://www.tiny.cloud/docs/general-configuration-guide/basic-setup/">参考文档</a>',
type: 'input-array',
inline: true,
items: {
type: 'input-text',
clearable: true
},
value: [
'advlist',
'autolink',
'link',
'image',
'lists',
'charmap',
'preview',
'anchor',
'pagebreak',
'searchreplace',
'wordcount',
'visualblocks',
'visualchars',
'code',
'fullscreen',
'insertdatetime',
'media',
'nonbreaking',
'table',
'emoticons',
'template',
'help'
]
},
{
type: 'textarea',
name: 'toolbar',
label: '工具栏',
value:
'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media fullpage | forecolor backcolor emoticons | help'
'undo redo | formatselect | bold italic backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | help'
}
]
}
]
})
];
};
}
registerEditorPlugin(RichTextControlPlugin);

View File

@ -428,7 +428,7 @@ setSchemaTpl('apiControl', (patch: any = {}) => {
return {
type: 'ae-apiControl',
label,
name,
name: name || 'api',
description,
labelRemark: sampleBuilder
? {