MCPcopy Index your code
hub / github.com/json-editor/json-editor / getElementEditor

Method getElementEditor

src/editors/array.js:221–263  ·  view source on GitHub ↗
(i)

Source from the content-addressed store, hash-verified

219 }
220
221 getElementEditor (i) {
222 const itemInfo = this.getItemInfo(i)
223 let schema = this.getItemSchema(i)
224 schema = this.jsoneditor.expandRefs(schema)
225 schema.title = `${itemInfo.title} ${i + 1}`
226
227 const editor = this.jsoneditor.getEditorClass(schema)
228
229 let holder
230 if (this.tabs_holder) {
231 if (this.schema.format === 'tabs-top') {
232 holder = this.theme.getTopTabContent()
233 } else {
234 holder = this.theme.getTabContent()
235 }
236 holder.id = `${this.path}.${i}`
237 } else if (itemInfo.child_editors) {
238 holder = this.theme.getChildEditorHolder()
239 } else {
240 holder = this.theme.getIndentedPanel()
241 }
242
243 this.row_holder.appendChild(holder)
244
245 const ret = this.jsoneditor.createEditor(editor, {
246 jsoneditor: this.jsoneditor,
247 schema,
248 container: holder,
249 path: `${this.path}.${i}`,
250 parent: this,
251 required: true
252 })
253 ret.preBuild()
254 ret.build()
255 ret.postBuild()
256
257 if (!ret.title_controls) {
258 ret.array_controls = this.theme.getButtonHolder()
259 holder.appendChild(ret.array_controls)
260 }
261
262 return ret
263 }
264
265 checkParent (elem) {
266 return elem && elem.parentNode

Callers 1

addRowMethod · 0.95

Calls 13

getItemInfoMethod · 0.95
getItemSchemaMethod · 0.95
expandRefsMethod · 0.80
getEditorClassMethod · 0.80
createEditorMethod · 0.80
getTopTabContentMethod · 0.45
getTabContentMethod · 0.45
getChildEditorHolderMethod · 0.45
getIndentedPanelMethod · 0.45
preBuildMethod · 0.45
buildMethod · 0.45
postBuildMethod · 0.45

Tested by

no test coverage detected