@@ -58,6 +58,15 @@ import {
5858 BookEmbeddableFactoryDefinition ,
5959} from './book/book_embeddable_factory' ;
6060import { UiActionsStart } from '../../../src/plugins/ui_actions/public' ;
61+ import {
62+ ACTION_ADD_BOOK_TO_LIBRARY ,
63+ createAddBookToLibraryAction ,
64+ } from './book/add_book_to_library_action' ;
65+ import { DashboardStart } from '../../../src/plugins/dashboard/public' ;
66+ import {
67+ ACTION_UNLINK_BOOK_FROM_LIBRARY ,
68+ createUnlinkBookFromLibraryAction ,
69+ } from './book/unlink_book_from_library_action' ;
6170
6271export interface EmbeddableExamplesSetupDependencies {
6372 embeddable : EmbeddableSetup ;
@@ -66,6 +75,7 @@ export interface EmbeddableExamplesSetupDependencies {
6675
6776export interface EmbeddableExamplesStartDependencies {
6877 embeddable : EmbeddableStart ;
78+ dashboard : DashboardStart ;
6979}
7080
7181interface ExampleEmbeddableFactories {
@@ -86,6 +96,8 @@ export interface EmbeddableExamplesStart {
8696declare module '../../../src/plugins/ui_actions/public' {
8797 export interface ActionContextMapping {
8898 [ ACTION_EDIT_BOOK ] : { embeddable : BookEmbeddable } ;
99+ [ ACTION_ADD_BOOK_TO_LIBRARY ] : { embeddable : BookEmbeddable } ;
100+ [ ACTION_UNLINK_BOOK_FROM_LIBRARY ] : { embeddable : BookEmbeddable } ;
89101 }
90102}
91103
@@ -144,17 +156,25 @@ export class EmbeddableExamplesPlugin
144156 this . exampleEmbeddableFactories . getBookEmbeddableFactory = deps . embeddable . registerEmbeddableFactory (
145157 BOOK_EMBEDDABLE ,
146158 new BookEmbeddableFactoryDefinition ( async ( ) => ( {
147- getAttributeService : ( await core . getStartServices ( ) ) [ 1 ] . embeddable . getAttributeService ,
159+ getAttributeService : ( await core . getStartServices ( ) ) [ 1 ] . dashboard . getAttributeService ,
148160 openModal : ( await core . getStartServices ( ) ) [ 0 ] . overlays . openModal ,
149161 } ) )
150162 ) ;
151163
152164 const editBookAction = createEditBookAction ( async ( ) => ( {
153- getAttributeService : ( await core . getStartServices ( ) ) [ 1 ] . embeddable . getAttributeService ,
165+ getAttributeService : ( await core . getStartServices ( ) ) [ 1 ] . dashboard . getAttributeService ,
154166 openModal : ( await core . getStartServices ( ) ) [ 0 ] . overlays . openModal ,
155167 } ) ) ;
156168 deps . uiActions . registerAction ( editBookAction ) ;
157169 deps . uiActions . attachAction ( CONTEXT_MENU_TRIGGER , editBookAction . id ) ;
170+
171+ const addBookToLibraryAction = createAddBookToLibraryAction ( ) ;
172+ deps . uiActions . registerAction ( addBookToLibraryAction ) ;
173+ deps . uiActions . attachAction ( CONTEXT_MENU_TRIGGER , addBookToLibraryAction . id ) ;
174+
175+ const unlinkBookFromLibraryAction = createUnlinkBookFromLibraryAction ( ) ;
176+ deps . uiActions . registerAction ( unlinkBookFromLibraryAction ) ;
177+ deps . uiActions . attachAction ( CONTEXT_MENU_TRIGGER , unlinkBookFromLibraryAction . id ) ;
158178 }
159179
160180 public start (
0 commit comments