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

Method replace

packages/amis-editor-core/src/manager.ts:1249–1276  ·  view source on GitHub ↗

* 给插入面板使用的,替换组件类型。 * @param position

()

Source from the content-addressed store, hash-verified

1247 * @param position
1248 */
1249 async replace() {
1250 const store = this.store;
1251 const subRenderer = store.selectedInsertRendererInfo;
1252
1253 if (!subRenderer) {
1254 return;
1255 }
1256
1257 const id = store.insertOrigId;
1258 let value = subRenderer.scaffold || {
1259 type: subRenderer.type
1260 };
1261 const region = store.insertRegion;
1262
1263 if (subRenderer.scaffoldForm) {
1264 value = await this.scaffold(subRenderer.scaffoldForm, value);
1265 }
1266
1267 if (this.replaceChild(id, value, subRenderer, region)) {
1268 store.closeInsertPanel();
1269
1270 // outline 更新有点延时,而重新生成的时候读取的是outline里面的信息
1271 // 所以需要延时
1272 setTimeout(() => {
1273 this.rebuild();
1274 }, 4);
1275 }
1276 }
1277
1278 /**
1279 * 判断当前元素定位是否为flex容器

Callers 15

fis-conf.jsFile · 0.80
escapeStringFunction · 0.80
identifierFunction · 0.80
collectFilterArgFunction · 0.80
escapeHtmlFunction · 0.80
evaluteMethod · 0.80
scriptMethod · 0.80
fnUPPERMONEYMethod · 0.80
fnSTRIPTAGMethod · 0.80
fnLINEBREAKMethod · 0.80
getFormulaCommentsFunction · 0.80
mainFunction · 0.80

Calls 3

scaffoldMethod · 0.95
replaceChildMethod · 0.95
rebuildMethod · 0.95

Tested by 2

formatStyleObjectFunction · 0.64
formatStyleObjectFunction · 0.64