For stream deck, I want to create some custom keyboard shortcuts for Bricks Builder that adds the classes like (.bg-dark .bg-light etc) to selected element.
Anyone can help to make below code work
JavaScript Code:
document.addEventListener(‘keydown’, function(event) {
// Check for the desired key combination (e.g., Ctrl + Shift + D)
if (event.ctrlKey && event.shiftKey && event.key === ‘D’) {
// Prevent the default action
event.preventDefault();
// Find the selected element in Bricks Builder
const selectedElement = document.querySelector('.bricks-element-selected');
if (selectedElement) {
// Add the .bgdark class to the selected element
selectedElement.classList.add('bgremove');
} else {
console.log('No element is currently selected.');
}
}
});