Skip to content

Commit a27eb6b

Browse files
committed
fix keyboard textarea selection
1 parent 4700bf2 commit a27eb6b

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

packages/project-editor/lvgl/widgets/Keyboard.tsx

+24-14
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,30 @@ export class LVGLKeyboardWidget extends LVGLWidget {
4747
name: "textarea",
4848
type: PropertyType.Enum,
4949
enumItems: (widget: LVGLKeyboardWidget) => {
50-
const page = getAncestorOfType(
51-
widget,
52-
ProjectEditor.PageClass.classInfo
53-
) as Page;
54-
return page._lvglWidgets
55-
.filter(
56-
lvglWidget =>
57-
lvglWidget instanceof LVGLTextareaWidget &&
58-
lvglWidget.identifier
59-
)
60-
.map(lvglWidget => ({
61-
id: lvglWidget.identifier,
62-
label: lvglWidget.identifier
63-
}));
50+
let lvglIdentifiers = ProjectEditor.getProjectStore(
51+
widget
52+
).lvglIdentifiers.getIdentifiersVisibleFromFlow(
53+
ProjectEditor.getFlow(widget)
54+
);
55+
56+
lvglIdentifiers = lvglIdentifiers.filter(lvglIdentifier => {
57+
if (lvglIdentifier.widgets.length > 1) {
58+
return false;
59+
}
60+
61+
const widget = lvglIdentifier.widgets[0];
62+
63+
return widget instanceof LVGLTextareaWidget;
64+
});
65+
66+
lvglIdentifiers.sort((a, b) =>
67+
a.identifier.localeCompare(b.identifier)
68+
);
69+
70+
return lvglIdentifiers.map(lvglIdentifier => ({
71+
id: lvglIdentifier.identifier,
72+
label: lvglIdentifier.identifier
73+
}));
6474
},
6575
propertyGridGroup: specificGroup
6676
},

0 commit comments

Comments
 (0)