Skip to content

Commit

Permalink
Fix Non-Admin issue in getSidebarItem
Browse files Browse the repository at this point in the history
Fixing issue highlighted in galloween#12 where non-admin users do not have a config data-panel. If undefined it will instead use media-browser as the last element.
  • Loading branch information
XxInvictus authored Jan 17, 2023
1 parent 097d961 commit 49eb8ae
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion dist/custom-sidebar-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,20 @@
if (!root || !root.children) {
return;
}
return Array.from(root.children).find((element) => {
let lastdatapanel = Array.from(root.children).find((element) => {
return (
element.tagName == 'A' && element.getAttribute('data-panel') == 'config'
);
});
if (!lastdatapanel) {
lastpanel = Array.from(root.children).find((element) => {
return (
element.tagName == 'A' && element.getAttribute('data-panel') == 'media-browser'
);
});
}

return lastpanel;
}

function setTitle(title) {
Expand Down

0 comments on commit 49eb8ae

Please sign in to comment.