Replies: 1 comment
-
I guess you could do something similar by relying on editor.on('styleable:change', (model, property) => {
if (property === 'background') {
const bgProperty = editor.StyleManager.getProperty('decorations', 'background');
const layersLen = bgProperty?.getLayers().length;
const addEl = document.querySelector('.gjs-sm-property__background [data-add-layer]');
if (addEl) {
addEl.style.display = layersLen > 0 ? 'none' : '';
}
}
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I'm trying to modify the behavior of how the background image property under Decorations works. Specifically, I want to make it so that the user can only add one background image rather than multiple layers. As I can't modify the preset behavior directly, I've been trying to get the add button (#gjs-sm-add) by it's ID and then use an event listener to set the display to 'none' when it is clicked. However, this doesn't seem to be working - would anyone be able to help me?
Here is my code snippet:
Beta Was this translation helpful? Give feedback.
All reactions