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

Method _createMoveDownButton

src/editors/array.js:646–673  ·  view source on GitHub ↗
(i, holder)

Source from the content-addressed store, hash-verified

644 }
645
646 _createMoveDownButton (i, holder) {
647 const button = this.getButton('', (this.schema.format === 'tabs-top' ? 'moveright' : 'movedown'), 'button_move_down_title')
648 button.classList.add('movedown', 'json-editor-btntype-move')
649 button.setAttribute('data-i', i)
650 button.addEventListener('click', e => {
651 e.preventDefault()
652 e.stopPropagation()
653 const i = e.currentTarget.getAttribute('data-i') * 1
654
655 const rows = this.getValue()
656 if (i >= rows.length - 1) return
657 const tmp = rows[i + 1]
658 rows[i + 1] = rows[i]
659 rows[i] = tmp
660
661 this.setValue(rows)
662 this.active_tab = this.rows[i + 1].tab
663 this.refreshTabs()
664 this.onChange(true)
665
666 this.jsoneditor.trigger('moveRow', this.rows[i + 1])
667 })
668
669 if (holder) {
670 holder.appendChild(button)
671 }
672 return button
673 }
674
675 _supportDragDrop (tab, useTrigger) {
676 supportDragDrop(tab, (i, j) => {

Callers 1

addRowMethod · 0.95

Calls 7

setValueMethod · 0.95
refreshTabsMethod · 0.95
addMethod · 0.80
triggerMethod · 0.80
getButtonMethod · 0.45
getValueMethod · 0.45
onChangeMethod · 0.45

Tested by

no test coverage detected