Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#115-make combobox editable inline #141

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/common/components/front-components/combobox-shape.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const getComboBoxShapeSizeRestrictions = (): ShapeSizeRestrictions =>
comboBoxShapeRestrictions;

export const ComboBoxShape = forwardRef<any, ShapeProps>(
({ x, y, width, height, id, onSelected, ...shapeProps }, ref) => {
({ x, y, width, height, id, onSelected, text, ...shapeProps }, ref) => {
const { width: restrictedWidth, height: restrictedHeight } =
fitSizeToShapeSizeRestrictions(comboBoxShapeRestrictions, width, height);

Expand Down Expand Up @@ -53,7 +53,7 @@ export const ComboBoxShape = forwardRef<any, ShapeProps>(
<Text
x={10}
y={(height - 25) / 2 + 5}
text="Select an option"
text={text}
fontSize={20}
fontFamily="Arial"
fill="black"
Expand Down
3 changes: 3 additions & 0 deletions src/pods/canvas/canvas.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ const doesShapeAllowInlineEdition = (shapeType: ShapeType): boolean => {
switch (shapeType) {
case 'input':
case 'label':
case 'combobox':
case 'button':
return true;
default:
Expand All @@ -110,6 +111,8 @@ const generateDefaultTextValue = (shapeType: ShapeType): string | undefined => {
return '';
case 'label':
return 'Label';
case 'combobox':
return 'Select an option';
case 'button':
return 'Click Me!';
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export const renderComboBox = (
onDragEnd={handleDragEnd(shape.id)}
onTransform={handleTransform}
onTransformEnd={handleTransform}
isEditable={shape.allowsInlineEdition}
text={shape.text}
/>
);
};
Loading