Skip to content

Commit 237db7a

Browse files
author
tohosaku
committed
Extract css from array.js
1 parent c730c4b commit 237db7a

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

src/editors/array.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.json-editor-btntype-toggle {
2+
margin: 0 10px 0 0;
3+
}
4+
5+
.je-array-control-btn {
6+
width: 100%;
7+
text-align: left;
8+
margin-bottom: 3px
9+
}

src/editors/array.js

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { AbstractEditor } from '../editor.js'
22
import { extend, trigger } from '../utilities.js'
3+
import rules from './array.css.js'
34

45
export class ArrayEditor extends AbstractEditor {
56
askConfirmation () {
@@ -631,7 +632,6 @@ export class ArrayEditor extends AbstractEditor {
631632
this.collapsed = false
632633
this.toggle_button = this.getButton('', 'collapse', this.translate('button_collapse'))
633634
this.toggle_button.classList.add('json-editor-btntype-toggle')
634-
this.toggle_button.style.margin = '0 10px 0 0'
635635
this.title.insertBefore(this.toggle_button, this.title.childNodes[0])
636636

637637
const rowHolderDisplay = this.row_holder.style.display
@@ -742,17 +742,9 @@ export class ArrayEditor extends AbstractEditor {
742742
this.controls.appendChild(this.remove_all_rows_button)
743743

744744
if (this.tabs) {
745-
this.add_row_button.style.width = '100%'
746-
this.add_row_button.style.textAlign = 'left'
747-
this.add_row_button.style.marginBottom = '3px'
748-
749-
this.delete_last_row_button.style.width = '100%'
750-
this.delete_last_row_button.style.textAlign = 'left'
751-
this.delete_last_row_button.style.marginBottom = '3px'
752-
753-
this.remove_all_rows_button.style.width = '100%'
754-
this.remove_all_rows_button.style.textAlign = 'left'
755-
this.remove_all_rows_button.style.marginBottom = '3px'
745+
this.add_row_button.classList.add('je-array-control-btn')
746+
this.delete_last_row_button.classList.add('je-array-control-btn')
747+
this.remove_all_rows_button.classList.add('je-array-control-btn')
756748
}
757749
}
758750

@@ -788,3 +780,4 @@ export class ArrayEditor extends AbstractEditor {
788780
)
789781
}
790782
}
783+
ArrayEditor.rules = rules

src/editors/table.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,6 @@ export class TableEditor extends ArrayEditor {
415415
this.collapsed = false
416416
this.toggle_button = this.getButton('', 'collapse', this.translate('button_collapse'))
417417
this.toggle_button.classList.add('json-editor-btntype-toggle')
418-
this.toggle_button.style.margin = '0 10px 0 0'
419418
if (this.title_controls) {
420419
this.title.insertBefore(this.toggle_button, this.title.childNodes[0])
421420
this.toggle_button.addEventListener('click', e => {

0 commit comments

Comments
 (0)