mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-06-25 05:59:37 +02:00
32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
import Injector from 'lib/Injector';
|
|
import AnchorSelectorField from 'components/AnchorSelectorField/AnchorSelectorField';
|
|
import readOnePageQuery from 'state/history/readOnePageQuery';
|
|
import rollbackPageMutation from 'state/history/rollbackPageMutation';
|
|
|
|
export default () => {
|
|
Injector.component.register('AnchorSelectorField', AnchorSelectorField);
|
|
|
|
Injector.transform(
|
|
'pages-history',
|
|
(updater) => {
|
|
// Add CMS page history GraphQL query to the HistoryViewer
|
|
updater.component('HistoryViewer.pages-controller-cms-content', readOnePageQuery, 'PageHistoryViewer');
|
|
}
|
|
);
|
|
|
|
Injector.transform(
|
|
'pages-history-revert',
|
|
(updater) => {
|
|
// Add CMS page revert GraphQL mutation to the HistoryViewerToolbar
|
|
updater.component(
|
|
'HistoryViewerToolbar.VersionedAdmin.HistoryViewer.SiteTree.HistoryViewerVersionDetail',
|
|
// This was using `copyToStage` incorrectly which also provides from and to stage
|
|
// arguments. The "rollback" mutation correctly handles relations and is a more consumable
|
|
// API endpoint.
|
|
rollbackPageMutation,
|
|
'PageRevertMutation'
|
|
);
|
|
}
|
|
);
|
|
};
|