|
1 | 1 | import { AbstractEditor } from '../editor.js' |
2 | 2 | import { extend, trigger, hasOwnProperty } from '../utilities.js' |
| 3 | +import rules from './object.css.js' |
3 | 4 |
|
4 | 5 | export class ObjectEditor extends AbstractEditor { |
5 | 6 | constructor (options, defaults, depth) { |
@@ -552,19 +553,18 @@ export class ObjectEditor extends AbstractEditor { |
552 | 553 | this.header.textContent = this.getTitle() |
553 | 554 | } |
554 | 555 | this.title = this.theme.getHeader(this.header) |
| 556 | + this.title.classList.add('je-object__title') |
555 | 557 | this.controls = this.theme.getButtonHolder() |
556 | | - this.controls.style.margin = '0 0 0 10px' |
| 558 | + this.controls.classList.add('je-object__controls') |
557 | 559 |
|
558 | 560 | this.container.appendChild(this.title) |
559 | 561 | this.container.appendChild(this.controls) |
560 | | - this.container.style.position = 'relative' |
| 562 | + this.container.classList.add('je-object__container') |
561 | 563 |
|
562 | 564 | /* Edit JSON modal */ |
563 | 565 | this.editjson_holder = this.theme.getModal() |
564 | 566 | this.editjson_textarea = this.theme.getTextareaInput() |
565 | | - this.editjson_textarea.style.height = '170px' |
566 | | - this.editjson_textarea.style.width = '300px' |
567 | | - this.editjson_textarea.style.display = 'block' |
| 567 | + this.editjson_textarea.classList.add('je-edit-json--textarea') |
568 | 568 | this.editjson_save = this.getButton('Save', 'save', 'Save') |
569 | 569 | this.editjson_save.classList.add('json-editor-btntype-save') |
570 | 570 | this.editjson_save.addEventListener('click', (e) => { |
@@ -594,20 +594,13 @@ export class ObjectEditor extends AbstractEditor { |
594 | 594 | /* Manage Properties modal */ |
595 | 595 | this.addproperty_holder = this.theme.getModal() |
596 | 596 | this.addproperty_list = document.createElement('div') |
597 | | - this.addproperty_list.style.width = '295px' |
598 | | - this.addproperty_list.style.maxHeight = '160px' |
599 | | - this.addproperty_list.style.padding = '5px 0' |
600 | | - this.addproperty_list.style.overflowY = 'auto' |
601 | | - this.addproperty_list.style.overflowX = 'hidden' |
602 | | - this.addproperty_list.style.paddingLeft = '5px' |
603 | | - this.addproperty_list.setAttribute('class', 'property-selector') |
| 597 | + this.addproperty_list.classList.add('property-selector') |
604 | 598 | this.addproperty_add = this.getButton('add', 'add', 'add') |
605 | 599 | this.addproperty_add.classList.add('json-editor-btntype-add') |
| 600 | + |
606 | 601 | this.addproperty_input = this.theme.getFormInputField('text') |
607 | 602 | this.addproperty_input.setAttribute('placeholder', 'Property name...') |
608 | | - this.addproperty_input.style.width = '220px' |
609 | | - this.addproperty_input.style.marginBottom = '0' |
610 | | - this.addproperty_input.style.display = 'inline-block' |
| 603 | + this.addproperty_input.classList.add('property-selector-input') |
611 | 604 | this.addproperty_add.addEventListener('click', (e) => { |
612 | 605 | e.preventDefault() |
613 | 606 | e.stopPropagation() |
@@ -716,7 +709,6 @@ export class ObjectEditor extends AbstractEditor { |
716 | 709 | /* Show/Hide button */ |
717 | 710 | this.collapsed = false |
718 | 711 | this.collapse_control = this.getButton('', 'collapse', this.translate('button_collapse')) |
719 | | - this.collapse_control.style.margin = '0 10px 0 0' |
720 | 712 | this.collapse_control.classList.add('json-editor-btntype-toggle') |
721 | 713 | this.title.insertBefore(this.collapse_control, this.title.childNodes[0]) |
722 | 714 |
|
@@ -1264,3 +1256,5 @@ export class ObjectEditor extends AbstractEditor { |
1264 | 1256 | }) |
1265 | 1257 | } |
1266 | 1258 | } |
| 1259 | + |
| 1260 | +ObjectEditor.rules = rules |
0 commit comments