readium / readium-js-viewer

👁 ReadiumJS viewer: default web app for Readium.js library
BSD 3-Clause "New" or "Revised" License
550 stars 186 forks source link

Enable the Annotation #629

Closed deepeshk12 closed 7 years ago

deepeshk12 commented 7 years ago

How can I enable Annotation feature.

This issue is a Question

llemeurfr commented 7 years ago

There is an ongoing initiative with hypothesis.js (see this post). A PR will soon be pushed by Evident Point on the Readium repo.

danielweck commented 7 years ago

In the interim, you can enable the "text highlighting" functionality (not a fully fledged annotation feature, but you can implement a more complete system based on this building block), by activating the plugin in readium-shared-js: https://github.com/readium/readium-shared-js/blob/develop/plugins/plugins.cson

Example usage: https://github.com/readium/readium-js-viewer/blob/develop/src/js/EpubReader.js#L1167

                    readium.reader.plugins.highlights.initialize({
                        annotationCSSUrl: readerOptions.annotationCSSUrl
                    });

                    readium.reader.plugins.highlights.on("annotationClicked", function(type, idref, cfi, id) {
        console.debug("ANNOTATION CLICK: " + id);
                        readium.reader.plugins.highlights.removeHighlight(id);
                    });

https://github.com/readium/readium-js-viewer/blob/develop/src/js/EpubReader.js#L851

        $(".icon-annotations").on("click", function () {
            readium.reader.plugins.highlights.addSelectionHighlight(Math.floor((Math.random()*1000000)), "test-highlight");
        });
hz0324 commented 7 years ago

@llemeurfr Hi, I have read the post you mentioned, looks like an exciting feature. The post says the annotation will be launched in summer 2007. Summer is passing half the way. When will it be ready to use? Thanks.

hz0324 commented 7 years ago

@danielweck Can you tell me how is going with the hypothesis.js project? Thanks.

llemeurfr commented 7 years ago

Hi @hz0324, please follow readium/readium-shared-js#396 to get updates on this project.

DougsAraujo commented 6 years ago

hypothesis is working, but the highlight does not work, I already enabled it in the cson package, what to do to work?

danielweck commented 6 years ago

@DougsAraujo see https://github.com/readium/readium-shared-js/issues/448#issuecomment-385627644