File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import miradorShareDialogPlugin from 'mirador-share-plugin/es/MiradorShareDialog
1616import miradorSharePlugin from 'mirador-share-plugin/es/miradorSharePlugin' ;
1717import miradorDownloadPlugin from 'mirador-dl-plugin/es/miradorDownloadPlugin' ;
1818import miradorDownloadDialog from 'mirador-dl-plugin/es/MiradorDownloadDialog' ;
19+ import myPlugin from './locationPlugin' ;
1920
2021const MANIFEST_URL_PART = / \/ m a n i f e s t $ / ;
2122
@@ -185,6 +186,7 @@ let miradorPlugins = [
185186 miradorShareDialogPlugin ,
186187 miradorSharePlugin ,
187188 miradorDownloadDialog ,
189+ myPlugin
188190] ;
189191
190192( ( ) => {
@@ -195,3 +197,14 @@ let miradorPlugins = [
195197} ) ( ) ;
196198
197199Mirador . viewer ( miradorConfiguration , miradorPlugins ) ;
200+ /*miradorInstance?.store?.subscribe((store) => {
201+ console.log(miradorInstance?.store, store);
202+ const state = store?.getState();
203+ const lastAction = state?.lastAction;
204+ console.log(state, lastAction);
205+
206+ if (lastAction && lastAction.type === 'SELECT_CANVAS') {
207+ const canvasId = lastAction.canvasId;
208+ console.log('Canvas cliccato:', canvasId);
209+ }
210+ });*/
Original file line number Diff line number Diff line change 1+ import takeEvery from 'redux-saga/effects' ;
2+ import ActionTypes from 'mirador/dist/es/src/state/actions/action-types' ;
3+
4+ /** This will be called every time the SET_CANVAS action is dispatched */
5+ const onCanvasChange = function * ( action ) {
6+ console . log ( action ) ;
7+ }
8+
9+ const pluginSaga = function * ( ) {
10+ /* `takeEvery` calls the associated function every time the action is dispatched */
11+ yield takeEvery ( [
12+ ActionTypes . SET_CANVAS ,
13+ ActionTypes . RECEIVE_SEARCH ,
14+ ActionTypes . REMOVE_SEARCH ,
15+ ActionTypes . SET_WINDOW_VIEW_TYPE ,
16+ ] , onCanvasChange ) ;
17+ }
18+
19+ const myPlugin = {
20+ component : ( ) => null ,
21+ saga : pluginSaga ,
22+ }
23+
24+ export default myPlugin ;
You can’t perform that action at this time.
0 commit comments