Skip to content

Commit

Permalink
Merge pull request baidu#9467 from CheshireJCat/fix-image-title-limit…
Browse files Browse the repository at this point in the history
…-editor-size-bugs

fix: 图片组件优化:调整预览标题位置;优化上传组件文件提及限制提示;修复编辑器拖拽后修改宽高无效的问题
  • Loading branch information
hsm-lv committed Jan 18, 2024
2 parents 703e0c3 + ce31550 commit e365d1c
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 6 deletions.
14 changes: 13 additions & 1 deletion packages/amis-editor/src/plugin/Form/InputImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,19 @@ export class ImageControlPlugin extends BasePlugin {
getSchemaTpl('switch', {
name: 'limit',
label: '图片限制',
pipeIn: (value: any) => !!value
pipeIn: (value: any) => !!value,
onChange: (
value: any,
oldValue: boolean,
model: any,
form: any
) => {
if (!value) {
form.setValues({
maxSize: undefined
});
}
}
}),

{
Expand Down
22 changes: 20 additions & 2 deletions packages/amis-editor/src/plugin/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,30 @@ export class ImagePlugin extends BasePlugin {
{
name: 'width',
label: '宽度',
type: 'input-number'
type: 'input-number',
onChange: (value: any) => {
const node = context.node;
node.updateState({
width: value
});
requestAnimationFrame(() => {
node.calculateHighlightBox();
});
}
},
{
name: 'height',
label: '高度',
type: 'input-number'
type: 'input-number',
onChange: (value: any) => {
const node = context.node;
node.updateState({
height: value
});
requestAnimationFrame(() => {
node.calculateHighlightBox();
});
}
},

isUnderField
Expand Down
6 changes: 4 additions & 2 deletions packages/amis-ui/scss/components/_image-gallery.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
border: none;
border-radius: 0;
max-width: 1010px !important;
padding-top: 0;

&-close {
position: absolute;
Expand All @@ -36,12 +37,13 @@
}

&-title {
height: px2rem(30px);
height: px2rem(18px);
vertical-align: top;
line-height: px2rem(30px);
line-height: px2rem(18px);
font-size: px2rem(12px);
color: var(--white);
text-align: center;
margin-bottom: 18px;
}

&-main {
Expand Down
1 change: 0 additions & 1 deletion packages/amis/src/renderers/Form/InputImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1671,7 +1671,6 @@ export default class ImageControl extends React.Component<
accept={accept}
multiple={dropMultiple}
disabled={disabled}
maxSize={crop ? undefined : maxSize}
>
{({
getRootProps,
Expand Down

0 comments on commit e365d1c

Please sign in to comment.