Modify content API.

37 views
Skip to first unread message

Farid Hidayat

unread,
Apr 14, 2014, 7:53:32 AM4/14/14
to monoc...@googlegroups.com
Does any one know, the monocle's API to modify content dynamically without create new reader every content changes ( var reader = Monocle.Reader('reader',bookData,{ panels:Monocle.Panels.Magic },fn))

may be it has API like 

reader.changeContent(myContent);

thanks a lot.



Joseph Pearson

unread,
Apr 15, 2014, 11:08:57 AM4/15/14
to monoc...@googlegroups.com
Depends what you mean by content (a book? a component? a paragraph within a component?). In general, if you are changing the bookData object, you should create a new reader. Monocle has populated all sorts of properties based on the original book data, and repopulating those would amount to creating a new reader object anyway.

If you are changing the content of a component, you can use the monocle:componentmodify event when the component loads. If you're doing it at other times, you need to iterate across the pages and drill down into the component iframes manually, then call reader.recalculateDimensions() to re-paginate the content.

Cheers,

— J

--
You received this message because you are subscribed to the Google Groups "Monocle" group.
To unsubscribe from this group and stop receiving emails from it, send an email to monocle-js+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages