Skip to content

support custom image preview soruce #1353

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

Merged
merged 2 commits into from
Nov 28, 2024
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
6 changes: 5 additions & 1 deletion client/packages/lowcoder/src/comps/comps/imageComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ const ContainerImg = (props: RecordConstructorToView<typeof childrenMap>) => {
src={props.src.value}
referrerPolicy="same-origin"
draggable={false}
preview={props.supportPreview}
preview={props.supportPreview ? {src: props.previewSrc || props.src.value } : false}
fallback={DEFAULT_IMG_URL}
onClick={() => props.onEvent("click")}
/>
Expand All @@ -170,6 +170,7 @@ const childrenMap = {
animationStyle: styleControl(AnimationStyle , 'animationStyle'),
autoHeight: withDefault(AutoHeightControl, "fixed"),
supportPreview: BoolControl,
previewSrc: StringControl,
restrictPaddingOnRotation:withDefault(StringControl, 'image')
};

Expand All @@ -193,6 +194,9 @@ let ImageBasicComp = new UICompBuilder(childrenMap, (props) => {
label: trans("image.supportPreview"),
tooltip: trans("image.supportPreviewTip"),
})}
{children.supportPreview.getView() && children.previewSrc.propertyView({
label: trans("image.previewSrc")
})}
</Section>
)}

Expand Down
3 changes: 2 additions & 1 deletion client/packages/lowcoder/src/i18n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2039,7 +2039,8 @@ export const en = {
"src": "Image Source",
"srcDesc": "The Image Source. Can be an URL, Path or Base64 String. for Example: data:image/png;base64, AAA... CCC",
"supportPreview": "Support Click Preview (zoom)",
"supportPreviewTip": "Effective When the Image Source is Valid"
"supportPreviewTip": "Effective When the Image Source is Valid",
"previewSrc": "Image Preview Source"
},
"progress": {
"value": "Value",
Expand Down
1 change: 1 addition & 0 deletions client/packages/lowcoder/src/i18n/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1563,6 +1563,7 @@ export const zh: typeof en = {
srcDesc: "图片链接地址",
supportPreview: "支持点击预览",
supportPreviewTip: "仅在图片链接有效时生效",
previewSrc: "图片预览链接"
},
progress: {
...en.progress,
Expand Down