Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New: Allow BoxAnnotations to be instantiated independently and passed into Preview as an option #68

Merged
merged 4 commits into from
Dec 11, 2017

Conversation

pramodsum
Copy link
Contributor

@pramodsum pramodsum commented Dec 11, 2017

Dependent on box/box-content-preview#539

This will allow a developer to instantiate annotations outside of Preview like this:

const options = {
    Image: {
        enabled: true
    },

    // Document/Presentation Annotators are the same so the config is simplified here
    Document: {
        enabledTypes: ['highlight', 'draw']
    }
};


/* global BoxAnnotations */
const boxAnnotations = new BoxAnnotations(options);

var preview = new Box.Preview();
preview.show(FILE_ID, ACCESS_TOKEN, {
    container: '.preview-container',
    showDownload: true,
    boxAnnotations
});

@boxcla
Copy link

boxcla commented Dec 11, 2017

Verified that @pramodsum has signed the CLA. Thanks for the pull request!

@pramodsum pramodsum changed the title New: Allow BoxAnnotations to be instantiated independently and passed into Preview as an option\ New: Allow BoxAnnotations to be instantiated independently and passed into Preview as an option Dec 11, 2017
// Filter out supported annotation types based on provided options
Object.keys(options).forEach((annotatorName) => {
const annotator = this.annotators[annotatorName];
annotator.TYPE = this.getAnnotatorTypes(annotator);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guard for whether or not annotator exists

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-working how these configs are set

@pramodsum pramodsum merged commit 8c1637a into box:master Dec 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants