| 614 | } |
| 615 | |
| 616 | _createMoveUpButton (i, holder) { |
| 617 | const button = this.getButton('', (this.schema.format === 'tabs-top' ? 'moveleft' : 'moveup'), 'button_move_up_title') |
| 618 | button.classList.add('moveup', 'json-editor-btntype-move') |
| 619 | button.setAttribute('data-i', i) |
| 620 | button.addEventListener('click', e => { |
| 621 | e.preventDefault() |
| 622 | e.stopPropagation() |
| 623 | const i = e.currentTarget.getAttribute('data-i') * 1 |
| 624 | |
| 625 | if (i <= 0) return |
| 626 | const rows = this.getValue() |
| 627 | const tmp = rows[i - 1] |
| 628 | rows[i - 1] = rows[i] |
| 629 | rows[i] = tmp |
| 630 | |
| 631 | this.setValue(rows) |
| 632 | this.active_tab = this.rows[i - 1].tab |
| 633 | this.refreshTabs() |
| 634 | |
| 635 | this.onChange(true) |
| 636 | |
| 637 | this.jsoneditor.trigger('moveRow', this.rows[i - 1]) |
| 638 | }) |
| 639 | |
| 640 | if (holder) { |
| 641 | holder.appendChild(button) |
| 642 | } |
| 643 | return button |
| 644 | } |
| 645 | |
| 646 | _createMoveDownButton (i, holder) { |
| 647 | const button = this.getButton('', (this.schema.format === 'tabs-top' ? 'moveright' : 'movedown'), 'button_move_down_title') |