MCPcopy
hub / github.com/baidu/amis / getConfig

Method getConfig

packages/amis/src/renderers/Form/InputRichText.tsx:149–282  ·  view source on GitHub ↗
(props: RichTextProps)

Source from the content-addressed store, hash-verified

147 }
148
149 getConfig(props: RichTextProps) {
150 const finnalVendor =
151 props.vendor || (props.env.richTextToken ? 'froala' : 'tinymce');
152
153 const imageReceiver = normalizeApi(
154 props.receiver,
155 props.receiver?.method || 'post'
156 );
157 imageReceiver.data = imageReceiver.data || {};
158 const imageApi = buildApi(imageReceiver, props.data, {
159 method: props.receiver.method || 'post'
160 });
161 if (finnalVendor === 'froala') {
162 const videoReceiver = normalizeApi(
163 props.videoReceiver,
164 props.videoReceiver.method || 'post'
165 );
166 videoReceiver.data = videoReceiver.data || {};
167 const videoApi = buildApi(videoReceiver, props.data, {
168 method: props.videoReceiver.method || 'post'
169 });
170 return {
171 imageAllowedTypes: ['jpeg', 'jpg', 'png', 'gif'],
172 imageDefaultAlign: 'left',
173 imageEditButtons: props.imageEditable
174 ? [
175 'imageReplace',
176 'imageAlign',
177 'imageRemove',
178 '|',
179 'imageLink',
180 'linkOpen',
181 'linkEdit',
182 'linkRemove',
183 '-',
184 'imageDisplay',
185 'imageStyle',
186 'imageAlt',
187 'imageSize'
188 ]
189 : [],
190 key: props.env.richTextToken,
191 attribution: false,
192 ...props.options,
193 editorClass: props.editorClass,
194 placeholderText: props.translate(props.placeholder),
195 imageUploadURL: imageApi.url,
196 imageUploadParams: {
197 from: 'rich-text',
198 ...imageApi.data
199 },
200 videoUploadURL: videoApi.url,
201 videoUploadParams: {
202 from: 'rich-text',
203 ...videoApi.data
204 },
205 events: {
206 ...(props.options && props.options.events),

Callers 2

constructorMethod · 0.95
componentDidUpdateMethod · 0.95

Calls 8

normalizeApiFunction · 0.90
buildApiFunction · 0.90
qsstringifyFunction · 0.90
resolveFunction · 0.85
translateMethod · 0.80
forEachMethod · 0.80
fetcherFunction · 0.50
filterMethod · 0.45

Tested by

no test coverage detected