FEATURE: Support collapsing array sections in JSON Schema field types (#20118)

This allows users to collapse array-type data tables in JSON Schema
fields. Note that this data type is currently only used in themes and
plugins.
This commit is contained in:
Penar Musaraj 2023-02-07 08:22:01 -05:00 committed by GitHub
parent b89df3ca9d
commit d29dc087b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 6 deletions

View File

@ -34,7 +34,7 @@ export default Component.extend({
enable_array_copy: true,
disable_edit_json: true,
disable_properties: true,
disable_collapse: true,
disable_collapse: false,
remove_button_labels: true,
show_errors: "never",
startval: this.model.value ? JSON.parse(this.model.value) : null,
@ -77,6 +77,8 @@ class DiscourseJsonSchemaEditorIconlib {
moveup: "arrow-up",
movedown: "arrow-down",
copy: "copy",
collapse: "chevron-down",
expand: "chevron-up",
};
}

View File

@ -98,10 +98,25 @@
.row div[data-schematype="array"] {
padding: 0.5em;
background-color: var(--primary-very-low);
> .card-title {
width: 100%;
border-bottom: 1px solid var(--primary-low);
> .json-editor-btn-collapse {
float: right;
}
}
}
.desktop-view & .modal-inner-container {
--modal-max-width: 75vw;
min-width: 55vw;
}
.card-title.level-1,
.card-title.je-object__title {
> .json-editor-btn-collapse {
display: none;
}
}
}

View File

@ -760,3 +760,14 @@
top: 21px;
}
}
.json-editor-btn-delete {
@extend .btn-danger;
@extend .no-text;
}
.json-editor-btn-collapse {
@extend .no-text;
@extend .btn-flat;
@extend .btn-small;
}

View File

@ -123,8 +123,3 @@
max-width: 100vw; // prevent overflow if user font-size is enormous
}
}
.json-editor-btn-delete {
@extend .btn-danger !optional;
@extend .no-text !optional;
}