Skip to content

Commit

Permalink
Fix editor in 2024.3 (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya authored Feb 29, 2024
1 parent b63bf93 commit 14631fa
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/patches/hui-view-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,23 @@ customElements.whenDefined("hui-view-editor").then(() => {
firstUpdated?.bind(this)();

this._oldSchema = this._schema;
this._schema = (localize) => {
const retval = this._oldSchema(localize);
this._schema = (...arg) => {
const [_localize, currentType, isNew] = arg;
const retval = this._oldSchema(...arg);
const typeSelector = retval.find((e) => e.name == "type");
if (typeSelector.name === "layout") return retval;
if (
typeSelector.selector.select.options.indexOf(
LAYOUT_CARD_SELECTOR_OPTIONS[0]
) === -1
)
typeSelector.selector.select.options.push(
...LAYOUT_CARD_SELECTOR_OPTIONS
);
!typeSelector.selector.select.options.find(
(option) => option.value === LAYOUT_CARD_SELECTOR_OPTIONS[0].value
)
) {
const options = LAYOUT_CARD_SELECTOR_OPTIONS.map((option) => ({
...option,
disabled: currentType === "sections" && isNew === false,
}));
typeSelector.selector.select.options.push(...options);
}

if (retval.find((e) => e.name === "layout") === undefined)
retval.push({
name: "layout",
Expand Down

0 comments on commit 14631fa

Please sign in to comment.