overriding original elements
# help-with-umbraco
s
Hi, I'm trying to change the "save and preview" button to only "preview" and also change its onClick function to do something else. anyone know how to do so in the new version on umbraco?
who can help me out?
j
The buttons are called Workspace actions in the new backoffice. The save and preview button is registered as a workspace action here: https://github.com/umbraco/Umbraco-CMS/blob/contrib/src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/manifests.ts#L103 So to remove that button you can unregister that manifest yourself. You can then have a look at the code behind it, and add a copy with your changes that you can then register as a custom workspace action. https://github.com/umbraco/Umbraco-CMS/blob/contrib/src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/actions/save-and-preview.action.ts https://docs.umbraco.com/umbraco-cms/customizing/extending-overview/extension-types/workspaces/workspace-editor-actions
s
how do I unregister the manifest myself?
@Jemayn
j
If you register a backoffice entry point extension: https://docs.umbraco.com/umbraco-cms/customizing/extending-overview/extension-types/backoffice-entry-point Then within that extension you can remove other extensions by alias:
Copy code
js
import { UmbEntryPointOnInit, UmbEntryPointOnUnload } from '@umbraco-cms/backoffice/extension-api';

export const onInit: UmbEntryPointOnInit = (_host, _extensionRegistry) => {
  _extensionRegistry.exclude('Umb.WorkspaceAction.Document.SaveAndPreview');
};

export const onUnload: UmbEntryPointOnUnload = (_host, _extensionRegistry) => {};
s
thanks @Jemayn
@Jemayn HI, are you able to help with something similar? im trying to filter trash on certain document types on the Content side bar. so thanks to you i KNOW HOW TO EXCLUDE by alias but how can I exclude only if one of the menu items(i think theyre are called so) is equel to the name I want or any other condition? hope Im understood thanks
2 Views