Skip to content

Commit

Permalink
Applying fix for StructEditor #265
Browse files Browse the repository at this point in the history
  • Loading branch information
mrzapp committed Mar 4, 2019
1 parent bf69ca6 commit f2579e9
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 124 deletions.
200 changes: 98 additions & 102 deletions public/js/views.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/js/views.js.map

Large diffs are not rendered by default.

9 changes: 2 additions & 7 deletions src/Client/Views/Editors/ContentEditor.js
Expand Up @@ -265,7 +265,8 @@ class ContentEditor extends Crisp.View {
description: fieldDefinition.description || '',
schema: compiledSchema.getObject(),
multilingual: fieldDefinition.multilingual === true,
$keyActions: $keyActions
$keyActions: $keyActions,
className: 'editor__field__value'
});

fieldEditorInstance.on('change', (newValue) => {
Expand All @@ -282,12 +283,6 @@ class ContentEditor extends Crisp.View {
onChange(newValue);
});

fieldEditorInstance.element.classList.toggle('editor__field__value', true);

fieldEditorInstance.on('ready', () => {
fieldEditorInstance.element.classList.toggle('editor__field__value', true);
});

return fieldEditorInstance.$element;
}

Expand Down
10 changes: 2 additions & 8 deletions src/Client/Views/Editors/FieldEditors/ArrayEditor.js
Expand Up @@ -264,14 +264,8 @@ class ArrayEditor extends HashBrown.Views.Editors.FieldEditors.FieldEditor {
let editorInstance = new editorClass({
value: item.value,
config: schema.config,
schema: schema
});

// Assign the "value" class name to the field editor
editorInstance.element.classList.toggle('editor__field__value', true);

editorInstance.on('ready', () => {
editorInstance.element.classList.toggle('editor__field__value', true);
schema: schema,
className: 'editor__field__value'
});

// Hook up the change event
Expand Down
14 changes: 9 additions & 5 deletions src/Client/Views/Editors/FieldEditors/FieldEditor.js
Expand Up @@ -28,11 +28,15 @@ class FieldEditor extends Crisp.View {
* Post render
*/
postrender() {
if(!this.$keyActions) { return; }

_.append(this.$keyActions.empty(),
this.renderKeyActions()
);
if(this.className) {
this.element.classList.toggle(this.className, true);
}

if(this.$keyActions) {
_.append(this.$keyActions.empty(),
this.renderKeyActions()
);
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/Client/Views/Editors/FieldEditors/StructEditor.js
Expand Up @@ -358,7 +358,8 @@ class StructEditor extends HashBrown.Views.Editors.FieldEditors.FieldEditor {
value: keySchema.multilingual ? value[window.language] : value,
disabled: keySchema.disabled || false,
config: keySchema.config || fieldSchema.config || {},
schema: keySchema
schema: keySchema,
className: 'editor__field__value'
});

// Hook up the change event
Expand Down

0 comments on commit f2579e9

Please sign in to comment.