Skip to content

Commit 4d9d8fa

Browse files
committed
Added animation check to "Image Transform" button
1 parent 652d893 commit 4d9d8fa

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

addons/website/static/src/builder/plugins/image/image_tool_option.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { ImageShapeOption } from "./image_shape_option";
33
import { ImageFilterOption } from "./image_filter_option";
44
import { ImageFormatOption } from "./image_format_option";
55
import { ImageTransformButton } from "./image_transform_button";
6+
import { useDomState } from "@html_builder/core/utils";
67

78
export class ImageToolOption extends BaseOptionComponent {
89
static template = "html_builder.ImageToolOption";
@@ -13,4 +14,10 @@ export class ImageToolOption extends BaseOptionComponent {
1314
ImageTransformButton,
1415
};
1516
static props = {};
17+
setup() {
18+
super.setup();
19+
this.state = useDomState((editingElement) => {
20+
return {isImageAnimated: editingElement.classList.contains("o_animate")};
21+
});
22+
}
1623
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<templates xml:space="preserve">
3+
4+
<t t-name="html_builder.ImageToolOptionAnimateOption" t-inherit="html_builder.ImageToolOption" t-inherit-mode="extension">
5+
<xpath expr="//ImageTransformButton[@id=&quot;'transformImage'&quot;]" position="attributes">
6+
<attribute name="t-if">!this.state.isImageAnimated</attribute>
7+
</xpath>
8+
</t>
9+
10+
</templates>

0 commit comments

Comments
 (0)