summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web_editor/static/src')
-rw-r--r--addons/web_editor/static/src/js/editor/snippets.options.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js
index 4a465ffe3df..435e6f8beb1 100644
--- a/addons/web_editor/static/src/js/editor/snippets.options.js
+++ b/addons/web_editor/static/src/js/editor/snippets.options.js
@@ -1565,7 +1565,18 @@ const SnippetOptionWidget = Widget.extend({
updateUIVisibility: async function () {
const proms = this._userValueWidgets.map(async widget => {
const params = widget.getMethodsParams();
- const show = await this._computeWidgetVisibility(widget.getName(), params);
+
+ let obj = this;
+ if (params.applyTo) {
+ const $firstSubTarget = this.$(params.applyTo).eq(0);
+ if (!$firstSubTarget.length) {
+ widget.toggleVisibility(false);
+ return;
+ }
+ obj = createPropertyProxy(this, '$target', $firstSubTarget);
+ }
+
+ const show = await this._computeWidgetVisibility.call(obj, widget.getName(), params);
if (!show) {
widget.toggleVisibility(false);
return;