| 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) => { |