Content Management and Capture

Content Management and Capture

Come for answers. Stay for best practices. All we’re missing is you.

 View Only
  • 1.  How to use the Daeja JS API within the viewerToolbarPlugin sample code

    Posted Fri May 20, 2022 06:32 PM

    I am trying to use methods from the JS API within the sample code for the viewer toolbar plugin, specifically this function here: https://github.com/ibm-ecm/ibm-content-navigator-samples/blob/master/ViewerToolbarPlugin/src/com/ibm/ecm/extension/viewerToolbar/WebContent/ViewerToolbarPlugin.js#L14-L19

    However, it is not clear to me how to invoke/use this API within the sample.

    Any guidance is greatly appreciated!



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 2.  RE: How to use the Daeja JS API within the viewerToolbarPlugin sample code
    Best Answer

    Posted Fri May 20, 2022 06:36 PM


  • 3.  RE: How to use the Daeja JS API within the viewerToolbarPlugin sample code
    Best Answer

    Posted Mon May 23, 2022 04:54 PM

    You should be able to call the API methods using the 'this.viewer' object. Please let me know if this doesn't work.

    Regards,

    Andy



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 4.  RE: How to use the Daeja JS API within the viewerToolbarPlugin sample code
    Best Answer

    Posted Tue May 24, 2022 05:03 PM

    Andy,


    This does not work and I get an undefined error. When logging `this` in this function, it appears to be the window object, and I do not see `viewer` in there.



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 5.  RE: How to use the Daeja JS API within the viewerToolbarPlugin sample code
    Best Answer

    Posted Tue May 24, 2022 06:19 PM

    Andy,


    I did some other testing and did have luck accessing the `this.viewer` object in this function of the sample: https://github.com/ibm-ecm/ibm-content-navigator-samples/blob/master/ViewerToolbarPlugin/src/com/ibm/ecm/extension/viewerToolbar/WebContent/ViewerToolbarPlugin.js#L37-L52 and I am able to access the desired methods.


    Thanks!





    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 6.  RE: How to use the Daeja JS API within the viewerToolbarPlugin sample code
    Best Answer

    Posted Wed May 25, 2022 02:26 AM

    You're right. 'this.viewer' can only be accessed when the event handled is attached as the custom button 2 in the sample plugin.


    Regards,

    Andy



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration