fix(actions): scope safe adapters to the active Vendoo workspace
This commit is contained in:
@@ -21,6 +21,11 @@
|
||||
return !style || (style.display !== 'none' && style.visibility !== 'hidden');
|
||||
}
|
||||
|
||||
function workspaceVisible(view, sectionId = view) {
|
||||
const current = window.VendooNavigation?.currentView;
|
||||
return (!current || current === view) && sectionVisible(sectionId);
|
||||
}
|
||||
|
||||
const find = selector => {
|
||||
const element = document.querySelector(selector);
|
||||
return usable(element) ? element : null;
|
||||
@@ -77,9 +82,9 @@
|
||||
const actions = window.VendooActions;
|
||||
if (!actions || root.dataset.uxSafeActionAdaptersRegistered === '1') return false;
|
||||
|
||||
const moduleVisible = () => sectionVisible('admin-modules-panel');
|
||||
const articleVisible = () => sectionVisible('history');
|
||||
const mediaVisible = () => sectionVisible('media-library');
|
||||
const moduleVisible = () => workspaceVisible('admin', 'admin-modules-panel');
|
||||
const articleVisible = () => workspaceVisible('history');
|
||||
const mediaVisible = () => workspaceVisible('media-library');
|
||||
|
||||
actions.registerMany([
|
||||
adapter({
|
||||
|
||||
Reference in New Issue
Block a user