MCPcopy Create free account
hub / github.com/json-editor/json-editor / getElementEditor

Method getElementEditor

src/editors/table.js:126–160  ·  view source on GitHub ↗
(i, ignore)

Source from the content-addressed store, hash-verified

124 }
125
126 getElementEditor (i, ignore) {
127 const schemaCopy = extend({}, this.schema.items)
128 const editor = this.jsoneditor.getEditorClass(schemaCopy, this.jsoneditor)
129 const row = this.row_holder.appendChild(this.theme.getTableRow())
130 let holder = row
131 if (!this.item_has_child_editors) {
132 holder = this.theme.getTableCell()
133 row.appendChild(holder)
134 }
135
136 const ret = this.jsoneditor.createEditor(editor, {
137 jsoneditor: this.jsoneditor,
138 schema: schemaCopy,
139 container: holder,
140 path: `${this.path}.${i}`,
141 parent: this,
142 compact: true,
143 table_row: true
144 })
145
146 ret.preBuild()
147 if (!ignore) {
148 ret.build()
149 ret.postBuild()
150
151 ret.controls_cell = row.appendChild(this.theme.getTableCell())
152 ret.row = row
153 ret.table_controls = this.theme.getButtonHolder()
154 ret.controls_cell.appendChild(ret.table_controls)
155 ret.table_controls.style.margin = 0
156 ret.table_controls.style.padding = 0
157 }
158
159 return ret
160 }
161
162 destroy () {
163 this.innerHTML = ''

Callers 2

buildMethod · 0.95
addRowMethod · 0.95

Calls 9

extendFunction · 0.90
getEditorClassMethod · 0.80
createEditorMethod · 0.80
getTableRowMethod · 0.45
getTableCellMethod · 0.45
preBuildMethod · 0.45
buildMethod · 0.45
postBuildMethod · 0.45
getButtonHolderMethod · 0.45

Tested by

no test coverage detected