2017-09-05 04:38:38 +02:00
|
|
|
import Injector from 'lib/Injector';
|
|
|
|
import AnchorSelectorField from 'components/AnchorSelectorField/AnchorSelectorField';
|
2018-05-17 05:36:46 +02:00
|
|
|
import readOnePageQuery from 'state/history/readOnePageQuery';
|
2018-11-23 01:07:01 +01:00
|
|
|
import rollbackPageMutation from 'state/history/rollbackPageMutation';
|
2017-09-05 04:38:38 +02:00
|
|
|
|
|
|
|
export default () => {
|
|
|
|
Injector.component.register('AnchorSelectorField', AnchorSelectorField);
|
2018-03-06 00:00:22 +01:00
|
|
|
|
|
|
|
Injector.transform(
|
|
|
|
'pages-history',
|
|
|
|
(updater) => {
|
2018-05-17 05:36:46 +02:00
|
|
|
// 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
|
2018-11-23 01:07:01 +01:00
|
|
|
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'
|
|
|
|
);
|
2018-03-06 00:00:22 +01:00
|
|
|
}
|
|
|
|
);
|
2017-09-05 04:38:38 +02:00
|
|
|
};
|