Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
task: Remove add new document button in navbar (#4868)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorrik-Klijnsma-Work authored Sep 14, 2023
1 parent 0739602 commit 4153337
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/cms/src/studio/document-options/document-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ import { PublishOrAcceptAction } from './custom-actions/publish-or-accept';

// Removes lokalize from the global "create new" interface at the top left of the navigation bar.
export const newDocumentOptions = (prev: TemplateResponse[], { creationContext }: { creationContext: NewDocumentCreationContext }) => {
if (creationContext.type === 'global' || creationContext.type === 'structure') {
if (creationContext.type === 'structure') {
return prev.filter((templateItem) => templateItem.templateId !== 'lokalizeText');
}
if (creationContext.type === 'global') {
// Removes the button visually from the header

window.document.querySelector('style')?.append('[data-ui="Navbar"] button[aria-label^="Create new document"] {display: none}');
// Removes the functionality from the button in the header
return [];
}

return prev;
};
Expand Down

0 comments on commit 4153337

Please sign in to comment.