()
| 776 | } |
| 777 | |
| 778 | _createDeleteLastRowButton () { |
| 779 | const button = this.getButton('button_delete_last', 'subtract', 'button_delete_last_title', [this.getItemTitle()]) |
| 780 | button.classList.add('json-editor-btntype-deletelast') |
| 781 | button.addEventListener('click', (e) => { |
| 782 | e.preventDefault() |
| 783 | e.stopPropagation() |
| 784 | |
| 785 | if (!this.askConfirmation()) { |
| 786 | return false |
| 787 | } |
| 788 | |
| 789 | const rows = this.getValue() |
| 790 | let newActiveTab = null |
| 791 | |
| 792 | const editorValue = rows.pop() |
| 793 | |
| 794 | this.setValue(rows) |
| 795 | |
| 796 | if (this.rows[this.rows.length - 1]) { |
| 797 | newActiveTab = this.rows[this.rows.length - 1].tab |
| 798 | } |
| 799 | |
| 800 | if (newActiveTab) { |
| 801 | this.active_tab = newActiveTab |
| 802 | this.refreshTabs() |
| 803 | } |
| 804 | |
| 805 | this.onChange(true) |
| 806 | this.jsoneditor.trigger('deleteRow', editorValue) |
| 807 | }) |
| 808 | this.controls.appendChild(button) |
| 809 | return button |
| 810 | } |
| 811 | |
| 812 | _createRemoveAllRowsButton () { |
| 813 | const button = this.getButton('button_delete_all', 'delete', 'button_delete_all_title') |
no test coverage detected